cybersource_rest_client 0.0.53 → 0.0.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/authentication/http/GetSignatureParameter.rb +2 -2
  3. data/lib/AuthenticationSDK/authentication/http/HttpSignatureHeader.rb +6 -6
  4. data/lib/AuthenticationSDK/core/MerchantConfig.rb +6 -0
  5. data/lib/AuthenticationSDK/util/Cache.rb +15 -1
  6. data/lib/AuthenticationSDK/util/Constants.rb +1 -1
  7. data/lib/AuthenticationSDK/util/JWEUtility.rb +14 -0
  8. data/lib/cybersource_rest_client/api/batches_api.rb +12 -12
  9. data/lib/cybersource_rest_client/api/billing_agreements_api.rb +231 -0
  10. data/lib/cybersource_rest_client/api/decision_manager_api.rb +142 -0
  11. data/lib/cybersource_rest_client/api/invoice_settings_api.rb +2 -2
  12. data/lib/cybersource_rest_client/api/invoices_api.rb +6 -6
  13. data/lib/cybersource_rest_client/api/keymanagement_api.rb +3 -3
  14. data/lib/cybersource_rest_client/api/payments_api.rb +2 -2
  15. data/lib/cybersource_rest_client/api/plans_api.rb +32 -32
  16. data/lib/cybersource_rest_client/api/subscriptions_api.rb +32 -32
  17. data/lib/cybersource_rest_client/api/void_api.rb +2 -2
  18. data/lib/cybersource_rest_client/models/access_token_response.rb +244 -244
  19. data/lib/cybersource_rest_client/models/activate_deactivate_plan_response.rb +239 -0
  20. data/lib/cybersource_rest_client/models/{inline_response_200_9.rb → activate_subscription_response.rb} +2 -2
  21. data/lib/cybersource_rest_client/models/{inline_response_200_9_subscription_information.rb → activate_subscription_response_subscription_information.rb} +1 -1
  22. data/lib/cybersource_rest_client/models/bad_request_error.rb +192 -192
  23. data/lib/cybersource_rest_client/models/{inline_response_202_1.rb → cancel_subscription_response.rb} +2 -2
  24. data/lib/cybersource_rest_client/models/{inline_response_202_subscription_information.rb → cancel_subscription_response_subscription_information.rb} +1 -1
  25. data/lib/cybersource_rest_client/models/case_management_actions_request.rb +200 -0
  26. data/lib/cybersource_rest_client/models/case_management_comments_request.rb +206 -0
  27. data/lib/cybersource_rest_client/models/create_access_token_request.rb +254 -254
  28. data/lib/cybersource_rest_client/models/{inline_response_200_14.rb → create_billing_agreement.rb} +65 -88
  29. data/lib/cybersource_rest_client/models/create_bundled_decision_manager_case_request.rb +15 -5
  30. data/lib/cybersource_rest_client/models/create_plan_response.rb +239 -0
  31. data/lib/cybersource_rest_client/models/{inline_response_201_plan_information.rb → create_plan_response_plan_information.rb} +1 -1
  32. data/lib/cybersource_rest_client/models/create_subscription_request.rb +1 -1
  33. data/lib/cybersource_rest_client/models/{inline_response_201_1.rb → create_subscription_response.rb} +3 -3
  34. data/lib/cybersource_rest_client/models/{inline_response_201_1__links.rb → create_subscription_response__links.rb} +1 -1
  35. data/lib/cybersource_rest_client/models/{inline_response_201_1_subscription_information.rb → create_subscription_response_subscription_information.rb} +1 -1
  36. data/lib/cybersource_rest_client/models/delete_plan_response.rb +202 -0
  37. data/lib/cybersource_rest_client/models/{inline_response_202_2.rb → get_all_plans_response.rb} +31 -18
  38. data/lib/cybersource_rest_client/models/{inline_response_200__links.rb → get_all_plans_response__links.rb} +1 -1
  39. data/lib/cybersource_rest_client/models/{inline_response_200_order_information.rb → get_all_plans_response_order_information.rb} +2 -2
  40. data/lib/cybersource_rest_client/models/{inline_response_200_order_information_amount_details.rb → get_all_plans_response_order_information_amount_details.rb} +1 -1
  41. data/lib/cybersource_rest_client/models/{inline_response_200_plan_information.rb → get_all_plans_response_plan_information.rb} +3 -3
  42. data/lib/cybersource_rest_client/models/{inline_response_200_plan_information_billing_cycles.rb → get_all_plans_response_plan_information_billing_cycles.rb} +1 -1
  43. data/lib/cybersource_rest_client/models/{inline_response_200_plan_information_billing_period.rb → get_all_plans_response_plan_information_billing_period.rb} +1 -1
  44. data/lib/cybersource_rest_client/models/{inline_response_200_plans.rb → get_all_plans_response_plans.rb} +3 -3
  45. data/lib/cybersource_rest_client/models/{inline_response_200_6.rb → get_all_subscriptions_response.rb} +3 -3
  46. data/lib/cybersource_rest_client/models/{inline_response_200_6__links.rb → get_all_subscriptions_response__links.rb} +1 -1
  47. data/lib/cybersource_rest_client/models/get_all_subscriptions_response_order_information.rb +200 -0
  48. data/lib/cybersource_rest_client/models/{inline_response_200_6_order_information_bill_to.rb → get_all_subscriptions_response_order_information_bill_to.rb} +1 -1
  49. data/lib/cybersource_rest_client/models/{inline_response_200_6_payment_information.rb → get_all_subscriptions_response_payment_information.rb} +2 -2
  50. data/lib/cybersource_rest_client/models/{inline_response_200_6_payment_information_customer.rb → get_all_subscriptions_response_payment_information_customer.rb} +1 -1
  51. data/lib/cybersource_rest_client/models/{inline_response_200_6_plan_information.rb → get_all_subscriptions_response_plan_information.rb} +3 -3
  52. data/lib/cybersource_rest_client/models/{inline_response_200_6_plan_information_billing_cycles.rb → get_all_subscriptions_response_plan_information_billing_cycles.rb} +1 -1
  53. data/lib/cybersource_rest_client/models/{inline_response_200_6_subscription_information.rb → get_all_subscriptions_response_subscription_information.rb} +1 -1
  54. data/lib/cybersource_rest_client/models/{inline_response_200_6_subscriptions.rb → get_all_subscriptions_response_subscriptions.rb} +6 -6
  55. data/lib/cybersource_rest_client/models/{inline_response_200_5.rb → get_plan_code_response.rb} +1 -1
  56. data/lib/cybersource_rest_client/models/get_plan_response.rb +238 -0
  57. data/lib/cybersource_rest_client/models/{inline_response_200_10.rb → get_subscription_code_response.rb} +1 -1
  58. data/lib/cybersource_rest_client/models/{inline_response_200_7.rb → get_subscription_response.rb} +6 -6
  59. data/lib/cybersource_rest_client/models/inline_response_200.rb +30 -25
  60. data/lib/cybersource_rest_client/models/inline_response_200_1.rb +50 -40
  61. data/lib/cybersource_rest_client/models/{inline_response_200_11_keys.rb → inline_response_200_1_keys.rb} +1 -1
  62. data/lib/cybersource_rest_client/models/inline_response_200_2.rb +67 -17
  63. data/lib/cybersource_rest_client/models/{inline_response_200_12__embedded.rb → inline_response_200_2__embedded.rb} +2 -2
  64. data/lib/cybersource_rest_client/models/{inline_response_200_12__embedded__links.rb → inline_response_200_2__embedded__links.rb} +2 -2
  65. data/lib/cybersource_rest_client/models/{inline_response_200_12__embedded__links_reports.rb → inline_response_200_2__embedded__links_reports.rb} +1 -1
  66. data/lib/cybersource_rest_client/models/{inline_response_200_12__embedded_batches.rb → inline_response_200_2__embedded_batches.rb} +3 -3
  67. data/lib/cybersource_rest_client/models/{inline_response_200_12__embedded_totals.rb → inline_response_200_2__embedded_totals.rb} +1 -1
  68. data/lib/cybersource_rest_client/models/{inline_response_200_12__links.rb → inline_response_200_2__links.rb} +1 -1
  69. data/lib/cybersource_rest_client/models/inline_response_200_3.rb +81 -29
  70. data/lib/cybersource_rest_client/models/{inline_response_200_13__links.rb → inline_response_200_3__links.rb} +3 -3
  71. data/lib/cybersource_rest_client/models/{inline_response_202_2__links_status.rb → inline_response_200_3__links_report.rb} +1 -1
  72. data/lib/cybersource_rest_client/models/{inline_response_200_13_billing.rb → inline_response_200_3_billing.rb} +1 -1
  73. data/lib/cybersource_rest_client/models/inline_response_200_4.rb +96 -42
  74. data/lib/cybersource_rest_client/models/{inline_response_200_14_records.rb → inline_response_200_4_records.rb} +3 -3
  75. data/lib/cybersource_rest_client/models/{inline_response_200_14_response_record.rb → inline_response_200_4_response_record.rb} +2 -2
  76. data/lib/cybersource_rest_client/models/{inline_response_200_14_response_record_additional_updates.rb → inline_response_200_4_response_record_additional_updates.rb} +1 -1
  77. data/lib/cybersource_rest_client/models/{inline_response_200_14_source_record.rb → inline_response_200_4_source_record.rb} +1 -1
  78. data/lib/cybersource_rest_client/models/inline_response_200__embedded.rb +201 -0
  79. data/lib/cybersource_rest_client/models/inline_response_200__embedded_capture.rb +202 -0
  80. data/lib/cybersource_rest_client/models/inline_response_200__embedded_capture__links.rb +191 -0
  81. data/lib/cybersource_rest_client/models/inline_response_200__embedded_capture__links_self.rb +203 -0
  82. data/lib/cybersource_rest_client/models/inline_response_200__embedded_reversal.rb +202 -0
  83. data/lib/cybersource_rest_client/models/inline_response_200__embedded_reversal__links.rb +191 -0
  84. data/lib/cybersource_rest_client/models/inline_response_200__embedded_reversal__links_self.rb +203 -0
  85. data/lib/cybersource_rest_client/models/inline_response_201.rb +7 -27
  86. data/lib/cybersource_rest_client/models/inline_response_202.rb +17 -45
  87. data/lib/cybersource_rest_client/models/{inline_response_202_2__links.rb → inline_response_202__links.rb} +2 -2
  88. data/lib/cybersource_rest_client/models/{inline_response_200_13__links_report.rb → inline_response_202__links_status.rb} +1 -1
  89. data/lib/cybersource_rest_client/models/inline_response_400_1.rb +3 -3
  90. data/lib/cybersource_rest_client/models/inline_response_400_2.rb +1 -1
  91. data/lib/cybersource_rest_client/models/inline_response_400_3.rb +37 -60
  92. data/lib/cybersource_rest_client/models/inline_response_400_4.rb +61 -37
  93. data/lib/cybersource_rest_client/models/{inline_response_400_3_fields.rb → inline_response_400_4_fields.rb} +1 -1
  94. data/lib/cybersource_rest_client/models/inline_response_400_5.rb +10 -11
  95. data/lib/cybersource_rest_client/models/inline_response_400_6.rb +35 -75
  96. data/lib/cybersource_rest_client/models/inline_response_400_7.rb +276 -0
  97. data/lib/cybersource_rest_client/models/{inline_response_400_6_details.rb → inline_response_400_7_details.rb} +1 -1
  98. data/lib/cybersource_rest_client/models/inline_response_403_1.rb +236 -0
  99. data/lib/cybersource_rest_client/models/inline_response_422.rb +236 -0
  100. data/lib/cybersource_rest_client/models/inline_response_500_1.rb +20 -8
  101. data/lib/cybersource_rest_client/models/inline_response_500_2.rb +224 -0
  102. data/lib/cybersource_rest_client/models/inline_response_502.rb +13 -12
  103. data/lib/cybersource_rest_client/models/inline_response_502_1.rb +235 -0
  104. data/lib/cybersource_rest_client/models/inline_response_503.rb +236 -0
  105. data/lib/cybersource_rest_client/models/{inline_response_200_12.rb → intimate_billing_agreement.rb} +37 -59
  106. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response.rb +1 -1
  107. data/lib/cybersource_rest_client/models/modify_billing_agreement.rb +270 -0
  108. data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response_1.rb +239 -0
  109. data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response_1_installment_information.rb +197 -0
  110. data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response_1_processor_information.rb +214 -0
  111. data/lib/cybersource_rest_client/models/ptsv2billingagreements_aggregator_information.rb +207 -0
  112. data/lib/cybersource_rest_client/models/ptsv2billingagreements_consumer_authentication_information.rb +242 -0
  113. data/lib/cybersource_rest_client/models/ptsv2billingagreements_device_information.rb +231 -0
  114. data/lib/cybersource_rest_client/models/ptsv2billingagreements_installment_information.rb +327 -0
  115. data/lib/cybersource_rest_client/models/ptsv2billingagreements_merchant_information.rb +235 -0
  116. data/lib/cybersource_rest_client/models/ptsv2billingagreements_merchant_information_merchant_descriptor.rb +242 -0
  117. data/lib/cybersource_rest_client/models/{inline_response_200_6_order_information.rb → ptsv2billingagreements_order_information.rb} +3 -3
  118. data/lib/cybersource_rest_client/models/ptsv2billingagreements_order_information_bill_to.rb +401 -0
  119. data/lib/cybersource_rest_client/models/ptsv2billingagreements_payment_information.rb +200 -0
  120. data/lib/cybersource_rest_client/models/ptsv2billingagreements_payment_information_card.rb +259 -0
  121. data/lib/cybersource_rest_client/models/ptsv2billingagreements_payment_information_tokenized_card.rb +276 -0
  122. data/lib/cybersource_rest_client/models/ptsv2billingagreements_processing_information.rb +210 -0
  123. data/lib/cybersource_rest_client/models/ptsv2payments_order_information.rb +12 -1
  124. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +16 -5
  125. data/lib/cybersource_rest_client/models/rbsv1plans_plan_information.rb +1 -1
  126. data/lib/cybersource_rest_client/models/rbsv1plansid_plan_information.rb +1 -1
  127. data/lib/cybersource_rest_client/models/rbsv1subscriptions_plan_information.rb +1 -1
  128. data/lib/cybersource_rest_client/models/resource_not_found_error.rb +192 -192
  129. data/lib/cybersource_rest_client/models/risk_v1_decisions_post201_response_consumer_authentication_information.rb +1 -1
  130. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_token_information.rb +22 -5
  131. data/lib/cybersource_rest_client/models/riskv1decisions_order_information.rb +12 -1
  132. data/lib/cybersource_rest_client/models/riskv1decisions_processing_information.rb +1 -1
  133. data/lib/cybersource_rest_client/models/riskv1decisions_token_information.rb +197 -0
  134. data/lib/cybersource_rest_client/models/riskv1decisionsidactions_decision_information.rb +208 -0
  135. data/lib/cybersource_rest_client/models/riskv1decisionsidactions_processing_information.rb +193 -0
  136. data/lib/cybersource_rest_client/models/suspend_subscription_response.rb +239 -0
  137. data/lib/cybersource_rest_client/models/{inline_response_202_1_subscription_information.rb → suspend_subscription_response_subscription_information.rb} +1 -1
  138. data/lib/cybersource_rest_client/models/unauthorized_client_error.rb +192 -192
  139. data/lib/cybersource_rest_client/models/update_plan_request.rb +1 -1
  140. data/lib/cybersource_rest_client/models/update_plan_response.rb +239 -0
  141. data/lib/cybersource_rest_client/models/{inline_response_200_3_plan_information.rb → update_plan_response_plan_information.rb} +1 -1
  142. data/lib/cybersource_rest_client/models/{inline_response_200_8.rb → update_subscription_response.rb} +3 -3
  143. data/lib/cybersource_rest_client/models/validate_request.rb +15 -5
  144. data/lib/cybersource_rest_client/utilities/jwe_utility.rb +12 -0
  145. data/lib/cybersource_rest_client.rb +95 -54
  146. metadata +112 -57
  147. data/lib/cybersource_rest_client/models/inline_response_200_11.rb +0 -248
  148. data/lib/cybersource_rest_client/models/inline_response_200_13.rb +0 -291
@@ -1,254 +1,254 @@
1
- =begin
2
- #OAuth2 API
3
-
4
- #OAuth2 Token Service (OAuth2)
5
-
6
- OpenAPI spec version: v3
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- class CreateAccessTokenRequest
17
- # The client ID that you received when you registered your application in the CyberSource Business Center. This identifies your client application.
18
- attr_accessor :client_id
19
-
20
- # The client secret that you received when you registered your application in the CyberSource Business Center.
21
- attr_accessor :client_secret
22
-
23
- # The grant type value determines which type of flow is used to obtain the access token. The first time your application requests a token, use the value `authorization_code`. When you use this value, you must also include the `code` field in the request. For subsequent request, use `refresh_token`. When you use this value, you must also include the `refresh_token` field in the request. Valid values: - authorization_code - refresh_token
24
- attr_accessor :grant_type
25
-
26
- # This value is sent by CyberSource in the redirect URL. For security reasons, the code expires in 10 minutes. If it expires, you must repeat the redirect to request another. Conditional. This value is equired if grant_type is `authorization_code`.
27
- attr_accessor :code
28
-
29
- # Conditional. Required if grant_type is `refresh_token`.
30
- attr_accessor :refresh_token
31
-
32
- # Attribute mapping from ruby-style variable name to JSON key.
33
- def self.attribute_map
34
- {
35
- :'client_id' => :'client_id',
36
- :'client_secret' => :'client_secret',
37
- :'grant_type' => :'grant_type',
38
- :'code' => :'code',
39
- :'refresh_token' => :'refresh_token'
40
- }
41
- end
42
-
43
- # Attribute type mapping.
44
- def self.swagger_types
45
- {
46
- :'client_id' => :'String',
47
- :'client_secret' => :'String',
48
- :'grant_type' => :'String',
49
- :'code' => :'String',
50
- :'refresh_token' => :'String'
51
- }
52
- end
53
-
54
- # Initializes the object
55
- # @param [Hash] attributes Model attributes in the form of hash
56
- def initialize(attributes = {})
57
- return unless attributes.is_a?(Hash)
58
-
59
- # convert string to symbol for hash key
60
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
-
62
- if attributes.has_key?(:'client_id')
63
- self.client_id = attributes[:'client_id']
64
- end
65
-
66
- if attributes.has_key?(:'client_secret')
67
- self.client_secret = attributes[:'client_secret']
68
- end
69
-
70
- if attributes.has_key?(:'grant_type')
71
- self.grant_type = attributes[:'grant_type']
72
- end
73
-
74
- if attributes.has_key?(:'code')
75
- self.code = attributes[:'code']
76
- end
77
-
78
- if attributes.has_key?(:'refresh_token')
79
- self.refresh_token = attributes[:'refresh_token']
80
- end
81
- end
82
-
83
- # Show invalid properties with the reasons. Usually used together with valid?
84
- # @return Array for valid properties with the reasons
85
- def list_invalid_properties
86
- invalid_properties = Array.new
87
- if @client_id.nil?
88
- invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
89
- end
90
-
91
- if @client_secret.nil?
92
- invalid_properties.push('invalid value for "client_secret", client_secret cannot be nil.')
93
- end
94
-
95
- invalid_properties
96
- end
97
-
98
- # Check to see if the all the properties in the model are valid
99
- # @return true if the model is valid
100
- def valid?
101
- return false if @client_id.nil?
102
- return false if @client_secret.nil?
103
- true
104
- end
105
-
106
- # Custom attribute writer method with validation
107
- # @param [Object] client_id Value to be assigned
108
- def client_id=(client_id)
109
- if client_id.nil?
110
- fail ArgumentError, 'client_id cannot be nil'
111
- end
112
-
113
- @client_id = client_id
114
- end
115
-
116
- # Custom attribute writer method with validation
117
- # @param [Object] client_secret Value to be assigned
118
- def client_secret=(client_secret)
119
- if client_secret.nil?
120
- fail ArgumentError, 'client_secret cannot be nil'
121
- end
122
-
123
- @client_secret = client_secret
124
- end
125
-
126
- # Checks equality by comparing each attribute.
127
- # @param [Object] Object to be compared
128
- def ==(o)
129
- return true if self.equal?(o)
130
- self.class == o.class &&
131
- client_id == o.client_id &&
132
- client_secret == o.client_secret &&
133
- grant_type == o.grant_type &&
134
- code == o.code &&
135
- refresh_token == o.refresh_token
136
- end
137
-
138
- # @see the `==` method
139
- # @param [Object] Object to be compared
140
- def eql?(o)
141
- self == o
142
- end
143
-
144
- # Calculates hash code according to all attributes.
145
- # @return [Fixnum] Hash code
146
- def hash
147
- [client_id, client_secret, grant_type, code, refresh_token].hash
148
- end
149
-
150
- # Builds the object from hash
151
- # @param [Hash] attributes Model attributes in the form of hash
152
- # @return [Object] Returns the model itself
153
- def build_from_hash(attributes)
154
- return nil unless attributes.is_a?(Hash)
155
- self.class.swagger_types.each_pair do |key, type|
156
- if type =~ /\AArray<(.*)>/i
157
- # check to ensure the input is an array given that the the attribute
158
- # is documented as an array but the input is not
159
- if attributes[self.class.attribute_map[key]].is_a?(Array)
160
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
- end
162
- elsif !attributes[self.class.attribute_map[key]].nil?
163
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
- end # or else data not found in attributes(hash), not an issue as the data can be optional
165
- end
166
-
167
- self
168
- end
169
-
170
- # Deserializes the data based on type
171
- # @param string type Data type
172
- # @param string value Value to be deserialized
173
- # @return [Object] Deserialized data
174
- def _deserialize(type, value)
175
- case type.to_sym
176
- when :DateTime
177
- DateTime.parse(value)
178
- when :Date
179
- Date.parse(value)
180
- when :String
181
- value.to_s
182
- when :Integer
183
- value.to_i
184
- when :Float
185
- value.to_f
186
- when :BOOLEAN
187
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
- true
189
- else
190
- false
191
- end
192
- when :Object
193
- # generic object (usually a Hash), return directly
194
- value
195
- when /\AArray<(?<inner_type>.+)>\z/
196
- inner_type = Regexp.last_match[:inner_type]
197
- value.map { |v| _deserialize(inner_type, v) }
198
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
- k_type = Regexp.last_match[:k_type]
200
- v_type = Regexp.last_match[:v_type]
201
- {}.tap do |hash|
202
- value.each do |k, v|
203
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
- end
205
- end
206
- else # model
207
- temp_model = CyberSource.const_get(type).new
208
- temp_model.build_from_hash(value)
209
- end
210
- end
211
-
212
- # Returns the string representation of the object
213
- # @return [String] String presentation of the object
214
- def to_s
215
- to_hash.to_s
216
- end
217
-
218
- # to_body is an alias to to_hash (backward compatibility)
219
- # @return [Hash] Returns the object in the form of hash
220
- def to_body
221
- to_hash
222
- end
223
-
224
- # Returns the object in the form of hash
225
- # @return [Hash] Returns the object in the form of hash
226
- def to_hash
227
- hash = {}
228
- self.class.attribute_map.each_pair do |attr, param|
229
- value = self.send(attr)
230
- next if value.nil?
231
- hash[param] = _to_hash(value)
232
- end
233
- hash
234
- end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
253
- end
254
- end
1
+ =begin
2
+ #OAuth2 API
3
+
4
+ #OAuth2 Token Service (OAuth2)
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class CreateAccessTokenRequest
17
+ # The client ID that you received when you registered your application in the CyberSource Business Center. This identifies your client application.
18
+ attr_accessor :client_id
19
+
20
+ # The client secret that you received when you registered your application in the CyberSource Business Center.
21
+ attr_accessor :client_secret
22
+
23
+ # The grant type value determines which type of flow is used to obtain the access token. The first time your application requests a token, use the value `authorization_code`. When you use this value, you must also include the `code` field in the request. For subsequent request, use `refresh_token`. When you use this value, you must also include the `refresh_token` field in the request. Valid values: - authorization_code - refresh_token
24
+ attr_accessor :grant_type
25
+
26
+ # This value is sent by CyberSource in the redirect URL. For security reasons, the code expires in 10 minutes. If it expires, you must repeat the redirect to request another. Conditional. This value is equired if grant_type is `authorization_code`.
27
+ attr_accessor :code
28
+
29
+ # Conditional. Required if grant_type is `refresh_token`.
30
+ attr_accessor :refresh_token
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'client_id' => :'client_id',
36
+ :'client_secret' => :'client_secret',
37
+ :'grant_type' => :'grant_type',
38
+ :'code' => :'code',
39
+ :'refresh_token' => :'refresh_token'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'client_id' => :'String',
47
+ :'client_secret' => :'String',
48
+ :'grant_type' => :'String',
49
+ :'code' => :'String',
50
+ :'refresh_token' => :'String'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'client_id')
63
+ self.client_id = attributes[:'client_id']
64
+ end
65
+
66
+ if attributes.has_key?(:'client_secret')
67
+ self.client_secret = attributes[:'client_secret']
68
+ end
69
+
70
+ if attributes.has_key?(:'grant_type')
71
+ self.grant_type = attributes[:'grant_type']
72
+ end
73
+
74
+ if attributes.has_key?(:'code')
75
+ self.code = attributes[:'code']
76
+ end
77
+
78
+ if attributes.has_key?(:'refresh_token')
79
+ self.refresh_token = attributes[:'refresh_token']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if @client_id.nil?
88
+ invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
89
+ end
90
+
91
+ if @client_secret.nil?
92
+ invalid_properties.push('invalid value for "client_secret", client_secret cannot be nil.')
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ return false if @client_id.nil?
102
+ return false if @client_secret.nil?
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] client_id Value to be assigned
108
+ def client_id=(client_id)
109
+ if client_id.nil?
110
+ fail ArgumentError, 'client_id cannot be nil'
111
+ end
112
+
113
+ @client_id = client_id
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] client_secret Value to be assigned
118
+ def client_secret=(client_secret)
119
+ if client_secret.nil?
120
+ fail ArgumentError, 'client_secret cannot be nil'
121
+ end
122
+
123
+ @client_secret = client_secret
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ client_id == o.client_id &&
132
+ client_secret == o.client_secret &&
133
+ grant_type == o.grant_type &&
134
+ code == o.code &&
135
+ refresh_token == o.refresh_token
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Fixnum] Hash code
146
+ def hash
147
+ [client_id, client_secret, grant_type, code, refresh_token].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ self.class.swagger_types.each_pair do |key, type|
156
+ if type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ end
162
+ elsif !attributes[self.class.attribute_map[key]].nil?
163
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
165
+ end
166
+
167
+ self
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :DateTime
177
+ DateTime.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :BOOLEAN
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ temp_model = CyberSource.const_get(type).new
208
+ temp_model.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ next if value.nil?
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end