Blame view

lib/syspro/get_logon_profile.rb 2.48 KB
dc8aa5b6   Joe Weakley   Rubocop corrections
1
2
  # frozen_string_literal: true
  
a61f2fc8   Isaac Lewis   parse logon profile
3
4
5
  module Syspro
    class GetLogonProfile < ApiResource
      def self.get_logon_profile(user_id)
dc8aa5b6   Joe Weakley   Rubocop corrections
6
7
        params = { 'UserId' => user_id }
        resp = request(:get, resource_url, params)
a61f2fc8   Isaac Lewis   parse logon profile
8
9
10
11
        parse_response(resp[0])
      end
  
      def resource_url
dc8aa5b6   Joe Weakley   Rubocop corrections
12
        '/GetLogonProfile'
a61f2fc8   Isaac Lewis   parse logon profile
13
14
      end
  
dc8aa5b6   Joe Weakley   Rubocop corrections
15
      def self.parse_response(resp) # rubocop:disable Metrics/MethodLength
a61f2fc8   Isaac Lewis   parse logon profile
16
17
        doc = resp.data
  
697a8854   Isaac Lewis   update tests
18
        UserProfile.new(
dc8aa5b6   Joe Weakley   Rubocop corrections
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
          doc.xpath('//CompanyName').text,
          doc.xpath('//OperatorCode').text,
          doc.xpath('//OperatorGroup').text,
          doc.xpath('//OperatorEmailAddress').text,
          doc.xpath('//OperatorLocation').text,
          doc.xpath('//OperatorLanguageCode').text,
          doc.xpath('//SystemLanguage').text,
          doc.xpath('//AccountingDate').text,
          doc.xpath('//CompanyDate').text,
          doc.xpath('//DefaultArBranch').text,
          doc.xpath('//DefaultApBranch').text,
          doc.xpath('//DefaultBank').text,
          doc.xpath('//DefaultWarehouse').text,
          doc.xpath('//DefaultCustomer').text,
          doc.xpath('//SystemSiteId').text,
          doc.xpath('//SystemNationalityCode').text,
          doc.xpath('//LocalCurrencyCode').text,
          doc.xpath('//CurrencyDescription').text,
          doc.xpath('//DefaultRequisitionUser').text,
          doc.xpath('//XMLToHTMLTransform').text,
          doc.xpath('//CssStyle').text,
          doc.xpath('//CssSuffix').text,
          doc.xpath('//DecimalFormat').text,
          doc.xpath('//DateFormat').text,
          doc.xpath('//FunctionalRole').text,
          doc.xpath('//DatabaseType').text,
          doc.xpath('//SysproVersion').text,
          doc.xpath('//EnetVersion').text,
          doc.xpath('//SysproServerBitWidth').text
a61f2fc8   Isaac Lewis   parse logon profile
48
49
50
51
        )
      end
      private_class_method :parse_response
  
dc8aa5b6   Joe Weakley   Rubocop corrections
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
      UserProfile = Struct.new(
        :company_name,
        :operator_code,
        :operator_group,
        :operator_email_address,
        :operator_location,
        :operator_language_code,
        :system_language,
        :accounting_date,
        :company_date,
        :default_ar_branch,
        :default_ap_branch,
        :default_bank,
        :default_warehouse,
        :default_customer,
        :system_site_id,
        :system_nationality_code,
        :local_currency_code,
        :currency_description,
        :default_requisition_user,
        :xml_to_html_transform,
        :css_style,
        :css_suffix,
        :decimal_format,
        :date_format,
        :functional_role,
        :database_type,
        :syspro_version,
        :enet_version,
        :syspro_server_bit_width
      )
a61f2fc8   Isaac Lewis   parse logon profile
83
84
    end
  end