Commit a3292c7108ade6df6b7be47b665d3933e3aa84b7
1 parent
7510ff56
remove unneeded class include; use openstruct for large struct in logon profile
Showing
2 changed files
with
30 additions
and
64 deletions
Show diff stats
lib/syspro/api_operations/query.rb
@@ -4,8 +4,6 @@ module Syspro | @@ -4,8 +4,6 @@ module Syspro | ||
4 | module ApiOperations | 4 | module ApiOperations |
5 | module Query | 5 | module Query |
6 | module ClassMethods | 6 | module ClassMethods |
7 | - include Request | ||
8 | - | ||
9 | def browse(params) | 7 | def browse(params) |
10 | request(:get, '/Query/Browse', params) | 8 | request(:get, '/Query/Browse', params) |
11 | end | 9 | end |
lib/syspro/get_logon_profile.rb
@@ -15,70 +15,38 @@ module Syspro | @@ -15,70 +15,38 @@ module Syspro | ||
15 | def self.parse_response(resp) # rubocop:disable Metrics/MethodLength | 15 | def self.parse_response(resp) # rubocop:disable Metrics/MethodLength |
16 | doc = resp.data | 16 | doc = resp.data |
17 | 17 | ||
18 | - UserProfile.new( | ||
19 | - doc.xpath('//CompanyName').text, | ||
20 | - doc.xpath('//OperatorCode').text, | ||
21 | - doc.xpath('//OperatorGroup').text, | ||
22 | - doc.xpath('//OperatorEmailAddress').text, | ||
23 | - doc.xpath('//OperatorLocation').text, | ||
24 | - doc.xpath('//OperatorLanguageCode').text, | ||
25 | - doc.xpath('//SystemLanguage').text, | ||
26 | - doc.xpath('//AccountingDate').text, | ||
27 | - doc.xpath('//CompanyDate').text, | ||
28 | - doc.xpath('//DefaultArBranch').text, | ||
29 | - doc.xpath('//DefaultApBranch').text, | ||
30 | - doc.xpath('//DefaultBank').text, | ||
31 | - doc.xpath('//DefaultWarehouse').text, | ||
32 | - doc.xpath('//DefaultCustomer').text, | ||
33 | - doc.xpath('//SystemSiteId').text, | ||
34 | - doc.xpath('//SystemNationalityCode').text, | ||
35 | - doc.xpath('//LocalCurrencyCode').text, | ||
36 | - doc.xpath('//CurrencyDescription').text, | ||
37 | - doc.xpath('//DefaultRequisitionUser').text, | ||
38 | - doc.xpath('//XMLToHTMLTransform').text, | ||
39 | - doc.xpath('//CssStyle').text, | ||
40 | - doc.xpath('//CssSuffix').text, | ||
41 | - doc.xpath('//DecimalFormat').text, | ||
42 | - doc.xpath('//DateFormat').text, | ||
43 | - doc.xpath('//FunctionalRole').text, | ||
44 | - doc.xpath('//DatabaseType').text, | ||
45 | - doc.xpath('//SysproVersion').text, | ||
46 | - doc.xpath('//EnetVersion').text, | ||
47 | - doc.xpath('//SysproServerBitWidth').text | 18 | + OpenStruct.new( |
19 | + company_name: doc.xpath('//CompanyName').text, | ||
20 | + operator_code: doc.xpath('//OperatorCode').text, | ||
21 | + operator_code: doc.xpath('//OperatorGroup').text, | ||
22 | + operator_email_address: doc.xpath('//OperatorEmailAddress').text, | ||
23 | + operator_location: doc.xpath('//OperatorLocation').text, | ||
24 | + operator_language_code: doc.xpath('//OperatorLanguageCode').text, | ||
25 | + system_language: doc.xpath('//SystemLanguage').text, | ||
26 | + accounting_date: doc.xpath('//AccountingDate').text, | ||
27 | + company_date: doc.xpath('//CompanyDate').text, | ||
28 | + default_ar_branch: doc.xpath('//DefaultArBranch').text, | ||
29 | + default_ap_branch: doc.xpath('//DefaultApBranch').text, | ||
30 | + default_bank: doc.xpath('//DefaultBank').text, | ||
31 | + default_warehouse: doc.xpath('//DefaultWarehouse').text, | ||
32 | + default_customer: doc.xpath('//DefaultCustomer').text, | ||
33 | + system_site_id: doc.xpath('//SystemSiteId').text, | ||
34 | + system_nationality_code: doc.xpath('//SystemNationalityCode').text, | ||
35 | + local_currency_code: doc.xpath('//LocalCurrencyCode').text, | ||
36 | + currency_description: doc.xpath('//CurrencyDescription').text, | ||
37 | + default_requisition_user: doc.xpath('//DefaultRequisitionUser').text, | ||
38 | + xml_to_html_transform: doc.xpath('//XMLToHTMLTransform').text, | ||
39 | + css_style: doc.xpath('//CssStyle').text, | ||
40 | + css_suffix: doc.xpath('//CssSuffix').text, | ||
41 | + decimal_format: doc.xpath('//DecimalFormat').text, | ||
42 | + date_format: doc.xpath('//DateFormat').text, | ||
43 | + functional_role: doc.xpath('//FunctionalRole').text, | ||
44 | + database_type: doc.xpath('//DatabaseType').text, | ||
45 | + syspro_version: doc.xpath('//SysproVersion').text, | ||
46 | + enet_version: doc.xpath('//EnetVersion').text, | ||
47 | + syspro_server_bit_width: doc.xpath('//SysproServerBitWidth').text | ||
48 | ) | 48 | ) |
49 | end | 49 | end |
50 | private_class_method :parse_response | 50 | private_class_method :parse_response |
51 | - | ||
52 | - UserProfile = Struct.new( | ||
53 | - :company_name, | ||
54 | - :operator_code, | ||
55 | - :operator_group, | ||
56 | - :operator_email_address, | ||
57 | - :operator_location, | ||
58 | - :operator_language_code, | ||
59 | - :system_language, | ||
60 | - :accounting_date, | ||
61 | - :company_date, | ||
62 | - :default_ar_branch, | ||
63 | - :default_ap_branch, | ||
64 | - :default_bank, | ||
65 | - :default_warehouse, | ||
66 | - :default_customer, | ||
67 | - :system_site_id, | ||
68 | - :system_nationality_code, | ||
69 | - :local_currency_code, | ||
70 | - :currency_description, | ||
71 | - :default_requisition_user, | ||
72 | - :xml_to_html_transform, | ||
73 | - :css_style, | ||
74 | - :css_suffix, | ||
75 | - :decimal_format, | ||
76 | - :date_format, | ||
77 | - :functional_role, | ||
78 | - :database_type, | ||
79 | - :syspro_version, | ||
80 | - :enet_version, | ||
81 | - :syspro_server_bit_width | ||
82 | - ) | ||
83 | end | 51 | end |
84 | end | 52 | end |