vrpayment-ruby-sdk 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55d05a0b7f723bdce49237edd598d53ba6e25eae9590bada09796da88802acc9
4
- data.tar.gz: 532f5da3da16ab59658579f6a846b3b745ccbddedcf39e81a8e1a4cc3f51e5bb
3
+ metadata.gz: 50d18d567525698cc3bf3f10a2b015764ae0d9002900ee4d175d26cd3d38feaf
4
+ data.tar.gz: 3d682bc5b238d51445efb255d02a78416b4b40c7d1e7b7b4288129693ee43b2f
5
5
  SHA512:
6
- metadata.gz: c15e1ddec3b664f6dcea7b35007c1844a3fc80720762ac7f395be8a68a9ac38b36ffeb58ec4c32ed0fa00603f9572c58b0d30caa017d835f4360f601cf6af76b
7
- data.tar.gz: 4d4efd8d748e384a47f0190e60ef83bfae6c0dc913871522cf2e48f21c29c43d41607fa5fb459ab4eacb794aabf943f7cbd1360be72ca2fade40281ad6a8a9c5
6
+ metadata.gz: 85fc13c58c35658179561a016ec54facca2ba6a28696371bfc2a41cca9984dede6eef297582a6c618fa3ab90131dff3affc744e488131d07ced3fe96d540acc8
7
+ data.tar.gz: ee45f45c5fa35b2f46f108f0d2ea516b8fe829fe9e7aa7c10c1d643c60a52aafa6ae74ed77d1735da45d64f97b98ae515b26b1bfad9cf45ca7f9867107a6cc8a
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vrpayment-ruby-sdk (7.0.0)
5
- concurrent-ruby (~> 1.3.5)
6
- faraday (~> 2.13.1, < 3.0)
4
+ vrpayment-ruby-sdk (8.0.0)
5
+ concurrent-ruby (~> 1.3.7)
6
+ faraday (>= 2.14.3, < 3.0)
7
7
  faraday-multipart (~> 1.1.0)
8
- jwt (~> 2.10.1)
8
+ jwt (~> 2.10.3)
9
9
  marcel (~> 1.0.4)
10
10
 
11
11
  GEM
@@ -18,17 +18,17 @@ GEM
18
18
  coderay (1.1.3)
19
19
  concurrent-ruby (1.3.8)
20
20
  date (3.6.0)
21
- faraday (2.13.4)
22
- faraday-net_http (>= 2.0, < 3.5)
21
+ faraday (2.15.1)
22
+ faraday-net_http (>= 2.0, < 3.6)
23
23
  json
24
24
  logger
25
25
  faraday-multipart (1.1.1)
26
26
  multipart-post (~> 2.0)
27
- faraday-net_http (3.4.4)
27
+ faraday-net_http (3.5.0)
28
28
  net-http (~> 0.5)
29
29
  io-console (0.9.5)
30
30
  jaro_winkler (1.5.6)
31
- json (3.1.0)
31
+ json (3.2.0)
32
32
  jwt (2.10.3)
33
33
  base64
34
34
  logger (1.7.0)
@@ -41,7 +41,7 @@ GEM
41
41
  net-protocol (0.4.0)
42
42
  timeout
43
43
  parallel (1.28.0)
44
- parser (3.3.13.0)
44
+ parser (3.3.14.0)
45
45
  ast (~> 2.4.1)
46
46
  racc
47
47
  power_assert (3.1.0)
@@ -90,17 +90,17 @@ DEPENDENCIES
90
90
  CHECKSUMS
91
91
  ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
92
92
  base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
93
- bundler (4.0.23) sha256=407ba8a1d928f412847f819aa5f8b6aef7c59fb51feb517112af8a165487287b
93
+ bundler (4.1.1) sha256=7a76aebebc2e476cbc1e11314200d7fe83c7398d6930f1d048e4d3dd2d0e93e3
94
94
  byebug (13.0.0) sha256=d2263efe751941ca520fa29744b71972d39cbc41839496706f5d9b22e92ae05d
95
95
  coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
96
96
  concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
97
97
  date (3.6.0) sha256=18ac945c4e24ebd93534f8eab8c2fd8c5604b3e977105b3798d62a1e8d27b580
98
- faraday (2.13.4) sha256=c719ff52cfd0dbaeca79dd83ed3aeea3f621032abf8bc959d1c05666157cac26
98
+ faraday (2.15.1) sha256=8708154deda739c5e86cc42b74960e23e8491fce0eba9e11639a6a34b1ac288f
99
99
  faraday-multipart (1.1.1) sha256=77a18ff40149030fd1aef55bb4fc7a67ce46419a8a3fcd010e28c2526e8d8903
100
- faraday-net_http (3.4.4) sha256=0e78af151747ed1b00f33e25973b4bc220d7f16c00c39676817c8b12331eb588
100
+ faraday-net_http (3.5.0) sha256=2e7094c34e38754ee048cc3df47376f8657005d9375f8473bce1c3b526a22e36
101
101
  io-console (0.9.5) sha256=83dd9bbf4c4680416629245b39cd4212eb5f4d9a4ea91804870c1f6b846414d5
102
102
  jaro_winkler (1.5.6) sha256=007db7805527ada1cc12f2547676181d63b0a504ec4dd7a9a2eb2424521ccd81
103
- json (3.1.0) sha256=3ce7ccf8fde58960177a3a756c31f292a4c1e1dedee884547096a5b0604e3bd8
103
+ json (3.2.0) sha256=4a4e222a9ee6ffb296ab3171b6b39d85fec83afc4e7b57eee17edf68c74aec87
104
104
  jwt (2.10.3) sha256=e4d9352fbc7309b1a7448c7dd713dfe4d8c47077af80759cdbed8f878ea0b484
105
105
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
106
106
  marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4
@@ -109,7 +109,7 @@ CHECKSUMS
109
109
  net-http (0.10.0) sha256=1a2ff6e37a05724973c43f2bf7bf105f59c36a4cd0a7e9b1c021a0a566987c27
110
110
  net-protocol (0.4.0) sha256=f9f90c8c6f64794a45160bf422177a336db12809de3beeeaa26b88fcd2e8c853
111
111
  parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970
112
- parser (3.3.13.0) sha256=e02f9b63c2fe05b0c68f692ba4df89b3cb113b663964f75d988fbebfd6c3deca
112
+ parser (3.3.14.0) sha256=62f8f76af7b919425ee2d811880e9dcb8011ab40bfd59970dfb583141697e58f
113
113
  power_assert (3.1.0) sha256=fefe98ed5d3140628138f3f9f9194d6ece01f1320e69700d3c928adca7518251
114
114
  pry (0.16.1) sha256=d92d82c86e7f2dc34beec6d2892d5cf5ea517eea22eed3ceabb38ee62a98accc
115
115
  pry-byebug (3.12.0) sha256=594e094ae8a8390a7ad4c7b36ae36e13304ed02664c67417d108dc5f7213d1b7
@@ -125,7 +125,7 @@ CHECKSUMS
125
125
  timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
126
126
  unicode-display_width (1.5.0) sha256=9890eebd24feb4cb0e0542c9b8c6beecb40cda27be8c7afe49312625b36156eb
127
127
  uri (1.1.2) sha256=89292e98eabbef6248b0a0ed5e7e398e152f83f17560023a6d94a7f492b169fb
128
- vrpayment-ruby-sdk (7.0.0)
128
+ vrpayment-ruby-sdk (8.0.0)
129
129
 
130
130
  BUNDLED WITH
131
- 4.0.23
131
+ 4.1.1
data/README.md CHANGED
@@ -2999,7 +2999,7 @@ Additional Api models documentation: [*link*](https://gateway.vr-payment.de/en-u
2999
2999
  * <strong>PaymentTerminalTransactionSummary</strong>
3000
3000
  * <strong>PaymentTerminalTransactionSummaryReference</strong>
3001
3001
  * <strong>PaymentTerminalType</strong>
3002
- * <strong>PaymentTerminalUpdate</strong>
3002
+ * <strong>PaymentTerminalUpdateRequest</strong>
3003
3003
  * <strong>Permission</strong>
3004
3004
  * <strong>PermissionListResponse</strong>
3005
3005
  * <strong>PermissionSearchResponse</strong>
@@ -3146,6 +3146,7 @@ Additional Api models documentation: [*link*](https://gateway.vr-payment.de/en-u
3146
3146
  * <strong>SubscriptionMetricUpdate</strong>
3147
3147
  * <strong>SubscriptionMetricUsageReport</strong>
3148
3148
  * <strong>SubscriptionMetricUsageReportCreate</strong>
3149
+ * <strong>SubscriptionPartialUpdateRequest</strong>
3149
3150
  * <strong>SubscriptionPending</strong>
3150
3151
  * <strong>SubscriptionPeriodBill</strong>
3151
3152
  * <strong>SubscriptionPeriodBillListResponse</strong>
@@ -3210,6 +3211,7 @@ Additional Api models documentation: [*link*](https://gateway.vr-payment.de/en-u
3210
3211
  * <strong>TokenizedCardDataCreate</strong>
3211
3212
  * <strong>TokenizedCardRequest</strong>
3212
3213
  * <strong>Transaction</strong>
3214
+ * <strong>TransactionAmounts</strong>
3213
3215
  * <strong>TransactionClientPlatformInformation</strong>
3214
3216
  * <strong>TransactionComment</strong>
3215
3217
  * <strong>TransactionCommentActive</strong>
@@ -118,7 +118,7 @@ module VrpaymentRubySdk
118
118
  http_method = http_method.to_sym.downcase
119
119
 
120
120
  default_headers = {
121
- 'x-meta-sdk-version': "7.0.0",
121
+ 'x-meta-sdk-version': "8.0.0",
122
122
  'x-meta-sdk-language': "ruby",
123
123
  'x-meta-sdk-provider': "vrpayment",
124
124
  'x-meta-sdk-language-version': RUBY_VERSION
@@ -101,6 +101,8 @@ module VrpaymentRubySdk
101
101
  # The date and time when the charge attempt failed.
102
102
  attr_accessor :failed_on
103
103
 
104
+ attr_accessor :transaction_amounts
105
+
104
106
  class EnumAttributeValidator
105
107
  attr_reader :datatype
106
108
  attr_reader :allowable_values
@@ -154,7 +156,8 @@ module VrpaymentRubySdk
154
156
  :'next_update_on' => :'nextUpdateOn',
155
157
  :'failure_reason' => :'failureReason',
156
158
  :'customers_presence' => :'customersPresence',
157
- :'failed_on' => :'failedOn'
159
+ :'failed_on' => :'failedOn',
160
+ :'transaction_amounts' => :'transactionAmounts'
158
161
  }
159
162
  end
160
163
 
@@ -199,7 +202,8 @@ module VrpaymentRubySdk
199
202
  :'next_update_on' => :'Time',
200
203
  :'failure_reason' => :'FailureReason',
201
204
  :'customers_presence' => :'CustomersPresence',
202
- :'failed_on' => :'Time'
205
+ :'failed_on' => :'Time',
206
+ :'transaction_amounts' => :'TransactionAmounts'
203
207
  }
204
208
  end
205
209
 
@@ -349,6 +353,10 @@ module VrpaymentRubySdk
349
353
  if attributes.key?(:'failed_on')
350
354
  self.failed_on = attributes[:'failed_on']
351
355
  end
356
+
357
+ if attributes.key?(:'transaction_amounts')
358
+ self.transaction_amounts = attributes[:'transaction_amounts']
359
+ end
352
360
  end
353
361
 
354
362
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -428,7 +436,8 @@ module VrpaymentRubySdk
428
436
  next_update_on == o.next_update_on &&
429
437
  failure_reason == o.failure_reason &&
430
438
  customers_presence == o.customers_presence &&
431
- failed_on == o.failed_on
439
+ failed_on == o.failed_on &&
440
+ transaction_amounts == o.transaction_amounts
432
441
  end
433
442
 
434
443
  # @see the `==` method
@@ -440,7 +449,7 @@ module VrpaymentRubySdk
440
449
  # Calculates hash code according to all attributes.
441
450
  # @return [Integer] Hash code
442
451
  def hash
443
- [language, sales_channel, created_on, initializing_token_version, token_version, succeeded_on, id, state, linked_transaction, redirection_url, charge, wallet, planned_purge_date, time_zone, space_view_id, terminal, user_failure_message, completion_behavior, version, labels, linked_space_id, timeout_on, environment, invocation, connector_configuration, next_update_on, failure_reason, customers_presence, failed_on].hash
452
+ [language, sales_channel, created_on, initializing_token_version, token_version, succeeded_on, id, state, linked_transaction, redirection_url, charge, wallet, planned_purge_date, time_zone, space_view_id, terminal, user_failure_message, completion_behavior, version, labels, linked_space_id, timeout_on, environment, invocation, connector_configuration, next_update_on, failure_reason, customers_presence, failed_on, transaction_amounts].hash
444
453
  end
445
454
 
446
455
  # Builds the object from hash
@@ -24,16 +24,20 @@ require 'date'
24
24
  require 'time'
25
25
 
26
26
  module VrpaymentRubySdk
27
- class PaymentTerminalUpdate
27
+ class PaymentTerminalUpdateRequest
28
+ # The configuration that is assigned to the terminal and determines how it works.
29
+ attr_accessor :configuration
30
+
28
31
  # The name used to identify the payment terminal.
29
32
  attr_accessor :name
30
33
 
31
- # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
34
+ # The version is used for optimistic locking and incremented whenever the payment terminal is updated.
32
35
  attr_accessor :version
33
36
 
34
37
  # Attribute mapping from ruby-style variable name to JSON key.
35
38
  def self.attribute_map
36
39
  {
40
+ :'configuration' => :'configuration',
37
41
  :'name' => :'name',
38
42
  :'version' => :'version'
39
43
  }
@@ -52,6 +56,7 @@ module VrpaymentRubySdk
52
56
  # Attribute type mapping.
53
57
  def self.openapi_types
54
58
  {
59
+ :'configuration' => :'Integer',
55
60
  :'name' => :'String',
56
61
  :'version' => :'Integer'
57
62
  }
@@ -67,26 +72,28 @@ module VrpaymentRubySdk
67
72
  # @param [Hash] attributes Model attributes in the form of hash
68
73
  def initialize(attributes = {})
69
74
  if (!attributes.is_a?(Hash))
70
- fail ArgumentError, "The input argument (attributes) must be a hash in `VrpaymentRubySdk::PaymentTerminalUpdate` initialize method"
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VrpaymentRubySdk::PaymentTerminalUpdateRequest` initialize method"
71
76
  end
72
77
 
73
78
  # check to see if the attribute exists and convert string to symbol for hash key
74
79
  acceptable_attribute_map = self.class.acceptable_attribute_map
75
80
  attributes = attributes.each_with_object({}) { |(k, v), h|
76
81
  if (!acceptable_attribute_map.key?(k.to_sym))
77
- fail ArgumentError, "`#{k}` is not a valid attribute in `VrpaymentRubySdk::PaymentTerminalUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VrpaymentRubySdk::PaymentTerminalUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
83
  end
79
84
  h[k.to_sym] = v
80
85
  }
81
86
 
87
+ if attributes.key?(:'configuration')
88
+ self.configuration = attributes[:'configuration']
89
+ end
90
+
82
91
  if attributes.key?(:'name')
83
92
  self.name = attributes[:'name']
84
93
  end
85
94
 
86
95
  if attributes.key?(:'version')
87
96
  self.version = attributes[:'version']
88
- else
89
- self.version = nil
90
97
  end
91
98
  end
92
99
 
@@ -95,14 +102,6 @@ module VrpaymentRubySdk
95
102
  def list_invalid_properties
96
103
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
104
  invalid_properties = Array.new
98
- if !@name.nil? && @name.to_s.length > 100
99
- invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
100
- end
101
-
102
- if @version.nil?
103
- invalid_properties.push('invalid value for "version", version cannot be nil.')
104
- end
105
-
106
105
  invalid_properties
107
106
  end
108
107
 
@@ -110,40 +109,15 @@ module VrpaymentRubySdk
110
109
  # @return true if the model is valid
111
110
  def valid?
112
111
  warn '[DEPRECATED] the `valid?` method is obsolete'
113
- return false if !@name.nil? && @name.to_s.length > 100
114
- return false if @version.nil?
115
112
  true
116
113
  end
117
114
 
118
- # Custom attribute writer method with validation
119
- # @param [Object] name Value to be assigned
120
- def name=(name)
121
- if name.nil?
122
- fail ArgumentError, 'name cannot be nil'
123
- end
124
-
125
- if name.to_s.length > 100
126
- fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
127
- end
128
-
129
- @name = name
130
- end
131
-
132
- # Custom attribute writer method with validation
133
- # @param [Object] version Value to be assigned
134
- def version=(version)
135
- if version.nil?
136
- fail ArgumentError, 'version cannot be nil'
137
- end
138
-
139
- @version = version
140
- end
141
-
142
115
  # Checks equality by comparing each attribute.
143
116
  # @param [Object] Object to be compared
144
117
  def ==(o)
145
118
  return true if self.equal?(o)
146
119
  self.class == o.class &&
120
+ configuration == o.configuration &&
147
121
  name == o.name &&
148
122
  version == o.version
149
123
  end
@@ -157,7 +131,7 @@ module VrpaymentRubySdk
157
131
  # Calculates hash code according to all attributes.
158
132
  # @return [Integer] Hash code
159
133
  def hash
160
- [name, version].hash
134
+ [configuration, name, version].hash
161
135
  end
162
136
 
163
137
  # Builds the object from hash
@@ -0,0 +1,250 @@
1
+ =begin
2
+ # VR Payment Ruby SDK
3
+ #
4
+ # This library allows to interact with the VR Payment payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.vr-payment.de
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module VrpaymentRubySdk
27
+ class SubscriptionPartialUpdateRequest
28
+ # A description used to identify the subscription.
29
+ attr_accessor :description
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'description' => :'description'
35
+ }
36
+ end
37
+
38
+ # Returns attribute mapping this model knows about
39
+ def self.acceptable_attribute_map
40
+ attribute_map
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ acceptable_attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'description' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VrpaymentRubySdk::SubscriptionPartialUpdateRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VrpaymentRubySdk::SubscriptionPartialUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'description')
78
+ self.description = attributes[:'description']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ if !@description.nil? && @description.to_s.length > 200
88
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 200.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ warn '[DEPRECATED] the `valid?` method is obsolete'
98
+ return false if !@description.nil? && @description.to_s.length > 200
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] description Value to be assigned
104
+ def description=(description)
105
+ if description.nil?
106
+ fail ArgumentError, 'description cannot be nil'
107
+ end
108
+
109
+ if description.to_s.length > 200
110
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 200.'
111
+ end
112
+
113
+ @description = description
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ description == o.description
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [description].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def self._deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = VrpaymentRubySdk.const_get(type)
198
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end