maytes-api-client-rb 0.1.1

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.
Files changed (163) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +47 -0
  5. data/Rakefile +10 -0
  6. data/docs/CancelCheckout409Response.md +24 -0
  7. data/docs/CancelCheckoutRequest.md +18 -0
  8. data/docs/CancelCheckoutResponse.md +18 -0
  9. data/docs/CaptureCheckout409Response.md +24 -0
  10. data/docs/CaptureCheckout422Response.md +24 -0
  11. data/docs/CaptureCheckoutRequest.md +24 -0
  12. data/docs/CaptureCheckoutResponse.md +18 -0
  13. data/docs/Checkout.md +48 -0
  14. data/docs/CheckoutCancelled.md +22 -0
  15. data/docs/CheckoutCaptured.md +28 -0
  16. data/docs/CheckoutCreated.md +24 -0
  17. data/docs/CheckoutDiscount.md +30 -0
  18. data/docs/CheckoutFee.md +32 -0
  19. data/docs/CreateCheckout401Response.md +24 -0
  20. data/docs/CreateCheckout409Response.md +24 -0
  21. data/docs/CreateCheckout422Response.md +24 -0
  22. data/docs/CreateCheckoutRequest.md +44 -0
  23. data/docs/CreateCheckoutResponse.md +18 -0
  24. data/docs/CreateRefundRequest.md +20 -0
  25. data/docs/CustomerData.md +22 -0
  26. data/docs/DefaultApi.md +633 -0
  27. data/docs/DigitalGoodsCustomData.md +18 -0
  28. data/docs/DigitalGoodsLineItem.md +38 -0
  29. data/docs/DonationLineItem.md +36 -0
  30. data/docs/ErrorResponseDto.md +24 -0
  31. data/docs/Fee.md +24 -0
  32. data/docs/FeeBreakdownLine.md +24 -0
  33. data/docs/FoodBeverageLineItem.md +36 -0
  34. data/docs/GetCheckout404Response.md +24 -0
  35. data/docs/GetCheckout422Response.md +24 -0
  36. data/docs/GetCheckoutResponse.md +18 -0
  37. data/docs/GetSettlementResponse.md +18 -0
  38. data/docs/HealthResponse.md +18 -0
  39. data/docs/LineItem.md +94 -0
  40. data/docs/ListSettlementsResponse.md +18 -0
  41. data/docs/OAuthTokenRequest.md +30 -0
  42. data/docs/OAuthTokenResponse.md +26 -0
  43. data/docs/OtherLineItem.md +36 -0
  44. data/docs/PhysicalGoodsCustomData.md +20 -0
  45. data/docs/PhysicalGoodsLineItem.md +38 -0
  46. data/docs/RefundCheckout402Response.md +24 -0
  47. data/docs/RefundCheckout409Response.md +24 -0
  48. data/docs/ServiceCustomData.md +18 -0
  49. data/docs/ServiceLineItem.md +38 -0
  50. data/docs/Settlement.md +52 -0
  51. data/docs/Tax.md +22 -0
  52. data/docs/TicketCustomData.md +40 -0
  53. data/docs/TicketLineItem.md +38 -0
  54. data/docs/TicketSeating.md +24 -0
  55. data/lib/maytes_api_client/api/default_api.rb +642 -0
  56. data/lib/maytes_api_client/api_client.rb +397 -0
  57. data/lib/maytes_api_client/api_error.rb +58 -0
  58. data/lib/maytes_api_client/api_model_base.rb +88 -0
  59. data/lib/maytes_api_client/configuration.rb +316 -0
  60. data/lib/maytes_api_client/managed_client.rb +140 -0
  61. data/lib/maytes_api_client/models/cancel_checkout409_response.rb +258 -0
  62. data/lib/maytes_api_client/models/cancel_checkout_request.rb +147 -0
  63. data/lib/maytes_api_client/models/cancel_checkout_response.rb +164 -0
  64. data/lib/maytes_api_client/models/capture_checkout409_response.rb +258 -0
  65. data/lib/maytes_api_client/models/capture_checkout422_response.rb +258 -0
  66. data/lib/maytes_api_client/models/capture_checkout_request.rb +218 -0
  67. data/lib/maytes_api_client/models/capture_checkout_response.rb +164 -0
  68. data/lib/maytes_api_client/models/checkout.rb +483 -0
  69. data/lib/maytes_api_client/models/checkout_cancelled.rb +202 -0
  70. data/lib/maytes_api_client/models/checkout_captured.rb +266 -0
  71. data/lib/maytes_api_client/models/checkout_created.rb +242 -0
  72. data/lib/maytes_api_client/models/checkout_discount.rb +329 -0
  73. data/lib/maytes_api_client/models/checkout_fee.rb +351 -0
  74. data/lib/maytes_api_client/models/create_checkout401_response.rb +258 -0
  75. data/lib/maytes_api_client/models/create_checkout409_response.rb +258 -0
  76. data/lib/maytes_api_client/models/create_checkout422_response.rb +258 -0
  77. data/lib/maytes_api_client/models/create_checkout_request.rb +444 -0
  78. data/lib/maytes_api_client/models/create_checkout_response.rb +164 -0
  79. data/lib/maytes_api_client/models/create_refund_request.rb +212 -0
  80. data/lib/maytes_api_client/models/customer_data.rb +168 -0
  81. data/lib/maytes_api_client/models/digital_goods_custom_data.rb +148 -0
  82. data/lib/maytes_api_client/models/digital_goods_line_item.rb +414 -0
  83. data/lib/maytes_api_client/models/donation_line_item.rb +405 -0
  84. data/lib/maytes_api_client/models/error_response_dto.rb +227 -0
  85. data/lib/maytes_api_client/models/fee.rb +271 -0
  86. data/lib/maytes_api_client/models/fee_breakdown_line.rb +266 -0
  87. data/lib/maytes_api_client/models/food_beverage_line_item.rb +405 -0
  88. data/lib/maytes_api_client/models/get_checkout404_response.rb +258 -0
  89. data/lib/maytes_api_client/models/get_checkout422_response.rb +258 -0
  90. data/lib/maytes_api_client/models/get_checkout_response.rb +164 -0
  91. data/lib/maytes_api_client/models/get_settlement_response.rb +164 -0
  92. data/lib/maytes_api_client/models/health_response.rb +164 -0
  93. data/lib/maytes_api_client/models/line_item.rb +65 -0
  94. data/lib/maytes_api_client/models/list_settlements_response.rb +166 -0
  95. data/lib/maytes_api_client/models/o_auth_token_request.rb +244 -0
  96. data/lib/maytes_api_client/models/o_auth_token_response.rb +251 -0
  97. data/lib/maytes_api_client/models/other_line_item.rb +405 -0
  98. data/lib/maytes_api_client/models/physical_goods_custom_data.rb +173 -0
  99. data/lib/maytes_api_client/models/physical_goods_line_item.rb +431 -0
  100. data/lib/maytes_api_client/models/refund_checkout402_response.rb +258 -0
  101. data/lib/maytes_api_client/models/refund_checkout409_response.rb +258 -0
  102. data/lib/maytes_api_client/models/service_custom_data.rb +148 -0
  103. data/lib/maytes_api_client/models/service_line_item.rb +414 -0
  104. data/lib/maytes_api_client/models/settlement.rb +526 -0
  105. data/lib/maytes_api_client/models/tax.rb +202 -0
  106. data/lib/maytes_api_client/models/ticket_custom_data.rb +333 -0
  107. data/lib/maytes_api_client/models/ticket_line_item.rb +431 -0
  108. data/lib/maytes_api_client/models/ticket_seating.rb +176 -0
  109. data/lib/maytes_api_client/version.rb +15 -0
  110. data/lib/maytes_api_client/webhook_verifier.rb +212 -0
  111. data/lib/maytes_api_client.rb +95 -0
  112. data/maytes_api_client.gemspec +39 -0
  113. data/spec/api/default_api_spec.rb +145 -0
  114. data/spec/models/cancel_checkout409_response_spec.rb +58 -0
  115. data/spec/models/cancel_checkout_request_spec.rb +36 -0
  116. data/spec/models/cancel_checkout_response_spec.rb +36 -0
  117. data/spec/models/capture_checkout409_response_spec.rb +58 -0
  118. data/spec/models/capture_checkout422_response_spec.rb +58 -0
  119. data/spec/models/capture_checkout_request_spec.rb +54 -0
  120. data/spec/models/capture_checkout_response_spec.rb +36 -0
  121. data/spec/models/checkout_cancelled_spec.rb +48 -0
  122. data/spec/models/checkout_captured_spec.rb +66 -0
  123. data/spec/models/checkout_created_spec.rb +54 -0
  124. data/spec/models/checkout_discount_spec.rb +76 -0
  125. data/spec/models/checkout_fee_spec.rb +86 -0
  126. data/spec/models/checkout_spec.rb +126 -0
  127. data/spec/models/create_checkout401_response_spec.rb +58 -0
  128. data/spec/models/create_checkout409_response_spec.rb +58 -0
  129. data/spec/models/create_checkout422_response_spec.rb +58 -0
  130. data/spec/models/create_checkout_request_spec.rb +118 -0
  131. data/spec/models/create_checkout_response_spec.rb +36 -0
  132. data/spec/models/create_refund_request_spec.rb +42 -0
  133. data/spec/models/customer_data_spec.rb +48 -0
  134. data/spec/models/digital_goods_custom_data_spec.rb +36 -0
  135. data/spec/models/digital_goods_line_item_spec.rb +100 -0
  136. data/spec/models/donation_line_item_spec.rb +94 -0
  137. data/spec/models/error_response_dto_spec.rb +54 -0
  138. data/spec/models/fee_breakdown_line_spec.rb +58 -0
  139. data/spec/models/fee_spec.rb +54 -0
  140. data/spec/models/food_beverage_line_item_spec.rb +94 -0
  141. data/spec/models/get_checkout404_response_spec.rb +58 -0
  142. data/spec/models/get_checkout422_response_spec.rb +58 -0
  143. data/spec/models/get_checkout_response_spec.rb +36 -0
  144. data/spec/models/get_settlement_response_spec.rb +36 -0
  145. data/spec/models/health_response_spec.rb +36 -0
  146. data/spec/models/line_item_spec.rb +44 -0
  147. data/spec/models/list_settlements_response_spec.rb +36 -0
  148. data/spec/models/o_auth_token_request_spec.rb +72 -0
  149. data/spec/models/o_auth_token_response_spec.rb +60 -0
  150. data/spec/models/other_line_item_spec.rb +94 -0
  151. data/spec/models/physical_goods_custom_data_spec.rb +42 -0
  152. data/spec/models/physical_goods_line_item_spec.rb +100 -0
  153. data/spec/models/refund_checkout402_response_spec.rb +58 -0
  154. data/spec/models/refund_checkout409_response_spec.rb +58 -0
  155. data/spec/models/service_custom_data_spec.rb +36 -0
  156. data/spec/models/service_line_item_spec.rb +100 -0
  157. data/spec/models/settlement_spec.rb +138 -0
  158. data/spec/models/tax_spec.rb +48 -0
  159. data/spec/models/ticket_custom_data_spec.rb +106 -0
  160. data/spec/models/ticket_line_item_spec.rb +100 -0
  161. data/spec/models/ticket_seating_spec.rb +54 -0
  162. data/spec/spec_helper.rb +111 -0
  163. metadata +295 -0
@@ -0,0 +1,173 @@
1
+ =begin
2
+ #Maytes API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MaytesApiClient
17
+ class PhysicalGoodsCustomData < ApiModelBase
18
+ attr_accessor :product_id
19
+
20
+ attr_accessor :comments
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'product_id' => :'product_id',
26
+ :'comments' => :'comments'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'product_id' => :'String',
44
+ :'comments' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MaytesApiClient::PhysicalGoodsCustomData` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MaytesApiClient::PhysicalGoodsCustomData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'product_id')
71
+ self.product_id = attributes[:'product_id']
72
+ else
73
+ self.product_id = nil
74
+ end
75
+
76
+ if attributes.key?(:'comments')
77
+ self.comments = attributes[:'comments']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ if @product_id.nil?
87
+ invalid_properties.push('invalid value for "product_id", product_id cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ return false if @product_id.nil?
98
+ true
99
+ end
100
+
101
+ # Custom attribute writer method with validation
102
+ # @param [Object] product_id Value to be assigned
103
+ def product_id=(product_id)
104
+ if product_id.nil?
105
+ fail ArgumentError, 'product_id cannot be nil'
106
+ end
107
+
108
+ @product_id = product_id
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ product_id == o.product_id &&
117
+ comments == o.comments
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [product_id, comments].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def self.build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ transformed_hash = {}
139
+ openapi_types.each_pair do |key, type|
140
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = nil
142
+ elsif type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[attribute_map[key]].is_a?(Array)
146
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
147
+ end
148
+ elsif !attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
150
+ end
151
+ end
152
+ new(transformed_hash)
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ if value.nil?
162
+ is_nullable = self.class.openapi_nullable.include?(attr)
163
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
164
+ end
165
+
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ end
172
+
173
+ end
@@ -0,0 +1,431 @@
1
+ =begin
2
+ #Maytes API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MaytesApiClient
17
+ class PhysicalGoodsLineItem < ApiModelBase
18
+ attr_accessor :item_ref
19
+
20
+ attr_accessor :parent_ref
21
+
22
+ attr_accessor :sku
23
+
24
+ attr_accessor :name
25
+
26
+ attr_accessor :description
27
+
28
+ attr_accessor :image_url
29
+
30
+ attr_accessor :quantity
31
+
32
+ attr_accessor :unit_price
33
+
34
+ attr_accessor :currency
35
+
36
+ attr_accessor :category
37
+
38
+ attr_accessor :custom_data
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'item_ref' => :'item_ref',
66
+ :'parent_ref' => :'parent_ref',
67
+ :'sku' => :'sku',
68
+ :'name' => :'name',
69
+ :'description' => :'description',
70
+ :'image_url' => :'image_url',
71
+ :'quantity' => :'quantity',
72
+ :'unit_price' => :'unit_price',
73
+ :'currency' => :'currency',
74
+ :'category' => :'category',
75
+ :'custom_data' => :'custom_data'
76
+ }
77
+ end
78
+
79
+ # Returns attribute mapping this model knows about
80
+ def self.acceptable_attribute_map
81
+ attribute_map
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ acceptable_attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'item_ref' => :'String',
93
+ :'parent_ref' => :'String',
94
+ :'sku' => :'String',
95
+ :'name' => :'String',
96
+ :'description' => :'String',
97
+ :'image_url' => :'String',
98
+ :'quantity' => :'Integer',
99
+ :'unit_price' => :'Integer',
100
+ :'currency' => :'String',
101
+ :'category' => :'String',
102
+ :'custom_data' => :'PhysicalGoodsCustomData'
103
+ }
104
+ end
105
+
106
+ # List of attributes with nullable: true
107
+ def self.openapi_nullable
108
+ Set.new([
109
+ :'parent_ref',
110
+ :'sku',
111
+ :'description',
112
+ :'image_url',
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MaytesApiClient::PhysicalGoodsLineItem` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ acceptable_attribute_map = self.class.acceptable_attribute_map
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!acceptable_attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MaytesApiClient::PhysicalGoodsLineItem`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'item_ref')
133
+ self.item_ref = attributes[:'item_ref']
134
+ else
135
+ self.item_ref = nil
136
+ end
137
+
138
+ if attributes.key?(:'parent_ref')
139
+ self.parent_ref = attributes[:'parent_ref']
140
+ end
141
+
142
+ if attributes.key?(:'sku')
143
+ self.sku = attributes[:'sku']
144
+ end
145
+
146
+ if attributes.key?(:'name')
147
+ self.name = attributes[:'name']
148
+ else
149
+ self.name = nil
150
+ end
151
+
152
+ if attributes.key?(:'description')
153
+ self.description = attributes[:'description']
154
+ end
155
+
156
+ if attributes.key?(:'image_url')
157
+ self.image_url = attributes[:'image_url']
158
+ end
159
+
160
+ if attributes.key?(:'quantity')
161
+ self.quantity = attributes[:'quantity']
162
+ else
163
+ self.quantity = nil
164
+ end
165
+
166
+ if attributes.key?(:'unit_price')
167
+ self.unit_price = attributes[:'unit_price']
168
+ else
169
+ self.unit_price = nil
170
+ end
171
+
172
+ if attributes.key?(:'currency')
173
+ self.currency = attributes[:'currency']
174
+ else
175
+ self.currency = nil
176
+ end
177
+
178
+ if attributes.key?(:'category')
179
+ self.category = attributes[:'category']
180
+ else
181
+ self.category = nil
182
+ end
183
+
184
+ if attributes.key?(:'custom_data')
185
+ self.custom_data = attributes[:'custom_data']
186
+ else
187
+ self.custom_data = nil
188
+ end
189
+ end
190
+
191
+ # Show invalid properties with the reasons. Usually used together with valid?
192
+ # @return Array for valid properties with the reasons
193
+ def list_invalid_properties
194
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
195
+ invalid_properties = Array.new
196
+ if @item_ref.nil?
197
+ invalid_properties.push('invalid value for "item_ref", item_ref cannot be nil.')
198
+ end
199
+
200
+ if @item_ref.to_s.length < 1
201
+ invalid_properties.push('invalid value for "item_ref", the character length must be greater than or equal to 1.')
202
+ end
203
+
204
+ if @name.nil?
205
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
206
+ end
207
+
208
+ if @name.to_s.length < 1
209
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
210
+ end
211
+
212
+ if @quantity.nil?
213
+ invalid_properties.push('invalid value for "quantity", quantity cannot be nil.')
214
+ end
215
+
216
+ if @quantity <= 0
217
+ invalid_properties.push('invalid value for "quantity", must be greater than 0.')
218
+ end
219
+
220
+ if @unit_price.nil?
221
+ invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.')
222
+ end
223
+
224
+ if @unit_price < 0
225
+ invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.')
226
+ end
227
+
228
+ if @currency.nil?
229
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
230
+ end
231
+
232
+ pattern = Regexp.new(/^[A-Z]{3}$/)
233
+ if @currency !~ pattern
234
+ invalid_properties.push("invalid value for \"currency\", must conform to the pattern #{pattern}.")
235
+ end
236
+
237
+ if @category.nil?
238
+ invalid_properties.push('invalid value for "category", category cannot be nil.')
239
+ end
240
+
241
+ if @custom_data.nil?
242
+ invalid_properties.push('invalid value for "custom_data", custom_data cannot be nil.')
243
+ end
244
+
245
+ invalid_properties
246
+ end
247
+
248
+ # Check to see if the all the properties in the model are valid
249
+ # @return true if the model is valid
250
+ def valid?
251
+ warn '[DEPRECATED] the `valid?` method is obsolete'
252
+ return false if @item_ref.nil?
253
+ return false if @item_ref.to_s.length < 1
254
+ return false if @name.nil?
255
+ return false if @name.to_s.length < 1
256
+ return false if @quantity.nil?
257
+ return false if @quantity <= 0
258
+ return false if @unit_price.nil?
259
+ return false if @unit_price < 0
260
+ return false if @currency.nil?
261
+ return false if @currency !~ Regexp.new(/^[A-Z]{3}$/)
262
+ return false if @category.nil?
263
+ category_validator = EnumAttributeValidator.new('String', ["physical_goods"])
264
+ return false unless category_validator.valid?(@category)
265
+ return false if @custom_data.nil?
266
+ true
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] item_ref Value to be assigned
271
+ def item_ref=(item_ref)
272
+ if item_ref.nil?
273
+ fail ArgumentError, 'item_ref cannot be nil'
274
+ end
275
+
276
+ if item_ref.to_s.length < 1
277
+ fail ArgumentError, 'invalid value for "item_ref", the character length must be greater than or equal to 1.'
278
+ end
279
+
280
+ @item_ref = item_ref
281
+ end
282
+
283
+ # Custom attribute writer method with validation
284
+ # @param [Object] name Value to be assigned
285
+ def name=(name)
286
+ if name.nil?
287
+ fail ArgumentError, 'name cannot be nil'
288
+ end
289
+
290
+ if name.to_s.length < 1
291
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
292
+ end
293
+
294
+ @name = name
295
+ end
296
+
297
+ # Custom attribute writer method with validation
298
+ # @param [Object] quantity Value to be assigned
299
+ def quantity=(quantity)
300
+ if quantity.nil?
301
+ fail ArgumentError, 'quantity cannot be nil'
302
+ end
303
+
304
+ if quantity <= 0
305
+ fail ArgumentError, 'invalid value for "quantity", must be greater than 0.'
306
+ end
307
+
308
+ @quantity = quantity
309
+ end
310
+
311
+ # Custom attribute writer method with validation
312
+ # @param [Object] unit_price Value to be assigned
313
+ def unit_price=(unit_price)
314
+ if unit_price.nil?
315
+ fail ArgumentError, 'unit_price cannot be nil'
316
+ end
317
+
318
+ if unit_price < 0
319
+ fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.'
320
+ end
321
+
322
+ @unit_price = unit_price
323
+ end
324
+
325
+ # Custom attribute writer method with validation
326
+ # @param [Object] currency Value to be assigned
327
+ def currency=(currency)
328
+ if currency.nil?
329
+ fail ArgumentError, 'currency cannot be nil'
330
+ end
331
+
332
+ pattern = Regexp.new(/^[A-Z]{3}$/)
333
+ if currency !~ pattern
334
+ fail ArgumentError, "invalid value for \"currency\", must conform to the pattern #{pattern}."
335
+ end
336
+
337
+ @currency = currency
338
+ end
339
+
340
+ # Custom attribute writer method checking allowed values (enum).
341
+ # @param [Object] category Object to be assigned
342
+ def category=(category)
343
+ validator = EnumAttributeValidator.new('String', ["physical_goods"])
344
+ unless validator.valid?(category)
345
+ fail ArgumentError, "invalid value for \"category\", must be one of #{validator.allowable_values}."
346
+ end
347
+ @category = category
348
+ end
349
+
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] custom_data Value to be assigned
352
+ def custom_data=(custom_data)
353
+ if custom_data.nil?
354
+ fail ArgumentError, 'custom_data cannot be nil'
355
+ end
356
+
357
+ @custom_data = custom_data
358
+ end
359
+
360
+ # Checks equality by comparing each attribute.
361
+ # @param [Object] Object to be compared
362
+ def ==(o)
363
+ return true if self.equal?(o)
364
+ self.class == o.class &&
365
+ item_ref == o.item_ref &&
366
+ parent_ref == o.parent_ref &&
367
+ sku == o.sku &&
368
+ name == o.name &&
369
+ description == o.description &&
370
+ image_url == o.image_url &&
371
+ quantity == o.quantity &&
372
+ unit_price == o.unit_price &&
373
+ currency == o.currency &&
374
+ category == o.category &&
375
+ custom_data == o.custom_data
376
+ end
377
+
378
+ # @see the `==` method
379
+ # @param [Object] Object to be compared
380
+ def eql?(o)
381
+ self == o
382
+ end
383
+
384
+ # Calculates hash code according to all attributes.
385
+ # @return [Integer] Hash code
386
+ def hash
387
+ [item_ref, parent_ref, sku, name, description, image_url, quantity, unit_price, currency, category, custom_data].hash
388
+ end
389
+
390
+ # Builds the object from hash
391
+ # @param [Hash] attributes Model attributes in the form of hash
392
+ # @return [Object] Returns the model itself
393
+ def self.build_from_hash(attributes)
394
+ return nil unless attributes.is_a?(Hash)
395
+ attributes = attributes.transform_keys(&:to_sym)
396
+ transformed_hash = {}
397
+ openapi_types.each_pair do |key, type|
398
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
399
+ transformed_hash["#{key}"] = nil
400
+ elsif type =~ /\AArray<(.*)>/i
401
+ # check to ensure the input is an array given that the attribute
402
+ # is documented as an array but the input is not
403
+ if attributes[attribute_map[key]].is_a?(Array)
404
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
405
+ end
406
+ elsif !attributes[attribute_map[key]].nil?
407
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
408
+ end
409
+ end
410
+ new(transformed_hash)
411
+ end
412
+
413
+ # Returns the object in the form of hash
414
+ # @return [Hash] Returns the object in the form of hash
415
+ def to_hash
416
+ hash = {}
417
+ self.class.attribute_map.each_pair do |attr, param|
418
+ value = self.send(attr)
419
+ if value.nil?
420
+ is_nullable = self.class.openapi_nullable.include?(attr)
421
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
422
+ end
423
+
424
+ hash[param] = _to_hash(value)
425
+ end
426
+ hash
427
+ end
428
+
429
+ end
430
+
431
+ end