Blame view

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