mx-platform-ruby 0.22.0 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -25
- data/lib/mx-platform-ruby/api/mx_platform_api.rb +1 -1
- data/lib/mx-platform-ruby/api_client.rb +90 -55
- data/lib/mx-platform-ruby/api_error.rb +2 -1
- data/lib/mx-platform-ruby/configuration.rb +102 -26
- data/lib/mx-platform-ruby/models/account_create_request.rb +18 -18
- data/lib/mx-platform-ruby/models/account_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/account_number_response.rb +14 -18
- data/lib/mx-platform-ruby/models/account_numbers_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/account_owner_response.rb +14 -18
- data/lib/mx-platform-ruby/models/account_owners_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/account_response.rb +14 -18
- data/lib/mx-platform-ruby/models/account_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/account_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/account_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/accounts_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/authorization_code_request.rb +14 -18
- data/lib/mx-platform-ruby/models/authorization_code_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/authorization_code_response.rb +14 -18
- data/lib/mx-platform-ruby/models/authorization_code_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/categories_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/category_create_request.rb +16 -18
- data/lib/mx-platform-ruby/models/category_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/category_response.rb +14 -18
- data/lib/mx-platform-ruby/models/category_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/category_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/category_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/challenge_response.rb +14 -18
- data/lib/mx-platform-ruby/models/challenges_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/connect_widget_request.rb +14 -18
- data/lib/mx-platform-ruby/models/connect_widget_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/connect_widget_response.rb +14 -18
- data/lib/mx-platform-ruby/models/connect_widget_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/credential_request.rb +14 -18
- data/lib/mx-platform-ruby/models/credential_response.rb +14 -18
- data/lib/mx-platform-ruby/models/credentials_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/enhance_transaction_response.rb +14 -18
- data/lib/mx-platform-ruby/models/enhance_transactions_request.rb +18 -18
- data/lib/mx-platform-ruby/models/enhance_transactions_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/enhance_transactions_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/holding_response.rb +14 -18
- data/lib/mx-platform-ruby/models/holding_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/holdings_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/image_option_response.rb +14 -18
- data/lib/mx-platform-ruby/models/institution_response.rb +14 -18
- data/lib/mx-platform-ruby/models/institution_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/institutions_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_account_create_request.rb +20 -18
- data/lib/mx-platform-ruby/models/managed_account_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_account_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_account_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_member_create_request.rb +16 -18
- data/lib/mx-platform-ruby/models/managed_member_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_member_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_member_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_transaction_create_request.rb +24 -18
- data/lib/mx-platform-ruby/models/managed_transaction_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_transaction_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/managed_transaction_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/member_create_request.rb +18 -18
- data/lib/mx-platform-ruby/models/member_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/member_response.rb +14 -18
- data/lib/mx-platform-ruby/models/member_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/member_resume_request.rb +14 -18
- data/lib/mx-platform-ruby/models/member_resume_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/member_status_response.rb +14 -18
- data/lib/mx-platform-ruby/models/member_status_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/member_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/member_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/members_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/merchant_location_response.rb +14 -18
- data/lib/mx-platform-ruby/models/merchant_location_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/merchant_response.rb +14 -18
- data/lib/mx-platform-ruby/models/merchant_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/merchants_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/o_auth_window_response.rb +14 -18
- data/lib/mx-platform-ruby/models/o_auth_window_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/option_response.rb +14 -18
- data/lib/mx-platform-ruby/models/pagination_response.rb +14 -18
- data/lib/mx-platform-ruby/models/payment_processor_authorization_code_request.rb +14 -18
- data/lib/mx-platform-ruby/models/payment_processor_authorization_code_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/payment_processor_authorization_code_response.rb +14 -18
- data/lib/mx-platform-ruby/models/payment_processor_authorization_code_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_account_response.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_accounts_response.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_iteration_item_create_request_body.rb +16 -18
- data/lib/mx-platform-ruby/models/spending_plan_iteration_item_response.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_iteration_items_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_iteration_response.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_iterations_response.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plan_response.rb +14 -18
- data/lib/mx-platform-ruby/models/spending_plans_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/statement_response.rb +14 -18
- data/lib/mx-platform-ruby/models/statement_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/statements_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tag_create_request.rb +16 -18
- data/lib/mx-platform-ruby/models/tag_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tag_response.rb +14 -18
- data/lib/mx-platform-ruby/models/tag_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tag_update_request.rb +16 -18
- data/lib/mx-platform-ruby/models/tag_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tagging_create_request.rb +18 -18
- data/lib/mx-platform-ruby/models/tagging_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tagging_response.rb +14 -18
- data/lib/mx-platform-ruby/models/tagging_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tagging_update_request.rb +16 -18
- data/lib/mx-platform-ruby/models/tagging_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/taggings_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tags_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tax_document_response.rb +14 -18
- data/lib/mx-platform-ruby/models/tax_document_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/tax_documents_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_response.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_rule_create_request.rb +18 -18
- data/lib/mx-platform-ruby/models/transaction_rule_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_rule_response.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_rule_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_rule_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_rule_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_rules_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transaction_update_request.rb +16 -18
- data/lib/mx-platform-ruby/models/transaction_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/transactions_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/user_create_request.rb +14 -18
- data/lib/mx-platform-ruby/models/user_create_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/user_response.rb +14 -18
- data/lib/mx-platform-ruby/models/user_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/user_update_request.rb +14 -18
- data/lib/mx-platform-ruby/models/user_update_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/users_response_body.rb +14 -18
- data/lib/mx-platform-ruby/models/widget_request.rb +16 -18
- data/lib/mx-platform-ruby/models/widget_request_body.rb +14 -18
- data/lib/mx-platform-ruby/models/widget_response.rb +14 -18
- data/lib/mx-platform-ruby/models/widget_response_body.rb +14 -18
- data/lib/mx-platform-ruby/version.rb +2 -2
- data/lib/mx-platform-ruby.rb +1 -1
- data/mx-platform-ruby.gemspec +3 -2
- data/openapi/config.yml +1 -1
- data/openapitools.json +1 -1
- data/spec/api/mx_platform_api_spec.rb +114 -114
- data/spec/api_client_spec.rb +36 -1
- data/spec/configuration_spec.rb +41 -1
- data/spec/models/account_create_request_body_spec.rb +2 -2
- data/spec/models/account_create_request_spec.rb +22 -22
- data/spec/models/account_number_response_spec.rb +10 -10
- data/spec/models/account_numbers_response_body_spec.rb +3 -3
- data/spec/models/account_owner_response_spec.rb +15 -15
- data/spec/models/account_owners_response_body_spec.rb +3 -3
- data/spec/models/account_response_body_spec.rb +2 -2
- data/spec/models/account_response_spec.rb +57 -57
- data/spec/models/account_update_request_body_spec.rb +2 -2
- data/spec/models/account_update_request_spec.rb +22 -22
- data/spec/models/accounts_response_body_spec.rb +3 -3
- data/spec/models/authorization_code_request_body_spec.rb +2 -2
- data/spec/models/authorization_code_request_spec.rb +2 -2
- data/spec/models/authorization_code_response_body_spec.rb +2 -2
- data/spec/models/authorization_code_response_spec.rb +2 -2
- data/spec/models/categories_response_body_spec.rb +3 -3
- data/spec/models/category_create_request_body_spec.rb +2 -2
- data/spec/models/category_create_request_spec.rb +4 -4
- data/spec/models/category_response_body_spec.rb +2 -2
- data/spec/models/category_response_spec.rb +9 -9
- data/spec/models/category_update_request_body_spec.rb +2 -2
- data/spec/models/category_update_request_spec.rb +3 -3
- data/spec/models/challenge_response_spec.rb +8 -8
- data/spec/models/challenges_response_body_spec.rb +3 -3
- data/spec/models/connect_widget_request_body_spec.rb +2 -2
- data/spec/models/connect_widget_request_spec.rb +15 -15
- data/spec/models/connect_widget_response_body_spec.rb +2 -2
- data/spec/models/connect_widget_response_spec.rb +3 -3
- data/spec/models/credential_request_spec.rb +3 -3
- data/spec/models/credential_response_spec.rb +7 -7
- data/spec/models/credentials_response_body_spec.rb +3 -3
- data/spec/models/enhance_transaction_response_spec.rb +24 -24
- data/spec/models/enhance_transactions_request_body_spec.rb +2 -2
- data/spec/models/enhance_transactions_request_spec.rb +8 -8
- data/spec/models/enhance_transactions_response_body_spec.rb +2 -2
- data/spec/models/holding_response_body_spec.rb +2 -2
- data/spec/models/holding_response_spec.rb +20 -20
- data/spec/models/holdings_response_body_spec.rb +3 -3
- data/spec/models/image_option_response_spec.rb +4 -4
- data/spec/models/institution_response_body_spec.rb +2 -2
- data/spec/models/institution_response_spec.rb +15 -15
- data/spec/models/institutions_response_body_spec.rb +3 -3
- data/spec/models/managed_account_create_request_body_spec.rb +2 -2
- data/spec/models/managed_account_create_request_spec.rb +32 -32
- data/spec/models/managed_account_update_request_body_spec.rb +2 -2
- data/spec/models/managed_account_update_request_spec.rb +32 -32
- data/spec/models/managed_member_create_request_body_spec.rb +2 -2
- data/spec/models/managed_member_create_request_spec.rb +5 -5
- data/spec/models/managed_member_update_request_body_spec.rb +2 -2
- data/spec/models/managed_member_update_request_spec.rb +4 -4
- data/spec/models/managed_transaction_create_request_body_spec.rb +2 -2
- data/spec/models/managed_transaction_create_request_spec.rb +21 -21
- data/spec/models/managed_transaction_update_request_body_spec.rb +2 -2
- data/spec/models/managed_transaction_update_request_spec.rb +21 -21
- data/spec/models/member_create_request_body_spec.rb +6 -6
- data/spec/models/member_create_request_spec.rb +8 -8
- data/spec/models/member_response_body_spec.rb +2 -2
- data/spec/models/member_response_spec.rb +16 -16
- data/spec/models/member_resume_request_body_spec.rb +2 -2
- data/spec/models/member_resume_request_spec.rb +2 -2
- data/spec/models/member_status_response_body_spec.rb +2 -2
- data/spec/models/member_status_response_spec.rb +10 -10
- data/spec/models/member_update_request_body_spec.rb +2 -2
- data/spec/models/member_update_request_spec.rb +6 -6
- data/spec/models/members_response_body_spec.rb +3 -3
- data/spec/models/merchant_location_response_body_spec.rb +2 -2
- data/spec/models/merchant_location_response_spec.rb +13 -13
- data/spec/models/merchant_response_body_spec.rb +2 -2
- data/spec/models/merchant_response_spec.rb +7 -7
- data/spec/models/merchants_response_body_spec.rb +3 -3
- data/spec/models/o_auth_window_response_body_spec.rb +2 -2
- data/spec/models/o_auth_window_response_spec.rb +3 -3
- data/spec/models/option_response_spec.rb +3 -3
- data/spec/models/pagination_response_spec.rb +5 -5
- data/spec/models/payment_processor_authorization_code_request_body_spec.rb +2 -2
- data/spec/models/payment_processor_authorization_code_request_spec.rb +4 -4
- data/spec/models/payment_processor_authorization_code_response_body_spec.rb +2 -2
- data/spec/models/payment_processor_authorization_code_response_spec.rb +2 -2
- data/spec/models/spending_plan_account_response_spec.rb +8 -8
- data/spec/models/spending_plan_accounts_response_spec.rb +3 -3
- data/spec/models/spending_plan_iteration_item_create_request_body_spec.rb +6 -6
- data/spec/models/spending_plan_iteration_item_response_spec.rb +13 -13
- data/spec/models/spending_plan_iteration_items_response_body_spec.rb +3 -3
- data/spec/models/spending_plan_iteration_response_spec.rb +9 -9
- data/spec/models/spending_plan_iterations_response_spec.rb +3 -3
- data/spec/models/spending_plan_response_spec.rb +6 -6
- data/spec/models/spending_plans_response_body_spec.rb +3 -3
- data/spec/models/statement_response_body_spec.rb +2 -2
- data/spec/models/statement_response_spec.rb +9 -9
- data/spec/models/statements_response_body_spec.rb +3 -3
- data/spec/models/tag_create_request_body_spec.rb +2 -2
- data/spec/models/tag_create_request_spec.rb +2 -2
- data/spec/models/tag_response_body_spec.rb +2 -2
- data/spec/models/tag_response_spec.rb +4 -4
- data/spec/models/tag_update_request_body_spec.rb +2 -2
- data/spec/models/tag_update_request_spec.rb +2 -2
- data/spec/models/tagging_create_request_body_spec.rb +2 -2
- data/spec/models/tagging_create_request_spec.rb +3 -3
- data/spec/models/tagging_response_body_spec.rb +2 -2
- data/spec/models/tagging_response_spec.rb +6 -6
- data/spec/models/tagging_update_request_body_spec.rb +2 -2
- data/spec/models/tagging_update_request_spec.rb +2 -2
- data/spec/models/taggings_response_body_spec.rb +3 -3
- data/spec/models/tags_response_body_spec.rb +3 -3
- data/spec/models/tax_document_response_body_spec.rb +2 -2
- data/spec/models/tax_document_response_spec.rb +11 -11
- data/spec/models/tax_documents_response_body_spec.rb +3 -3
- data/spec/models/transaction_response_body_spec.rb +2 -2
- data/spec/models/transaction_response_spec.rb +44 -44
- data/spec/models/transaction_rule_create_request_body_spec.rb +2 -2
- data/spec/models/transaction_rule_create_request_spec.rb +4 -4
- data/spec/models/transaction_rule_response_body_spec.rb +2 -2
- data/spec/models/transaction_rule_response_spec.rb +8 -8
- data/spec/models/transaction_rule_update_request_body_spec.rb +2 -2
- data/spec/models/transaction_rule_update_request_spec.rb +4 -4
- data/spec/models/transaction_rules_response_body_spec.rb +3 -3
- data/spec/models/transaction_update_request_body_spec.rb +2 -2
- data/spec/models/transaction_update_request_spec.rb +2 -2
- data/spec/models/transactions_response_body_spec.rb +3 -3
- data/spec/models/user_create_request_body_spec.rb +2 -2
- data/spec/models/user_create_request_spec.rb +5 -5
- data/spec/models/user_response_body_spec.rb +2 -2
- data/spec/models/user_response_spec.rb +6 -6
- data/spec/models/user_update_request_body_spec.rb +2 -2
- data/spec/models/user_update_request_spec.rb +5 -5
- data/spec/models/users_response_body_spec.rb +3 -3
- data/spec/models/widget_request_body_spec.rb +2 -2
- data/spec/models/widget_request_spec.rb +17 -17
- data/spec/models/widget_response_body_spec.rb +2 -2
- data/spec/models/widget_response_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- metadata +132 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c325f8ea5f3b1e1e911762d38717b3e5260ccbff2cdb140cafa0e9c7000cf3cf
|
4
|
+
data.tar.gz: d9a18db73ebf0f3043a5e473599b49f2949c714044fa9adb7477d068eeb2d1f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d0326b4325ccbcb0f7bb7016263088e210efcdda35b78fbcc31f13adcf02f45fdf8161807acfa260dbf9ce91d7f2ed288794241fdf5c23784590c75de304f9d
|
7
|
+
data.tar.gz: dc472641d0ef2c829c2d528736884e79de4756d0c921d58156b0d824751fbda2dc1b64095a2ce079ed31c913810e106d89b65394089b726c1af7a88f214accb8
|
data/Gemfile.lock
CHANGED
@@ -1,44 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mx-platform-ruby (0.22.
|
5
|
-
faraday (
|
4
|
+
mx-platform-ruby (0.22.1)
|
5
|
+
faraday (>= 1.0.1, < 3.0)
|
6
|
+
faraday-multipart
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
ast (2.4.2)
|
12
|
+
base64 (0.1.1)
|
11
13
|
byebug (11.1.3)
|
12
14
|
coderay (1.1.3)
|
13
15
|
diff-lcs (1.5.0)
|
14
|
-
faraday (
|
15
|
-
|
16
|
-
faraday-
|
17
|
-
faraday-excon (~> 1.1)
|
18
|
-
faraday-httpclient (~> 1.0)
|
19
|
-
faraday-multipart (~> 1.0)
|
20
|
-
faraday-net_http (~> 1.0)
|
21
|
-
faraday-net_http_persistent (~> 1.0)
|
22
|
-
faraday-patron (~> 1.0)
|
23
|
-
faraday-rack (~> 1.0)
|
24
|
-
faraday-retry (~> 1.0)
|
16
|
+
faraday (2.7.11)
|
17
|
+
base64
|
18
|
+
faraday-net_http (>= 2.0, < 3.1)
|
25
19
|
ruby2_keywords (>= 0.0.4)
|
26
|
-
faraday-em_http (1.0.0)
|
27
|
-
faraday-em_synchrony (1.0.0)
|
28
|
-
faraday-excon (1.1.0)
|
29
|
-
faraday-httpclient (1.0.1)
|
30
20
|
faraday-multipart (1.0.4)
|
31
21
|
multipart-post (~> 2)
|
32
|
-
faraday-net_http (
|
33
|
-
faraday-net_http_persistent (1.2.0)
|
34
|
-
faraday-patron (1.0.0)
|
35
|
-
faraday-rack (1.0.0)
|
36
|
-
faraday-retry (1.0.3)
|
22
|
+
faraday-net_http (3.0.2)
|
37
23
|
jaro_winkler (1.5.6)
|
38
24
|
method_source (1.0.0)
|
39
25
|
multipart-post (2.3.0)
|
40
26
|
parallel (1.23.0)
|
41
|
-
parser (3.2.2.
|
27
|
+
parser (3.2.2.4)
|
42
28
|
ast (~> 2.4.1)
|
43
29
|
racc
|
44
30
|
pry (0.13.1)
|
@@ -47,7 +33,7 @@ GEM
|
|
47
33
|
pry-byebug (3.9.0)
|
48
34
|
byebug (~> 11.0)
|
49
35
|
pry (~> 0.13.0)
|
50
|
-
psych (5.1.
|
36
|
+
psych (5.1.1.1)
|
51
37
|
stringio
|
52
38
|
racc (1.7.1)
|
53
39
|
rainbow (3.1.1)
|
@@ -89,4 +75,4 @@ DEPENDENCIES
|
|
89
75
|
rubocop (~> 0.66.0)
|
90
76
|
|
91
77
|
BUNDLED WITH
|
92
|
-
2.4.
|
78
|
+
2.4.21
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -16,6 +16,7 @@ require 'logger'
|
|
16
16
|
require 'tempfile'
|
17
17
|
require 'time'
|
18
18
|
require 'faraday'
|
19
|
+
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
19
20
|
|
20
21
|
module MxPlatformRuby
|
21
22
|
class ApiClient
|
@@ -47,47 +48,31 @@ module MxPlatformRuby
|
|
47
48
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
48
49
|
# the data deserialized from response body (could be nil), response status code and response headers.
|
49
50
|
def call_api(http_method, path, opts = {})
|
50
|
-
ssl_options = {
|
51
|
-
:ca_file => @config.ssl_ca_file,
|
52
|
-
:verify => @config.ssl_verify,
|
53
|
-
:verify_mode => @config.ssl_verify_mode,
|
54
|
-
:client_cert => @config.ssl_client_cert,
|
55
|
-
:client_key => @config.ssl_client_key
|
56
|
-
}
|
57
|
-
|
58
|
-
connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
|
59
|
-
conn.request(:basic_auth, config.username, config.password)
|
60
|
-
@config.configure_middleware(conn)
|
61
|
-
if opts[:header_params]["Content-Type"] == "multipart/form-data"
|
62
|
-
conn.request :multipart
|
63
|
-
conn.request :url_encoded
|
64
|
-
end
|
65
|
-
conn.adapter(Faraday.default_adapter)
|
66
|
-
end
|
67
|
-
|
68
51
|
begin
|
69
|
-
response = connection.public_send(http_method.to_sym.downcase) do |req|
|
52
|
+
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
|
70
53
|
build_request(http_method, path, req, opts)
|
71
54
|
end
|
72
55
|
|
73
|
-
if
|
74
|
-
|
56
|
+
if config.debugging
|
57
|
+
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
75
58
|
end
|
76
59
|
|
77
60
|
unless response.success?
|
78
|
-
if response.status == 0
|
61
|
+
if response.status == 0 && response.respond_to?(:return_message)
|
79
62
|
# Errors from libcurl will be made visible here
|
80
|
-
fail ApiError.new(:
|
81
|
-
:
|
63
|
+
fail ApiError.new(code: 0,
|
64
|
+
message: response.return_message)
|
82
65
|
else
|
83
|
-
fail ApiError.new(:
|
84
|
-
:
|
85
|
-
:
|
66
|
+
fail ApiError.new(code: response.status,
|
67
|
+
response_headers: response.headers,
|
68
|
+
response_body: response.body),
|
86
69
|
response.reason_phrase
|
87
70
|
end
|
88
71
|
end
|
89
72
|
rescue Faraday::TimeoutError
|
90
73
|
fail ApiError.new('Connection timed out')
|
74
|
+
rescue Faraday::ConnectionFailed
|
75
|
+
fail ApiError.new('Connection failed')
|
91
76
|
end
|
92
77
|
|
93
78
|
if opts[:return_type]
|
@@ -106,7 +91,7 @@ module MxPlatformRuby
|
|
106
91
|
# @option opts [Hash] :query_params Query parameters
|
107
92
|
# @option opts [Hash] :form_params Query parameters
|
108
93
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
109
|
-
# @return [
|
94
|
+
# @return [Faraday::Request] A Faraday Request
|
110
95
|
def build_request(http_method, path, request, opts = {})
|
111
96
|
url = build_request_url(path, opts)
|
112
97
|
http_method = http_method.to_sym.downcase
|
@@ -117,24 +102,22 @@ module MxPlatformRuby
|
|
117
102
|
|
118
103
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
119
104
|
|
120
|
-
req_opts = {
|
121
|
-
:params_encoding => @config.params_encoding,
|
122
|
-
:timeout => @config.timeout,
|
123
|
-
:verbose => @config.debugging
|
124
|
-
}
|
125
|
-
|
126
105
|
if [:post, :patch, :put, :delete].include?(http_method)
|
127
106
|
req_body = build_request_body(header_params, form_params, opts[:body])
|
128
|
-
if
|
129
|
-
|
107
|
+
if config.debugging
|
108
|
+
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
130
109
|
end
|
131
110
|
end
|
132
111
|
request.headers = header_params
|
133
112
|
request.body = req_body
|
134
|
-
|
113
|
+
|
114
|
+
# Overload default options only if provided
|
115
|
+
request.options.params_encoder = config.params_encoder if config.params_encoder
|
116
|
+
request.options.timeout = config.timeout if config.timeout
|
117
|
+
|
135
118
|
request.url url
|
136
119
|
request.params = query_params
|
137
|
-
download_file(request) if opts[:return_type] == 'File'
|
120
|
+
download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
138
121
|
request
|
139
122
|
end
|
140
123
|
|
@@ -154,7 +137,7 @@ module MxPlatformRuby
|
|
154
137
|
case value
|
155
138
|
when ::File, ::Tempfile
|
156
139
|
# TODO hardcode to application/octet-stream, need better way to detect content type
|
157
|
-
data[key] = Faraday::
|
140
|
+
data[key] = Faraday::FilePart.new(value.path, 'application/octet-stream', value.path)
|
158
141
|
when ::Array, nil
|
159
142
|
# let Faraday handle Array and nil parameters
|
160
143
|
data[key] = value
|
@@ -179,6 +162,51 @@ module MxPlatformRuby
|
|
179
162
|
end
|
180
163
|
end
|
181
164
|
|
165
|
+
def connection(opts)
|
166
|
+
opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular
|
167
|
+
end
|
168
|
+
|
169
|
+
def connection_multipart
|
170
|
+
@connection_multipart ||= build_connection do |conn|
|
171
|
+
conn.request :multipart
|
172
|
+
conn.request :url_encoded
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def connection_regular
|
177
|
+
@connection_regular ||= build_connection
|
178
|
+
end
|
179
|
+
|
180
|
+
def build_connection
|
181
|
+
Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn|
|
182
|
+
basic_auth(conn)
|
183
|
+
config.configure_middleware(conn)
|
184
|
+
yield(conn) if block_given?
|
185
|
+
conn.adapter(Faraday.default_adapter)
|
186
|
+
config.configure_connection(conn)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def ssl_options
|
191
|
+
{
|
192
|
+
ca_file: config.ssl_ca_file,
|
193
|
+
verify: config.ssl_verify,
|
194
|
+
verify_mode: config.ssl_verify_mode,
|
195
|
+
client_cert: config.ssl_client_cert,
|
196
|
+
client_key: config.ssl_client_key
|
197
|
+
}
|
198
|
+
end
|
199
|
+
|
200
|
+
def basic_auth(conn)
|
201
|
+
if config.username && config.password
|
202
|
+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
203
|
+
conn.request(:authorization, :basic, config.username, config.password)
|
204
|
+
else
|
205
|
+
conn.request(:basic_auth, config.username, config.password)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
182
210
|
# Check if the given MIME is a JSON MIME.
|
183
211
|
# JSON MIME examples:
|
184
212
|
# application/json
|
@@ -201,23 +229,30 @@ module MxPlatformRuby
|
|
201
229
|
# handle file downloading - return the File instance processed in request callbacks
|
202
230
|
# note that response body is empty when the file is written in chunks in request on_body callback
|
203
231
|
if return_type == 'File'
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
232
|
+
if @config.return_binary_data == true
|
233
|
+
# return byte stream
|
234
|
+
encoding = body.encoding
|
235
|
+
return @stream.join.force_encoding(encoding)
|
208
236
|
else
|
209
|
-
|
237
|
+
# return file instead of binary data
|
238
|
+
content_disposition = response.headers['Content-Disposition']
|
239
|
+
if content_disposition && content_disposition =~ /filename=/i
|
240
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
241
|
+
prefix = sanitize_filename(filename)
|
242
|
+
else
|
243
|
+
prefix = 'download-'
|
244
|
+
end
|
245
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
246
|
+
encoding = body.encoding
|
247
|
+
@tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
248
|
+
@tempfile.write(@stream.join.force_encoding(encoding))
|
249
|
+
@tempfile.close
|
250
|
+
@config.logger.info "Temp file written to #{@tempfile.path}, please copy the file to a proper folder "\
|
251
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
252
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
253
|
+
"explicitly with `tempfile.delete`"
|
254
|
+
return @tempfile
|
210
255
|
end
|
211
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
212
|
-
encoding = body.encoding
|
213
|
-
@tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
214
|
-
@tempfile.write(@stream.join.force_encoding(encoding))
|
215
|
-
@tempfile.close
|
216
|
-
@config.logger.info "Temp file written to #{@tempfile.path}, please copy the file to a proper folder "\
|
217
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
218
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
219
|
-
"explicitly with `tempfile.delete`"
|
220
|
-
return @tempfile
|
221
256
|
end
|
222
257
|
|
223
258
|
return nil if body.nil? || body.empty?
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module MxPlatformRuby
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -62,6 +62,16 @@ module MxPlatformRuby
|
|
62
62
|
# Defines the access token (Bearer) used with OAuth2.
|
63
63
|
attr_accessor :access_token
|
64
64
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
65
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
77
|
# Default to false.
|
@@ -121,12 +131,17 @@ module MxPlatformRuby
|
|
121
131
|
# Client private key file (for client certificate)
|
122
132
|
attr_accessor :ssl_client_key
|
123
133
|
|
124
|
-
|
125
|
-
#
|
134
|
+
### Proxy setting
|
135
|
+
# HTTP Proxy settings
|
136
|
+
attr_accessor :proxy
|
137
|
+
|
138
|
+
# Set this to customize parameters encoder of array parameter.
|
139
|
+
# Default to nil. Faraday uses NestedParamsEncoder when nil.
|
126
140
|
#
|
127
|
-
# @see The
|
128
|
-
# https://github.com/
|
129
|
-
attr_accessor :
|
141
|
+
# @see The params_encoder option of Faraday. Related source code:
|
142
|
+
# https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
|
143
|
+
attr_accessor :params_encoder
|
144
|
+
|
130
145
|
|
131
146
|
attr_accessor :inject_format
|
132
147
|
|
@@ -136,7 +151,7 @@ module MxPlatformRuby
|
|
136
151
|
@scheme = 'https'
|
137
152
|
@host = 'api.mx.com'
|
138
153
|
@base_path = ''
|
139
|
-
@server_index =
|
154
|
+
@server_index = nil
|
140
155
|
@server_operation_index = {}
|
141
156
|
@server_variables = {}
|
142
157
|
@server_operation_variables = {}
|
@@ -148,10 +163,12 @@ module MxPlatformRuby
|
|
148
163
|
@ssl_ca_file = nil
|
149
164
|
@ssl_client_cert = nil
|
150
165
|
@ssl_client_key = nil
|
151
|
-
@middlewares = []
|
152
|
-
@
|
153
|
-
@response_middlewares = []
|
166
|
+
@middlewares = Hash.new { |h, k| h[k] = [] }
|
167
|
+
@configure_connection_blocks = []
|
154
168
|
@timeout = 60
|
169
|
+
# return data as binary instead of file
|
170
|
+
@return_binary_data = false
|
171
|
+
@params_encoder = nil
|
155
172
|
@debugging = false
|
156
173
|
@inject_format = false
|
157
174
|
@force_ending_format = false
|
@@ -187,10 +204,12 @@ module MxPlatformRuby
|
|
187
204
|
|
188
205
|
# Returns base URL for specified operation based on server settings
|
189
206
|
def base_url(operation = nil)
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
207
|
+
if operation_server_settings.key?(operation) then
|
208
|
+
index = server_operation_index.fetch(operation, server_index)
|
209
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
210
|
+
else
|
211
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
212
|
+
end
|
194
213
|
end
|
195
214
|
|
196
215
|
# Gets API key (with prefix if set).
|
@@ -205,6 +224,12 @@ module MxPlatformRuby
|
|
205
224
|
end
|
206
225
|
end
|
207
226
|
|
227
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
228
|
+
def access_token_with_refresh
|
229
|
+
return access_token if access_token_getter.nil?
|
230
|
+
access_token_getter.call
|
231
|
+
end
|
232
|
+
|
208
233
|
# Gets Basic Auth token string
|
209
234
|
def basic_auth_token
|
210
235
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -250,8 +275,8 @@ module MxPlatformRuby
|
|
250
275
|
servers = server_settings if servers == nil
|
251
276
|
|
252
277
|
# check array index out of bound
|
253
|
-
if (index < 0 || index >= servers.size)
|
254
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
278
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
279
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
255
280
|
end
|
256
281
|
|
257
282
|
server = servers[index]
|
@@ -276,33 +301,84 @@ module MxPlatformRuby
|
|
276
301
|
url
|
277
302
|
end
|
278
303
|
|
304
|
+
# Configure Faraday connection directly.
|
305
|
+
#
|
306
|
+
# ```
|
307
|
+
# c.configure_faraday_connection do |conn|
|
308
|
+
# conn.use Faraday::HttpCache, shared_cache: false, logger: logger
|
309
|
+
# conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
|
310
|
+
# logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
|
311
|
+
# end
|
312
|
+
# end
|
313
|
+
#
|
314
|
+
# c.configure_faraday_connection do |conn|
|
315
|
+
# conn.adapter :typhoeus
|
316
|
+
# end
|
317
|
+
# ```
|
318
|
+
#
|
319
|
+
# @param block [Proc] `#call`able object that takes one arg, the connection
|
320
|
+
def configure_faraday_connection(&block)
|
321
|
+
@configure_connection_blocks << block
|
322
|
+
end
|
323
|
+
|
324
|
+
def configure_connection(conn)
|
325
|
+
@configure_connection_blocks.each do |block|
|
326
|
+
block.call(conn)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
279
330
|
# Adds middleware to the stack
|
280
331
|
def use(*middleware)
|
281
|
-
|
332
|
+
set_faraday_middleware(:use, *middleware)
|
282
333
|
end
|
283
334
|
|
284
335
|
# Adds request middleware to the stack
|
285
336
|
def request(*middleware)
|
286
|
-
|
337
|
+
set_faraday_middleware(:request, *middleware)
|
287
338
|
end
|
288
339
|
|
289
340
|
# Adds response middleware to the stack
|
290
341
|
def response(*middleware)
|
291
|
-
|
342
|
+
set_faraday_middleware(:response, *middleware)
|
343
|
+
end
|
344
|
+
|
345
|
+
# Adds Faraday middleware setting information to the stack
|
346
|
+
#
|
347
|
+
# @example Use the `set_faraday_middleware` method to set middleware information
|
348
|
+
# config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
|
349
|
+
# config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
|
350
|
+
# config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
|
351
|
+
# config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
|
352
|
+
# config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
|
353
|
+
# config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
|
354
|
+
#
|
355
|
+
# @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
|
356
|
+
def set_faraday_middleware(operation, key, *args, &block)
|
357
|
+
unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
|
358
|
+
fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
|
359
|
+
" :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
|
360
|
+
end
|
361
|
+
|
362
|
+
@middlewares[operation] << [key, args, block]
|
292
363
|
end
|
364
|
+
ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
|
293
365
|
|
294
366
|
# Set up middleware on the connection
|
295
367
|
def configure_middleware(connection)
|
296
|
-
@middlewares.
|
297
|
-
connection.use(*middleware)
|
298
|
-
end
|
368
|
+
return if @middlewares.empty?
|
299
369
|
|
300
|
-
|
301
|
-
|
370
|
+
[:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
|
371
|
+
next unless @middlewares.key?(operation)
|
372
|
+
|
373
|
+
@middlewares[operation].each do |key, args, block|
|
374
|
+
connection.builder.send(operation, key, *args, &block)
|
375
|
+
end
|
302
376
|
end
|
303
377
|
|
304
|
-
@
|
305
|
-
|
378
|
+
if @middlewares.key?(:delete)
|
379
|
+
@middlewares[:delete].each do |key, _args, _block|
|
380
|
+
connection.builder.delete(key)
|
381
|
+
end
|
306
382
|
end
|
307
383
|
end
|
308
384
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -143,6 +143,8 @@ module MxPlatformRuby
|
|
143
143
|
|
144
144
|
if attributes.key?(:'account_type')
|
145
145
|
self.account_type = attributes[:'account_type']
|
146
|
+
else
|
147
|
+
self.account_type = nil
|
146
148
|
end
|
147
149
|
|
148
150
|
if attributes.key?(:'apr')
|
@@ -203,6 +205,8 @@ module MxPlatformRuby
|
|
203
205
|
|
204
206
|
if attributes.key?(:'name')
|
205
207
|
self.name = attributes[:'name']
|
208
|
+
else
|
209
|
+
self.name = nil
|
206
210
|
end
|
207
211
|
|
208
212
|
if attributes.key?(:'nickname')
|
@@ -225,6 +229,7 @@ module MxPlatformRuby
|
|
225
229
|
# Show invalid properties with the reasons. Usually used together with valid?
|
226
230
|
# @return Array for valid properties with the reasons
|
227
231
|
def list_invalid_properties
|
232
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
228
233
|
invalid_properties = Array.new
|
229
234
|
if @account_type.nil?
|
230
235
|
invalid_properties.push('invalid value for "account_type", account_type cannot be nil.')
|
@@ -240,6 +245,7 @@ module MxPlatformRuby
|
|
240
245
|
# Check to see if the all the properties in the model are valid
|
241
246
|
# @return true if the model is valid
|
242
247
|
def valid?
|
248
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
243
249
|
return false if @account_type.nil?
|
244
250
|
return false if @name.nil?
|
245
251
|
true
|
@@ -289,36 +295,30 @@ module MxPlatformRuby
|
|
289
295
|
# @param [Hash] attributes Model attributes in the form of hash
|
290
296
|
# @return [Object] Returns the model itself
|
291
297
|
def self.build_from_hash(attributes)
|
292
|
-
new.build_from_hash(attributes)
|
293
|
-
end
|
294
|
-
|
295
|
-
# Builds the object from hash
|
296
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
297
|
-
# @return [Object] Returns the model itself
|
298
|
-
def build_from_hash(attributes)
|
299
298
|
return nil unless attributes.is_a?(Hash)
|
300
|
-
|
301
|
-
|
302
|
-
|
299
|
+
attributes = attributes.transform_keys(&:to_sym)
|
300
|
+
transformed_hash = {}
|
301
|
+
openapi_types.each_pair do |key, type|
|
302
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
303
|
+
transformed_hash["#{key}"] = nil
|
303
304
|
elsif type =~ /\AArray<(.*)>/i
|
304
305
|
# check to ensure the input is an array given that the attribute
|
305
306
|
# is documented as an array but the input is not
|
306
|
-
if attributes[
|
307
|
-
|
307
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
308
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
308
309
|
end
|
309
|
-
elsif !attributes[
|
310
|
-
|
310
|
+
elsif !attributes[attribute_map[key]].nil?
|
311
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
311
312
|
end
|
312
313
|
end
|
313
|
-
|
314
|
-
self
|
314
|
+
new(transformed_hash)
|
315
315
|
end
|
316
316
|
|
317
317
|
# Deserializes the data based on type
|
318
318
|
# @param string type Data type
|
319
319
|
# @param string value Value to be deserialized
|
320
320
|
# @return [Object] Deserialized data
|
321
|
-
def _deserialize(type, value)
|
321
|
+
def self._deserialize(type, value)
|
322
322
|
case type.to_sym
|
323
323
|
when :Time
|
324
324
|
Time.parse(value)
|