data-and-reporting-sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +104 -0
  4. data/lib/shell_data_reporting_ap_is/api_helper.rb +10 -0
  5. data/lib/shell_data_reporting_ap_is/client.rb +84 -0
  6. data/lib/shell_data_reporting_ap_is/configuration.rb +110 -0
  7. data/lib/shell_data_reporting_ap_is/controllers/base_controller.rb +66 -0
  8. data/lib/shell_data_reporting_ap_is/controllers/customer_controller.rb +478 -0
  9. data/lib/shell_data_reporting_ap_is/controllers/invoice_controller.rb +470 -0
  10. data/lib/shell_data_reporting_ap_is/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/shell_data_reporting_ap_is/controllers/transaction_controller.rb +878 -0
  12. data/lib/shell_data_reporting_ap_is/exceptions/api_exception.rb +10 -0
  13. data/lib/shell_data_reporting_ap_is/exceptions/default_error_exception.rb +32 -0
  14. data/lib/shell_data_reporting_ap_is/exceptions/error_object_exception.rb +54 -0
  15. data/lib/shell_data_reporting_ap_is/exceptions/error_user_access_error1_exception.rb +32 -0
  16. data/lib/shell_data_reporting_ap_is/exceptions/o_auth_provider_exception.rb +48 -0
  17. data/lib/shell_data_reporting_ap_is/http/auth/basic_auth.rb +50 -0
  18. data/lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb +89 -0
  19. data/lib/shell_data_reporting_ap_is/http/http_call_back.rb +10 -0
  20. data/lib/shell_data_reporting_ap_is/http/http_method_enum.rb +10 -0
  21. data/lib/shell_data_reporting_ap_is/http/http_request.rb +10 -0
  22. data/lib/shell_data_reporting_ap_is/http/http_response.rb +10 -0
  23. data/lib/shell_data_reporting_ap_is/models/account_access.rb +128 -0
  24. data/lib/shell_data_reporting_ap_is/models/account_request.rb +252 -0
  25. data/lib/shell_data_reporting_ap_is/models/account_response.rb +111 -0
  26. data/lib/shell_data_reporting_ap_is/models/account_response_accounts_items.rb +750 -0
  27. data/lib/shell_data_reporting_ap_is/models/accounts.rb +65 -0
  28. data/lib/shell_data_reporting_ap_is/models/address.rb +174 -0
  29. data/lib/shell_data_reporting_ap_is/models/associated_account.rb +98 -0
  30. data/lib/shell_data_reporting_ap_is/models/audit_request.rb +256 -0
  31. data/lib/shell_data_reporting_ap_is/models/audit_response.rb +111 -0
  32. data/lib/shell_data_reporting_ap_is/models/audit_response_audits_items.rb +450 -0
  33. data/lib/shell_data_reporting_ap_is/models/bank_account.rb +192 -0
  34. data/lib/shell_data_reporting_ap_is/models/base_model.rb +62 -0
  35. data/lib/shell_data_reporting_ap_is/models/bonus_configuration.rb +419 -0
  36. data/lib/shell_data_reporting_ap_is/models/bonus_history.rb +444 -0
  37. data/lib/shell_data_reporting_ap_is/models/card_day_time_restrictions.rb +159 -0
  38. data/lib/shell_data_reporting_ap_is/models/card_exceptions.rb +268 -0
  39. data/lib/shell_data_reporting_ap_is/models/card_group_request.rb +178 -0
  40. data/lib/shell_data_reporting_ap_is/models/card_group_response.rb +109 -0
  41. data/lib/shell_data_reporting_ap_is/models/card_group_response_card_groups_items.rb +301 -0
  42. data/lib/shell_data_reporting_ap_is/models/card_type_request.rb +145 -0
  43. data/lib/shell_data_reporting_ap_is/models/card_type_response.rb +79 -0
  44. data/lib/shell_data_reporting_ap_is/models/card_type_response_customer_card_types_items.rb +470 -0
  45. data/lib/shell_data_reporting_ap_is/models/card_type_response_error.rb +60 -0
  46. data/lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb +281 -0
  47. data/lib/shell_data_reporting_ap_is/models/card_usage_summary_request.rb +159 -0
  48. data/lib/shell_data_reporting_ap_is/models/card_usage_summary_response.rb +79 -0
  49. data/lib/shell_data_reporting_ap_is/models/col_co_access.rb +88 -0
  50. data/lib/shell_data_reporting_ap_is/models/current_volume.rb +99 -0
  51. data/lib/shell_data_reporting_ap_is/models/customer_contract.rb +63 -0
  52. data/lib/shell_data_reporting_ap_is/models/customer_detail_request.rb +123 -0
  53. data/lib/shell_data_reporting_ap_is/models/customer_detail_response.rb +437 -0
  54. data/lib/shell_data_reporting_ap_is/models/customer_price_list_request.rb +200 -0
  55. data/lib/shell_data_reporting_ap_is/models/customer_price_list_response.rb +82 -0
  56. data/lib/shell_data_reporting_ap_is/models/default_error_fault.rb +60 -0
  57. data/lib/shell_data_reporting_ap_is/models/default_error_fault_detail.rb +50 -0
  58. data/lib/shell_data_reporting_ap_is/models/delivery_addresses.rb +258 -0
  59. data/lib/shell_data_reporting_ap_is/models/eid_access.rb +75 -0
  60. data/lib/shell_data_reporting_ap_is/models/eid_document.rb +166 -0
  61. data/lib/shell_data_reporting_ap_is/models/eid_document_response.rb +140 -0
  62. data/lib/shell_data_reporting_ap_is/models/eid_download_req.rb +86 -0
  63. data/lib/shell_data_reporting_ap_is/models/eid_download_request.rb +50 -0
  64. data/lib/shell_data_reporting_ap_is/models/eid_search_req.rb +160 -0
  65. data/lib/shell_data_reporting_ap_is/models/eid_search_request.rb +70 -0
  66. data/lib/shell_data_reporting_ap_is/models/error_details.rb +81 -0
  67. data/lib/shell_data_reporting_ap_is/models/error_status.rb +60 -0
  68. data/lib/shell_data_reporting_ap_is/models/error_user_access.rb +50 -0
  69. data/lib/shell_data_reporting_ap_is/models/error_user_access_error.rb +60 -0
  70. data/lib/shell_data_reporting_ap_is/models/exception_product.rb +65 -0
  71. data/lib/shell_data_reporting_ap_is/models/exception_site_location.rb +63 -0
  72. data/lib/shell_data_reporting_ap_is/models/fee_item.rb +977 -0
  73. data/lib/shell_data_reporting_ap_is/models/fee_item_summary_all_of0.rb +194 -0
  74. data/lib/shell_data_reporting_ap_is/models/fee_rule_location.rb +153 -0
  75. data/lib/shell_data_reporting_ap_is/models/fee_rule_product.rb +98 -0
  76. data/lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb +74 -0
  77. data/lib/shell_data_reporting_ap_is/models/fee_summary_response.rb +85 -0
  78. data/lib/shell_data_reporting_ap_is/models/fees_fee_rule_tiers.rb +124 -0
  79. data/lib/shell_data_reporting_ap_is/models/finance_currency.rb +98 -0
  80. data/lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb +73 -0
  81. data/lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb +267 -0
  82. data/lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb +197 -0
  83. data/lib/shell_data_reporting_ap_is/models/fuel_consumption_response.rb +79 -0
  84. data/lib/shell_data_reporting_ap_is/models/invoice_dates_data.rb +62 -0
  85. data/lib/shell_data_reporting_ap_is/models/invoice_dates_request.rb +50 -0
  86. data/lib/shell_data_reporting_ap_is/models/invoice_dates_request_filters.rb +146 -0
  87. data/lib/shell_data_reporting_ap_is/models/invoice_dates_response_data.rb +80 -0
  88. data/lib/shell_data_reporting_ap_is/models/invoice_distribution_method.rb +99 -0
  89. data/lib/shell_data_reporting_ap_is/models/invoice_download_req.rb +99 -0
  90. data/lib/shell_data_reporting_ap_is/models/invoice_download_request.rb +50 -0
  91. data/lib/shell_data_reporting_ap_is/models/invoice_search_additional_document.rb +80 -0
  92. data/lib/shell_data_reporting_ap_is/models/invoice_search_details.rb +913 -0
  93. data/lib/shell_data_reporting_ap_is/models/invoice_search_request.rb +91 -0
  94. data/lib/shell_data_reporting_ap_is/models/invoice_search_request_filters.rb +344 -0
  95. data/lib/shell_data_reporting_ap_is/models/invoice_search_response.rb +127 -0
  96. data/lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb +129 -0
  97. data/lib/shell_data_reporting_ap_is/models/invoice_summary_request.rb +50 -0
  98. data/lib/shell_data_reporting_ap_is/models/invoice_summary_request_filters.rb +345 -0
  99. data/lib/shell_data_reporting_ap_is/models/invoice_summary_response.rb +79 -0
  100. data/lib/shell_data_reporting_ap_is/models/invoices_summaries.rb +221 -0
  101. data/lib/shell_data_reporting_ap_is/models/last_statement_of_account.rb +421 -0
  102. data/lib/shell_data_reporting_ap_is/models/logged_in_user_request.rb +107 -0
  103. data/lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb +394 -0
  104. data/lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb +112 -0
  105. data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_request.rb +360 -0
  106. data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_request_accounts_items.rb +84 -0
  107. data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_response.rb +110 -0
  108. data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_response_transactions_items.rb +1724 -0
  109. data/lib/shell_data_reporting_ap_is/models/o_auth_provider_error_enum.rb +45 -0
  110. data/lib/shell_data_reporting_ap_is/models/o_auth_token.rb +100 -0
  111. data/lib/shell_data_reporting_ap_is/models/past_statement_of_accounts.rb +502 -0
  112. data/lib/shell_data_reporting_ap_is/models/payer_access.rb +147 -0
  113. data/lib/shell_data_reporting_ap_is/models/payer_details.rb +1412 -0
  114. data/lib/shell_data_reporting_ap_is/models/payer_request.rb +126 -0
  115. data/lib/shell_data_reporting_ap_is/models/payer_response.rb +115 -0
  116. data/lib/shell_data_reporting_ap_is/models/payers.rb +109 -0
  117. data/lib/shell_data_reporting_ap_is/models/payments_since_last_soa.rb +322 -0
  118. data/lib/shell_data_reporting_ap_is/models/pin_advice_types.rb +80 -0
  119. data/lib/shell_data_reporting_ap_is/models/price_list.rb +485 -0
  120. data/lib/shell_data_reporting_ap_is/models/price_trans_summary_request.rb +477 -0
  121. data/lib/shell_data_reporting_ap_is/models/price_transaction_request.rb +572 -0
  122. data/lib/shell_data_reporting_ap_is/models/priced_request_data.rb +485 -0
  123. data/lib/shell_data_reporting_ap_is/models/priced_response_data.rb +2132 -0
  124. data/lib/shell_data_reporting_ap_is/models/priced_trans_summary_response.rb +79 -0
  125. data/lib/shell_data_reporting_ap_is/models/priced_trans_summary_response_transactions_summary_items.rb +242 -0
  126. data/lib/shell_data_reporting_ap_is/models/priced_transaction_items_location_items.rb +67 -0
  127. data/lib/shell_data_reporting_ap_is/models/priced_transaction_req_v2_invoice_status_enum.rb +27 -0
  128. data/lib/shell_data_reporting_ap_is/models/priced_transaction_req_v2_period_enum.rb +27 -0
  129. data/lib/shell_data_reporting_ap_is/models/priced_transaction_req_v2_sort_order_enum.rb +37 -0
  130. data/lib/shell_data_reporting_ap_is/models/priced_transaction_request_v2.rb +72 -0
  131. data/lib/shell_data_reporting_ap_is/models/priced_transaction_resp_v2_refund_flag_enum.rb +23 -0
  132. data/lib/shell_data_reporting_ap_is/models/priced_transaction_response.rb +59 -0
  133. data/lib/shell_data_reporting_ap_is/models/priced_transaction_response_transactions_items.rb +1719 -0
  134. data/lib/shell_data_reporting_ap_is/models/priced_transaction_response_v2.rb +110 -0
  135. data/lib/shell_data_reporting_ap_is/models/pricing_current_volume.rb +115 -0
  136. data/lib/shell_data_reporting_ap_is/models/pricing_history.rb +105 -0
  137. data/lib/shell_data_reporting_ap_is/models/purchase_categories.rb +114 -0
  138. data/lib/shell_data_reporting_ap_is/models/recent_transaction_req.rb +217 -0
  139. data/lib/shell_data_reporting_ap_is/models/recent_transaction_request.rb +66 -0
  140. data/lib/shell_data_reporting_ap_is/models/recent_transactions.rb +918 -0
  141. data/lib/shell_data_reporting_ap_is/models/recent_transactions_response.rb +110 -0
  142. data/lib/shell_data_reporting_ap_is/models/role.rb +102 -0
  143. data/lib/shell_data_reporting_ap_is/models/search_doc_req.rb +269 -0
  144. data/lib/shell_data_reporting_ap_is/models/search_documents_invoice.rb +204 -0
  145. data/lib/shell_data_reporting_ap_is/models/search_documents_request.rb +70 -0
  146. data/lib/shell_data_reporting_ap_is/models/search_documents_response.rb +122 -0
  147. data/lib/shell_data_reporting_ap_is/models/search_soa_req.rb +197 -0
  148. data/lib/shell_data_reporting_ap_is/models/search_statement_of_account.rb +220 -0
  149. data/lib/shell_data_reporting_ap_is/models/search_statement_of_account_request.rb +70 -0
  150. data/lib/shell_data_reporting_ap_is/models/search_statement_of_account_response.rb +120 -0
  151. data/lib/shell_data_reporting_ap_is/models/site_location.rb +67 -0
  152. data/lib/shell_data_reporting_ap_is/models/statement_of_account_request.rb +50 -0
  153. data/lib/shell_data_reporting_ap_is/models/statement_of_account_request_filters.rb +197 -0
  154. data/lib/shell_data_reporting_ap_is/models/statement_of_account_resp.rb +138 -0
  155. data/lib/shell_data_reporting_ap_is/models/statement_of_account_response.rb +80 -0
  156. data/lib/shell_data_reporting_ap_is/models/tier.rb +167 -0
  157. data/lib/shell_data_reporting_ap_is/models/transaction_exceptions.rb +1267 -0
  158. data/lib/shell_data_reporting_ap_is/models/transaction_exceptions_request.rb +267 -0
  159. data/lib/shell_data_reporting_ap_is/models/transaction_exceptions_response.rb +100 -0
  160. data/lib/shell_data_reporting_ap_is/models/transaction_fees_request.rb +348 -0
  161. data/lib/shell_data_reporting_ap_is/models/transaction_fees_response.rb +111 -0
  162. data/lib/shell_data_reporting_ap_is/models/update_odometer.rb +62 -0
  163. data/lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb +67 -0
  164. data/lib/shell_data_reporting_ap_is/models/update_odometer_request.rb +146 -0
  165. data/lib/shell_data_reporting_ap_is/models/update_odometer_response.rb +93 -0
  166. data/lib/shell_data_reporting_ap_is/models/usage_summary.rb +202 -0
  167. data/lib/shell_data_reporting_ap_is/models/volume_based_bonus_request.rb +118 -0
  168. data/lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb +120 -0
  169. data/lib/shell_data_reporting_ap_is/models/volume_based_pricing_request.rb +103 -0
  170. data/lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb +120 -0
  171. data/lib/shell_data_reporting_ap_is/utilities/date_time_helper.rb +11 -0
  172. data/lib/shell_data_reporting_ap_is/utilities/file_wrapper.rb +16 -0
  173. data/lib/shell_data_reporting_ap_is.rb +229 -0
  174. data/test/controllers/controller_test_base.rb +34 -0
  175. data/test/controllers/test_invoice_controller.rb +398 -0
  176. data/test/controllers/test_transaction_controller.rb +235 -0
  177. data/test/http_response_catcher.rb +19 -0
  178. metadata +302 -0
@@ -0,0 +1,10 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ end
10
+ end
@@ -0,0 +1,32 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # Error response
8
+ class DefaultErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Error object
13
+ # @return [DefaultErrorFault]
14
+ attr_accessor :fault
15
+
16
+ # The constructor.
17
+ # @param [String] The reason for raising an exception.
18
+ # @param [HttpResponse] The HttpReponse of the API call.
19
+ def initialize(reason, response)
20
+ super(reason, response)
21
+ hash = APIHelper.json_deserialize(@response.raw_body)
22
+ unbox(hash)
23
+ end
24
+
25
+ # Populates this object by extracting properties from a hash.
26
+ # @param [Hash] The deserialized response sent by the server in the
27
+ # response body.
28
+ def unbox(hash)
29
+ @fault = DefaultErrorFault.from_hash(hash['fault']) if hash['fault']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,54 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # ErrorObject class.
8
+ class ErrorObjectException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique request identifier passed from end user. This identifier helps in
13
+ # tracing a transaction
14
+ # @return [String]
15
+ attr_accessor :request_id
16
+
17
+ # Indicates overall status of the request. Allowed values: SUCCES, FAILED,
18
+ # PARTIAL_SUCCESS
19
+ # @return [String]
20
+ attr_accessor :status
21
+
22
+ # Indicates overall status of the request. Allowed values: SUCCES, FAILED,
23
+ # PARTIAL_SUCCESS
24
+ # @return [Array[ErrorDetails]]
25
+ attr_accessor :errors
26
+
27
+ # The constructor.
28
+ # @param [String] The reason for raising an exception.
29
+ # @param [HttpResponse] The HttpReponse of the API call.
30
+ def initialize(reason, response)
31
+ super(reason, response)
32
+ hash = APIHelper.json_deserialize(@response.raw_body)
33
+ unbox(hash)
34
+ end
35
+
36
+ # Populates this object by extracting properties from a hash.
37
+ # @param [Hash] The deserialized response sent by the server in the
38
+ # response body.
39
+ def unbox(hash)
40
+ @request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP
41
+ @status = hash.key?('Status') ? hash['Status'] : SKIP
42
+ # Parameter is an array, so we need to iterate through it
43
+ @errors = nil
44
+ unless hash['Errors'].nil?
45
+ @errors = []
46
+ hash['Errors'].each do |structure|
47
+ @errors << (ErrorDetails.from_hash(structure) if structure)
48
+ end
49
+ end
50
+
51
+ @errors = SKIP unless hash.key?('Errors')
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,32 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # ErrorUserAccess_Error1 class.
8
+ class ErrorUserAccessError1Exception < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ErrorUserAccessError]
14
+ attr_accessor :error
15
+
16
+ # The constructor.
17
+ # @param [String] The reason for raising an exception.
18
+ # @param [HttpResponse] The HttpReponse of the API call.
19
+ def initialize(reason, response)
20
+ super(reason, response)
21
+ hash = APIHelper.json_deserialize(@response.raw_body)
22
+ unbox(hash)
23
+ end
24
+
25
+ # Populates this object by extracting properties from a hash.
26
+ # @param [Hash] The deserialized response sent by the server in the
27
+ # response body.
28
+ def unbox(hash)
29
+ @error = ErrorUserAccessError.from_hash(hash['Error']) if hash['Error']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,48 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # OAuth 2 Authorization endpoint exception.
8
+ class OAuthProviderException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Gets or sets error code.
13
+ # @return [OAuthProviderErrorEnum]
14
+ attr_accessor :error
15
+
16
+ # Gets or sets human-readable text providing additional information on
17
+ # error.
18
+ # Used to assist the client developer in understanding the error that
19
+ # occurred.
20
+ # @return [String]
21
+ attr_accessor :error_description
22
+
23
+ # Gets or sets a URI identifying a human-readable web page with information
24
+ # about the error, used to provide the client developer with additional
25
+ # information about the error.
26
+ # @return [String]
27
+ attr_accessor :error_uri
28
+
29
+ # The constructor.
30
+ # @param [String] The reason for raising an exception.
31
+ # @param [HttpResponse] The HttpReponse of the API call.
32
+ def initialize(reason, response)
33
+ super(reason, response)
34
+ hash = APIHelper.json_deserialize(@response.raw_body)
35
+ unbox(hash)
36
+ end
37
+
38
+ # Populates this object by extracting properties from a hash.
39
+ # @param [Hash] The deserialized response sent by the server in the
40
+ # response body.
41
+ def unbox(hash)
42
+ @error = hash.key?('error') ? hash['error'] : nil
43
+ @error_description =
44
+ hash.key?('error_description') ? hash['error_description'] : SKIP
45
+ @error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,50 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # Utility class for basic authorization.
8
+ class BasicAuth < CoreLibrary::HeaderAuth
9
+ include CoreLibrary
10
+ # Display error message on occurrence of authentication failure.
11
+ # @returns [String] The oAuth error message.
12
+ def error_message
13
+ 'BasicAuth: username or password is undefined.'
14
+ end
15
+
16
+ # Initialization constructor.
17
+ def initialize(basic_auth_credentials)
18
+ auth_params = {}
19
+ unless basic_auth_credentials.nil? ||
20
+ basic_auth_credentials.username.nil? ||
21
+ basic_auth_credentials.password.nil?
22
+ auth_params['Authorization'] =
23
+ "Basic #{AuthHelper.get_base64_encoded_value(basic_auth_credentials.username,
24
+ basic_auth_credentials.password)}"
25
+ end
26
+
27
+ super auth_params
28
+ end
29
+ end
30
+
31
+ # Data class for BasicAuthCredentials.
32
+ class BasicAuthCredentials
33
+ attr_reader :username, :password
34
+
35
+ def initialize(username:, password:)
36
+ raise ArgumentError, 'username cannot be nil' if username.nil?
37
+ raise ArgumentError, 'password cannot be nil' if password.nil?
38
+
39
+ @username = username
40
+ @password = password
41
+ end
42
+
43
+ def clone_with(username: nil, password: nil)
44
+ username ||= self.username
45
+ password ||= self.password
46
+
47
+ BasicAuthCredentials.new(username: username, password: password)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,89 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # Utility class for OAuth 2 authorization and token management.
8
+ class BearerToken < CoreLibrary::HeaderAuth
9
+ include CoreLibrary
10
+ # Display error message on occurrence of authentication failure.
11
+ # @returns [String] The oAuth error message.
12
+ def error_message
13
+ 'BearerToken: OAuthToken is undefined or expired.'
14
+ end
15
+
16
+ # Initialization constructor.
17
+ def initialize(bearer_token_credentials, config)
18
+ auth_params = {}
19
+ @_o_auth_client_id = bearer_token_credentials.o_auth_client_id unless
20
+ bearer_token_credentials.nil? || bearer_token_credentials.o_auth_client_id.nil?
21
+ @_o_auth_client_secret = bearer_token_credentials.o_auth_client_secret unless
22
+ bearer_token_credentials.nil? || bearer_token_credentials.o_auth_client_secret.nil?
23
+ @_o_auth_token = bearer_token_credentials.o_auth_token unless
24
+ bearer_token_credentials.nil? || bearer_token_credentials.o_auth_token.nil?
25
+ @_o_auth_api = OAuthAuthorizationController.new(config)
26
+ auth_params['Authorization'] = "Bearer #{@_o_auth_token.access_token}" unless @_o_auth_token.nil?
27
+
28
+ super auth_params
29
+ end
30
+
31
+ # Validates the oAuth token.
32
+ # @return [Boolean] true if the token is present and not expired.
33
+ def valid
34
+ !@_o_auth_token.nil? && !token_expired?(@_o_auth_token)
35
+ end
36
+
37
+ # Builds the basic auth header for endpoints in the OAuth Authorization Controller.
38
+ # @return [String] The value of the Authentication header.
39
+ def build_basic_auth_header
40
+ "Basic #{AuthHelper.get_base64_encoded_value(@_o_auth_client_id, @_o_auth_client_secret)}"
41
+ end
42
+
43
+ # Fetches the token.
44
+ # @param [Hash] additional_params Any additional form parameters.
45
+ # @return [OAuthToken] The oAuth token instance.
46
+ def fetch_token(additional_params: nil)
47
+ token = @_o_auth_api.request_token_bearer_token(
48
+ build_basic_auth_header,
49
+ _field_parameters: additional_params
50
+ )
51
+ if token.respond_to?('expires_in') && !token.expires_in.nil?
52
+ token.expiry = AuthHelper.get_token_expiry(token.expires_in, Time.now.utc.to_i)
53
+ end
54
+ token
55
+ end
56
+
57
+ # Checks if OAuth token has expired.
58
+ # @param [OAuthToken] token The oAuth token instance.
59
+ # @return [Boolean] true if the token's expiry exist and also the token is expired, false otherwise.
60
+ def token_expired?(token)
61
+ token.respond_to?('expiry') && AuthHelper.token_expired?(token.expiry)
62
+ end
63
+ end
64
+
65
+ # Data class for BearerTokenCredentials.
66
+ class BearerTokenCredentials
67
+ attr_reader :o_auth_client_id, :o_auth_client_secret, :o_auth_token
68
+
69
+ def initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_token: nil)
70
+ raise ArgumentError, 'o_auth_client_id cannot be nil' if o_auth_client_id.nil?
71
+ raise ArgumentError, 'o_auth_client_secret cannot be nil' if o_auth_client_secret.nil?
72
+
73
+ @o_auth_client_id = o_auth_client_id
74
+ @o_auth_client_secret = o_auth_client_secret
75
+ @o_auth_token = o_auth_token
76
+ end
77
+
78
+ def clone_with(o_auth_client_id: nil, o_auth_client_secret: nil,
79
+ o_auth_token: nil)
80
+ o_auth_client_id ||= self.o_auth_client_id
81
+ o_auth_client_secret ||= self.o_auth_client_secret
82
+ o_auth_token ||= self.o_auth_token
83
+
84
+ BearerTokenCredentials.new(o_auth_client_id: o_auth_client_id,
85
+ o_auth_client_secret: o_auth_client_secret,
86
+ o_auth_token: o_auth_token)
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,10 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # HttpCallBack allows defining callables for pre and post API calls.
8
+ class HttpCallBack < CoreLibrary::HttpCallback
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,128 @@
1
+ # shell_data_reporting_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellDataReportingApIs
7
+ # AccountAccess Model.
8
+ class AccountAccess < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Collecting company id.
13
+ # @return [Integer]
14
+ attr_accessor :colco_id
15
+
16
+ # Collecting company code.
17
+ # @return [Integer]
18
+ attr_accessor :colco_code
19
+
20
+ # Payer Id to which the user has access
21
+ # @return [Integer]
22
+ attr_accessor :payer_id
23
+
24
+ # Payer Number to which the user has access
25
+ # @return [String]
26
+ attr_accessor :payer_number
27
+
28
+ # Name of the Payer to which the user has access
29
+ # @return [String]
30
+ attr_accessor :payer_name
31
+
32
+ # Account Id to which the user has access
33
+ # @return [Integer]
34
+ attr_accessor :account_id
35
+
36
+ # Account Number to which the user has access
37
+ # @return [String]
38
+ attr_accessor :account_number
39
+
40
+ # Name of the Account to which the user has access
41
+ # @return [String]
42
+ attr_accessor :account_name
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['colco_id'] = 'ColcoId'
48
+ @_hash['colco_code'] = 'ColcoCode'
49
+ @_hash['payer_id'] = 'PayerId'
50
+ @_hash['payer_number'] = 'PayerNumber'
51
+ @_hash['payer_name'] = 'PayerName'
52
+ @_hash['account_id'] = 'AccountId'
53
+ @_hash['account_number'] = 'AccountNumber'
54
+ @_hash['account_name'] = 'AccountName'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def self.optionals
60
+ %w[
61
+ colco_id
62
+ colco_code
63
+ payer_id
64
+ payer_number
65
+ payer_name
66
+ account_id
67
+ account_number
68
+ account_name
69
+ ]
70
+ end
71
+
72
+ # An array for nullable fields
73
+ def self.nullables
74
+ %w[
75
+ colco_id
76
+ colco_code
77
+ payer_id
78
+ payer_number
79
+ payer_name
80
+ account_id
81
+ account_name
82
+ ]
83
+ end
84
+
85
+ def initialize(colco_id = SKIP,
86
+ colco_code = SKIP,
87
+ payer_id = SKIP,
88
+ payer_number = SKIP,
89
+ payer_name = SKIP,
90
+ account_id = SKIP,
91
+ account_number = SKIP,
92
+ account_name = SKIP)
93
+ @colco_id = colco_id unless colco_id == SKIP
94
+ @colco_code = colco_code unless colco_code == SKIP
95
+ @payer_id = payer_id unless payer_id == SKIP
96
+ @payer_number = payer_number unless payer_number == SKIP
97
+ @payer_name = payer_name unless payer_name == SKIP
98
+ @account_id = account_id unless account_id == SKIP
99
+ @account_number = account_number unless account_number == SKIP
100
+ @account_name = account_name unless account_name == SKIP
101
+ end
102
+
103
+ # Creates an instance of the object from a hash.
104
+ def self.from_hash(hash)
105
+ return nil unless hash
106
+
107
+ # Extract variables from the hash.
108
+ colco_id = hash.key?('ColcoId') ? hash['ColcoId'] : SKIP
109
+ colco_code = hash.key?('ColcoCode') ? hash['ColcoCode'] : SKIP
110
+ payer_id = hash.key?('PayerId') ? hash['PayerId'] : SKIP
111
+ payer_number = hash.key?('PayerNumber') ? hash['PayerNumber'] : SKIP
112
+ payer_name = hash.key?('PayerName') ? hash['PayerName'] : SKIP
113
+ account_id = hash.key?('AccountId') ? hash['AccountId'] : SKIP
114
+ account_number = hash.key?('AccountNumber') ? hash['AccountNumber'] : SKIP
115
+ account_name = hash.key?('AccountName') ? hash['AccountName'] : SKIP
116
+
117
+ # Create object from extracted values.
118
+ AccountAccess.new(colco_id,
119
+ colco_code,
120
+ payer_id,
121
+ payer_number,
122
+ payer_name,
123
+ account_id,
124
+ account_number,
125
+ account_name)
126
+ end
127
+ end
128
+ end