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,164 @@
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 HealthResponse < ApiModelBase
18
+ attr_accessor :status
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'status' => :'status'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'status' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MaytesApiClient::HealthResponse` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MaytesApiClient::HealthResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'status')
67
+ self.status = attributes[:'status']
68
+ else
69
+ self.status = nil
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ if @status.nil?
79
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
89
+ return false if @status.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] status Value to be assigned
95
+ def status=(status)
96
+ if status.nil?
97
+ fail ArgumentError, 'status cannot be nil'
98
+ end
99
+
100
+ @status = status
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ status == o.status
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [status].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Returns the object in the form of hash
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_hash
149
+ hash = {}
150
+ self.class.attribute_map.each_pair do |attr, param|
151
+ value = self.send(attr)
152
+ if value.nil?
153
+ is_nullable = self.class.openapi_nullable.include?(attr)
154
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
155
+ end
156
+
157
+ hash[param] = _to_hash(value)
158
+ end
159
+ hash
160
+ end
161
+
162
+ end
163
+
164
+ end
@@ -0,0 +1,65 @@
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
+ module LineItem
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'DigitalGoodsLineItem',
23
+ :'DonationLineItem',
24
+ :'FoodBeverageLineItem',
25
+ :'OtherLineItem',
26
+ :'PhysicalGoodsLineItem',
27
+ :'ServiceLineItem',
28
+ :'TicketLineItem'
29
+ ]
30
+ end
31
+
32
+ # Discriminator's property name (OpenAPI v3)
33
+ def openapi_discriminator_name
34
+ :'category'
35
+ end
36
+
37
+ # Discriminator's mapping (OpenAPI v3)
38
+ def openapi_discriminator_mapping
39
+ {
40
+ :'digital_goods' => :'DigitalGoodsLineItem',
41
+ :'donation' => :'DonationLineItem',
42
+ :'food_beverage' => :'FoodBeverageLineItem',
43
+ :'other' => :'OtherLineItem',
44
+ :'physical_goods' => :'PhysicalGoodsLineItem',
45
+ :'service' => :'ServiceLineItem',
46
+ :'ticket' => :'TicketLineItem'
47
+ }
48
+ end
49
+
50
+ # Builds the object
51
+ # @param [Mixed] Data to be matched against the list of oneOf items
52
+ # @return [Object] Returns the model or the data itself
53
+ def build(data)
54
+ discriminator_value = data[openapi_discriminator_name]
55
+ return nil if discriminator_value.nil?
56
+
57
+ klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
58
+ return nil unless klass
59
+
60
+ MaytesApiClient.const_get(klass).build_from_hash(data)
61
+ end
62
+ end
63
+ end
64
+
65
+ end
@@ -0,0 +1,166 @@
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 ListSettlementsResponse < ApiModelBase
18
+ attr_accessor :data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'data' => :'Array<Settlement>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MaytesApiClient::ListSettlementsResponse` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MaytesApiClient::ListSettlementsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'data')
67
+ if (value = attributes[:'data']).is_a?(Array)
68
+ self.data = value
69
+ end
70
+ else
71
+ self.data = nil
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ if @data.nil?
81
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ return false if @data.nil?
92
+ true
93
+ end
94
+
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] data Value to be assigned
97
+ def data=(data)
98
+ if data.nil?
99
+ fail ArgumentError, 'data cannot be nil'
100
+ end
101
+
102
+ @data = data
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ data == o.data
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [data].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Returns the object in the form of hash
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_hash
151
+ hash = {}
152
+ self.class.attribute_map.each_pair do |attr, param|
153
+ value = self.send(attr)
154
+ if value.nil?
155
+ is_nullable = self.class.openapi_nullable.include?(attr)
156
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
157
+ end
158
+
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ end
165
+
166
+ end
@@ -0,0 +1,244 @@
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 OAuthTokenRequest < ApiModelBase
18
+ attr_accessor :grant_type
19
+
20
+ attr_accessor :client_id
21
+
22
+ attr_accessor :client_secret
23
+
24
+ attr_accessor :username
25
+
26
+ attr_accessor :password
27
+
28
+ attr_accessor :refresh_token
29
+
30
+ attr_accessor :scope
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'grant_type' => :'grant_type',
36
+ :'client_id' => :'client_id',
37
+ :'client_secret' => :'client_secret',
38
+ :'username' => :'username',
39
+ :'password' => :'password',
40
+ :'refresh_token' => :'refresh_token',
41
+ :'scope' => :'scope'
42
+ }
43
+ end
44
+
45
+ # Returns attribute mapping this model knows about
46
+ def self.acceptable_attribute_map
47
+ attribute_map
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ acceptable_attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'grant_type' => :'String',
59
+ :'client_id' => :'String',
60
+ :'client_secret' => :'String',
61
+ :'username' => :'String',
62
+ :'password' => :'String',
63
+ :'refresh_token' => :'String',
64
+ :'scope' => :'String'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MaytesApiClient::OAuthTokenRequest` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ acceptable_attribute_map = self.class.acceptable_attribute_map
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!acceptable_attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MaytesApiClient::OAuthTokenRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'grant_type')
91
+ self.grant_type = attributes[:'grant_type']
92
+ else
93
+ self.grant_type = nil
94
+ end
95
+
96
+ if attributes.key?(:'client_id')
97
+ self.client_id = attributes[:'client_id']
98
+ else
99
+ self.client_id = nil
100
+ end
101
+
102
+ if attributes.key?(:'client_secret')
103
+ self.client_secret = attributes[:'client_secret']
104
+ end
105
+
106
+ if attributes.key?(:'username')
107
+ self.username = attributes[:'username']
108
+ end
109
+
110
+ if attributes.key?(:'password')
111
+ self.password = attributes[:'password']
112
+ end
113
+
114
+ if attributes.key?(:'refresh_token')
115
+ self.refresh_token = attributes[:'refresh_token']
116
+ end
117
+
118
+ if attributes.key?(:'scope')
119
+ self.scope = attributes[:'scope']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
+ invalid_properties = Array.new
128
+ if @grant_type.nil?
129
+ invalid_properties.push('invalid value for "grant_type", grant_type cannot be nil.')
130
+ end
131
+
132
+ if @grant_type.to_s.length < 1
133
+ invalid_properties.push('invalid value for "grant_type", the character length must be greater than or equal to 1.')
134
+ end
135
+
136
+ if @client_id.nil?
137
+ invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ return false if @grant_type.nil?
148
+ return false if @grant_type.to_s.length < 1
149
+ return false if @client_id.nil?
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] grant_type Value to be assigned
155
+ def grant_type=(grant_type)
156
+ if grant_type.nil?
157
+ fail ArgumentError, 'grant_type cannot be nil'
158
+ end
159
+
160
+ if grant_type.to_s.length < 1
161
+ fail ArgumentError, 'invalid value for "grant_type", the character length must be greater than or equal to 1.'
162
+ end
163
+
164
+ @grant_type = grant_type
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] client_id Value to be assigned
169
+ def client_id=(client_id)
170
+ if client_id.nil?
171
+ fail ArgumentError, 'client_id cannot be nil'
172
+ end
173
+
174
+ @client_id = client_id
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(o)
180
+ return true if self.equal?(o)
181
+ self.class == o.class &&
182
+ grant_type == o.grant_type &&
183
+ client_id == o.client_id &&
184
+ client_secret == o.client_secret &&
185
+ username == o.username &&
186
+ password == o.password &&
187
+ refresh_token == o.refresh_token &&
188
+ scope == o.scope
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [grant_type, client_id, client_secret, username, password, refresh_token, scope].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ attributes = attributes.transform_keys(&:to_sym)
209
+ transformed_hash = {}
210
+ openapi_types.each_pair do |key, type|
211
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = nil
213
+ elsif type =~ /\AArray<(.*)>/i
214
+ # check to ensure the input is an array given that the attribute
215
+ # is documented as an array but the input is not
216
+ if attributes[attribute_map[key]].is_a?(Array)
217
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
218
+ end
219
+ elsif !attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
221
+ end
222
+ end
223
+ new(transformed_hash)
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ end
243
+
244
+ end