Blame view

lib/syspro/logon.rb 518 Bytes
dc8aa5b6   Joe Weakley   Rubocop corrections
1
2
  # frozen_string_literal: true
  
49716587   Isaac Lewis   refactor object s...
3
  module Syspro
3d0157a5   Isaac Lewis   add logoff
4
5
6
    class Logon < ApiResource
      def self.logon(username, password, company_id, company_password = nil)
        params = {
dc8aa5b6   Joe Weakley   Rubocop corrections
7
8
9
10
          'Operator' => username,
          'OperatorPassword' => password,
          'CompanyId' => company_id,
          'CompanyPassword' => company_password
3d0157a5   Isaac Lewis   add logoff
11
        }
dc8aa5b6   Joe Weakley   Rubocop corrections
12
        resp = request(:get, resource_url, params)
697a8854   Isaac Lewis   update tests
13
        UserIdObject.new(resp[0].http_body)
3d0157a5   Isaac Lewis   add logoff
14
      end
49716587   Isaac Lewis   refactor object s...
15
  
3d0157a5   Isaac Lewis   add logoff
16
      def resource_url
dc8aa5b6   Joe Weakley   Rubocop corrections
17
        '/Logon'
49716587   Isaac Lewis   refactor object s...
18
      end
3d0157a5   Isaac Lewis   add logoff
19
20
  
      UserIdObject = Struct.new(:guid)
49716587   Isaac Lewis   refactor object s...
21
22
    end
  end