jamm 1.2.2 → 1.4.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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/jamm/api/api/customer_api.rb +82 -52
  4. data/lib/jamm/api/api/healthcheck_api.rb +18 -15
  5. data/lib/jamm/api/api/payment_api.rb +113 -62
  6. data/lib/jamm/api/api/webhook_service_api.rb +91 -19
  7. data/lib/jamm/api/api_client.rb +74 -66
  8. data/lib/jamm/api/api_error.rb +16 -16
  9. data/lib/jamm/api/configuration.rb +42 -34
  10. data/lib/jamm/api/models/apiv1_error.rb +238 -0
  11. data/lib/jamm/api/models/apiv1_status.rb +57 -47
  12. data/lib/jamm/api/models/customer_service_update_customer_body.rb +107 -69
  13. data/lib/jamm/api/models/googlerpc_status.rb +61 -45
  14. data/lib/jamm/api/models/protobuf_any.rb +42 -35
  15. data/lib/jamm/api/models/v1_add_charge_request.rb +59 -44
  16. data/lib/jamm/api/models/v1_add_charge_response.rb +59 -44
  17. data/lib/jamm/api/models/v1_bank.rb +350 -0
  18. data/lib/jamm/api/models/v1_bank_assets.rb +244 -0
  19. data/lib/jamm/api/models/v1_bank_branch.rb +259 -0
  20. data/lib/jamm/api/models/v1_bank_information.rb +71 -51
  21. data/lib/jamm/api/models/v1_bank_quota.rb +278 -0
  22. data/lib/jamm/api/models/v1_bank_scheduled_maintenance_period.rb +250 -0
  23. data/lib/jamm/api/models/v1_buyer.rb +104 -76
  24. data/lib/jamm/api/models/v1_charge.rb +67 -52
  25. data/lib/jamm/api/models/v1_charge_message.rb +151 -93
  26. data/lib/jamm/api/models/v1_charge_message_status.rb +17 -18
  27. data/lib/jamm/api/models/v1_charge_result.rb +152 -93
  28. data/lib/jamm/api/models/v1_contract.rb +64 -52
  29. data/lib/jamm/api/models/v1_contract_message.rb +67 -48
  30. data/lib/jamm/api/models/v1_contract_status.rb +20 -21
  31. data/lib/jamm/api/models/v1_create_contract_with_charge_request.rb +59 -44
  32. data/lib/jamm/api/models/v1_create_contract_with_charge_response.rb +67 -48
  33. data/lib/jamm/api/models/v1_create_contract_without_charge_request.rb +51 -40
  34. data/lib/jamm/api/models/v1_create_contract_without_charge_response.rb +59 -44
  35. data/lib/jamm/api/models/v1_create_customer_request.rb +42 -35
  36. data/lib/jamm/api/models/v1_create_customer_response.rb +42 -35
  37. data/lib/jamm/api/models/v1_customer.rb +91 -60
  38. data/lib/jamm/api/models/v1_delete_customer_response.rb +42 -35
  39. data/lib/jamm/api/models/v1_deposit_type.rb +14 -15
  40. data/lib/jamm/api/models/v1_error_detail.rb +233 -0
  41. data/lib/jamm/api/models/v1_error_response.rb +238 -0
  42. data/lib/jamm/api/models/v1_error_type.rb +57 -0
  43. data/lib/jamm/api/models/v1_event_type.rb +20 -21
  44. data/lib/jamm/api/models/{v1_error.rb → v1_get_bank_response.rb} +45 -48
  45. data/lib/jamm/api/models/v1_get_branch_response.rb +214 -0
  46. data/lib/jamm/api/models/v1_get_branches_response.rb +216 -0
  47. data/lib/jamm/api/models/v1_get_charge_response.rb +51 -40
  48. data/lib/jamm/api/models/v1_get_charges_response.rb +60 -45
  49. data/lib/jamm/api/models/v1_get_contract_response.rb +51 -40
  50. data/lib/jamm/api/models/v1_get_customer_response.rb +42 -35
  51. data/lib/jamm/api/models/v1_get_major_banks_response.rb +232 -0
  52. data/lib/jamm/api/models/v1_initial_charge.rb +61 -48
  53. data/lib/jamm/api/models/v1_kyc_status.rb +16 -17
  54. data/lib/jamm/api/models/v1_merchant.rb +51 -40
  55. data/lib/jamm/api/models/v1_merchant_customer.rb +51 -40
  56. data/lib/jamm/api/models/v1_merchant_webhook_message.rb +75 -57
  57. data/lib/jamm/api/models/v1_message_response.rb +67 -48
  58. data/lib/jamm/api/models/v1_off_session_payment_request.rb +51 -40
  59. data/lib/jamm/api/models/v1_off_session_payment_response.rb +51 -40
  60. data/lib/jamm/api/models/v1_on_session_payment_data.rb +67 -48
  61. data/lib/jamm/api/models/v1_on_session_payment_error.rb +55 -45
  62. data/lib/jamm/api/models/v1_on_session_payment_error_code.rb +21 -22
  63. data/lib/jamm/api/models/v1_on_session_payment_request.rb +67 -48
  64. data/lib/jamm/api/models/v1_on_session_payment_response.rb +59 -44
  65. data/lib/jamm/api/models/v1_pagination.rb +51 -40
  66. data/lib/jamm/api/models/v1_payment_authorization_status.rb +14 -15
  67. data/lib/jamm/api/models/v1_payment_link.rb +57 -44
  68. data/lib/jamm/api/models/v1_ping_response.rb +42 -35
  69. data/lib/jamm/api/models/v1_search_banks_response.rb +216 -0
  70. data/lib/jamm/api/models/v1_search_branches_response.rb +216 -0
  71. data/lib/jamm/api/models/v1_update_customer_response.rb +42 -35
  72. data/lib/jamm/api/models/v1_url.rb +48 -39
  73. data/lib/jamm/api/models/v1_user_account_message.rb +67 -48
  74. data/lib/jamm/api/models/v1_withdraw_request.rb +51 -40
  75. data/lib/jamm/api/models/v1_withdraw_response.rb +51 -40
  76. data/lib/jamm/api/version.rb +11 -11
  77. data/lib/jamm/api.rb +25 -11
  78. data/lib/jamm/charge.rb +12 -0
  79. data/lib/jamm/deprecation.rb +13 -0
  80. data/lib/jamm/errors.rb +27 -1
  81. data/lib/jamm/payment.rb +61 -0
  82. data/lib/jamm/version.rb +1 -1
  83. data/lib/jamm.rb +2 -0
  84. metadata +19 -3
@@ -1,14 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
- # #Jamm API
4
- #
5
- # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- #
7
- # The version of the OpenAPI document: 1.0
8
- #
9
- # Generated by: https://openapi-generator.tech
10
- # Generator version: 7.9.0
11
- #
1
+ =begin
2
+ #Jamm 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
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
12
 
13
13
  require 'date'
14
14
  require 'time'
@@ -16,18 +16,30 @@ require 'time'
16
16
  module Api
17
17
  # Customer object.
18
18
  class Customer
19
- attr_accessor :id, :email, :activated, :status, :bank_information, :created_at, :updated_at
19
+ attr_accessor :id
20
+
21
+ attr_accessor :email
22
+
23
+ attr_accessor :activated
24
+
25
+ attr_accessor :status
26
+
27
+ attr_accessor :bank_information
28
+
29
+ attr_accessor :created_at
30
+
31
+ attr_accessor :updated_at
20
32
 
21
33
  # Attribute mapping from ruby-style variable name to JSON key.
22
34
  def self.attribute_map
23
35
  {
24
- :id => :id,
25
- :email => :email,
26
- :activated => :activated,
27
- :status => :status,
28
- :bank_information => :bankInformation,
29
- :created_at => :createdAt,
30
- :updated_at => :updatedAt
36
+ :'id' => :'id',
37
+ :'email' => :'email',
38
+ :'activated' => :'activated',
39
+ :'status' => :'status',
40
+ :'bank_information' => :'bankInformation',
41
+ :'created_at' => :'createdAt',
42
+ :'updated_at' => :'updatedAt'
31
43
  }
32
44
  end
33
45
 
@@ -39,55 +51,72 @@ module Api
39
51
  # Attribute type mapping.
40
52
  def self.openapi_types
41
53
  {
42
- :id => :String,
43
- :email => :String,
44
- :activated => :Boolean,
45
- :status => :Apiv1Status,
46
- :bank_information => :BankInformation,
47
- :created_at => :Time,
48
- :updated_at => :Time
54
+ :'id' => :'String',
55
+ :'email' => :'String',
56
+ :'activated' => :'Boolean',
57
+ :'status' => :'Apiv1Status',
58
+ :'bank_information' => :'BankInformation',
59
+ :'created_at' => :'Time',
60
+ :'updated_at' => :'Time'
49
61
  }
50
62
  end
51
63
 
52
64
  # List of attributes with nullable: true
53
65
  def self.openapi_nullable
54
- Set.new([])
66
+ Set.new([
67
+ ])
55
68
  end
56
69
 
57
70
  # Initializes the object
58
71
  # @param [Hash] attributes Model attributes in the form of hash
59
72
  def initialize(attributes = {})
60
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::Customer` initialize method' unless attributes.is_a?(Hash)
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Api::Customer` initialize method"
75
+ end
61
76
 
62
77
  # check to see if the attribute exists and convert string to symbol for hash key
63
- attributes = attributes.each_with_object({}) do |(k, v), h|
64
- raise ArgumentError, "`#{k}` is not a valid attribute in `Api::Customer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)
65
-
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Api::Customer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
66
82
  h[k.to_sym] = v
67
- end
68
-
69
- self.id = attributes[:id] if attributes.key?(:id)
83
+ }
70
84
 
71
- self.email = attributes[:email] if attributes.key?(:email)
85
+ if attributes.key?(:'id')
86
+ self.id = attributes[:'id']
87
+ end
72
88
 
73
- self.activated = attributes[:activated] if attributes.key?(:activated)
89
+ if attributes.key?(:'email')
90
+ self.email = attributes[:'email']
91
+ end
74
92
 
75
- self.status = attributes[:status] if attributes.key?(:status)
93
+ if attributes.key?(:'activated')
94
+ self.activated = attributes[:'activated']
95
+ end
76
96
 
77
- self.bank_information = attributes[:bank_information] if attributes.key?(:bank_information)
97
+ if attributes.key?(:'status')
98
+ self.status = attributes[:'status']
99
+ end
78
100
 
79
- self.created_at = attributes[:created_at] if attributes.key?(:created_at)
101
+ if attributes.key?(:'bank_information')
102
+ self.bank_information = attributes[:'bank_information']
103
+ end
80
104
 
81
- return unless attributes.key?(:updated_at)
105
+ if attributes.key?(:'created_at')
106
+ self.created_at = attributes[:'created_at']
107
+ end
82
108
 
83
- self.updated_at = attributes[:updated_at]
109
+ if attributes.key?(:'updated_at')
110
+ self.updated_at = attributes[:'updated_at']
111
+ end
84
112
  end
85
113
 
86
114
  # Show invalid properties with the reasons. Usually used together with valid?
87
115
  # @return Array for valid properties with the reasons
88
116
  def list_invalid_properties
89
117
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
- []
118
+ invalid_properties = Array.new
119
+ invalid_properties
91
120
  end
92
121
 
93
122
  # Check to see if the all the properties in the model are valid
@@ -99,23 +128,22 @@ module Api
99
128
 
100
129
  # Checks equality by comparing each attribute.
101
130
  # @param [Object] Object to be compared
102
- def ==(other)
103
- return true if equal?(other)
104
-
105
- self.class == other.class &&
106
- id == other.id &&
107
- email == other.email &&
108
- activated == other.activated &&
109
- status == other.status &&
110
- bank_information == other.bank_information &&
111
- created_at == other.created_at &&
112
- updated_at == other.updated_at
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ id == o.id &&
135
+ email == o.email &&
136
+ activated == o.activated &&
137
+ status == o.status &&
138
+ bank_information == o.bank_information &&
139
+ created_at == o.created_at &&
140
+ updated_at == o.updated_at
113
141
  end
114
142
 
115
143
  # @see the `==` method
116
144
  # @param [Object] Object to be compared
117
- def eql?(other)
118
- self == other
145
+ def eql?(o)
146
+ self == o
119
147
  end
120
148
 
121
149
  # Calculates hash code according to all attributes.
@@ -129,18 +157,19 @@ module Api
129
157
  # @return [Object] Returns the model itself
130
158
  def self.build_from_hash(attributes)
131
159
  return nil unless attributes.is_a?(Hash)
132
-
133
160
  attributes = attributes.transform_keys(&:to_sym)
134
161
  transformed_hash = {}
135
162
  openapi_types.each_pair do |key, type|
136
163
  if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
137
- transformed_hash[key.to_s] = nil
164
+ transformed_hash["#{key}"] = nil
138
165
  elsif type =~ /\AArray<(.*)>/i
139
166
  # check to ensure the input is an array given that the attribute
140
167
  # is documented as an array but the input is not
141
- transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } if attributes[attribute_map[key]].is_a?(Array)
168
+ if attributes[attribute_map[key]].is_a?(Array)
169
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
170
+ end
142
171
  elsif !attributes[attribute_map[key]].nil?
143
- transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
172
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
173
  end
145
174
  end
146
175
  new(transformed_hash)
@@ -206,7 +235,7 @@ module Api
206
235
  def to_hash
207
236
  hash = {}
208
237
  self.class.attribute_map.each_pair do |attr, param|
209
- value = send(attr)
238
+ value = self.send(attr)
210
239
  if value.nil?
211
240
  is_nullable = self.class.openapi_nullable.include?(attr)
212
241
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
@@ -234,5 +263,7 @@ module Api
234
263
  value
235
264
  end
236
265
  end
266
+
237
267
  end
268
+
238
269
  end
@@ -1,14 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
- # #Jamm API
4
- #
5
- # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- #
7
- # The version of the OpenAPI document: 1.0
8
- #
9
- # Generated by: https://openapi-generator.tech
10
- # Generator version: 7.9.0
11
- #
1
+ =begin
2
+ #Jamm 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
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
12
 
13
13
  require 'date'
14
14
  require 'time'
@@ -20,7 +20,7 @@ module Api
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
21
21
  def self.attribute_map
22
22
  {
23
- :accepted => :accepted
23
+ :'accepted' => :'accepted'
24
24
  }
25
25
  end
26
26
 
@@ -32,37 +32,42 @@ module Api
32
32
  # Attribute type mapping.
33
33
  def self.openapi_types
34
34
  {
35
- :accepted => :Boolean
35
+ :'accepted' => :'Boolean'
36
36
  }
37
37
  end
38
38
 
39
39
  # List of attributes with nullable: true
40
40
  def self.openapi_nullable
41
- Set.new([])
41
+ Set.new([
42
+ ])
42
43
  end
43
44
 
44
45
  # Initializes the object
45
46
  # @param [Hash] attributes Model attributes in the form of hash
46
47
  def initialize(attributes = {})
47
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::DeleteCustomerResponse` initialize method' unless attributes.is_a?(Hash)
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Api::DeleteCustomerResponse` initialize method"
50
+ end
48
51
 
49
52
  # check to see if the attribute exists and convert string to symbol for hash key
50
- attributes = attributes.each_with_object({}) do |(k, v), h|
51
- raise ArgumentError, "`#{k}` is not a valid attribute in `Api::DeleteCustomerResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)
52
-
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Api::DeleteCustomerResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
53
57
  h[k.to_sym] = v
54
- end
55
-
56
- return unless attributes.key?(:accepted)
58
+ }
57
59
 
58
- self.accepted = attributes[:accepted]
60
+ if attributes.key?(:'accepted')
61
+ self.accepted = attributes[:'accepted']
62
+ end
59
63
  end
60
64
 
61
65
  # Show invalid properties with the reasons. Usually used together with valid?
62
66
  # @return Array for valid properties with the reasons
63
67
  def list_invalid_properties
64
68
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
65
- []
69
+ invalid_properties = Array.new
70
+ invalid_properties
66
71
  end
67
72
 
68
73
  # Check to see if the all the properties in the model are valid
@@ -74,17 +79,16 @@ module Api
74
79
 
75
80
  # Checks equality by comparing each attribute.
76
81
  # @param [Object] Object to be compared
77
- def ==(other)
78
- return true if equal?(other)
79
-
80
- self.class == other.class &&
81
- accepted == other.accepted
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ accepted == o.accepted
82
86
  end
83
87
 
84
88
  # @see the `==` method
85
89
  # @param [Object] Object to be compared
86
- def eql?(other)
87
- self == other
90
+ def eql?(o)
91
+ self == o
88
92
  end
89
93
 
90
94
  # Calculates hash code according to all attributes.
@@ -98,18 +102,19 @@ module Api
98
102
  # @return [Object] Returns the model itself
99
103
  def self.build_from_hash(attributes)
100
104
  return nil unless attributes.is_a?(Hash)
101
-
102
105
  attributes = attributes.transform_keys(&:to_sym)
103
106
  transformed_hash = {}
104
107
  openapi_types.each_pair do |key, type|
105
108
  if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
106
- transformed_hash[key.to_s] = nil
109
+ transformed_hash["#{key}"] = nil
107
110
  elsif type =~ /\AArray<(.*)>/i
108
111
  # check to ensure the input is an array given that the attribute
109
112
  # is documented as an array but the input is not
110
- transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } if attributes[attribute_map[key]].is_a?(Array)
113
+ if attributes[attribute_map[key]].is_a?(Array)
114
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
+ end
111
116
  elsif !attributes[attribute_map[key]].nil?
112
- transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
117
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
113
118
  end
114
119
  end
115
120
  new(transformed_hash)
@@ -175,7 +180,7 @@ module Api
175
180
  def to_hash
176
181
  hash = {}
177
182
  self.class.attribute_map.each_pair do |attr, param|
178
- value = send(attr)
183
+ value = self.send(attr)
179
184
  if value.nil?
180
185
  is_nullable = self.class.openapi_nullable.include?(attr)
181
186
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
@@ -203,5 +208,7 @@ module Api
203
208
  value
204
209
  end
205
210
  end
211
+
206
212
  end
213
+
207
214
  end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- # #Jamm API
4
- #
5
- # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- #
7
- # The version of the OpenAPI document: 1.0
8
- #
9
- # Generated by: https://openapi-generator.tech
10
- # Generator version: 7.9.0
11
- #
1
+ =begin
2
+ #Jamm 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
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
12
 
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Api
17
17
  class DepositType
18
- UNSPECIFIED = 'DEPOSIT_TYPE_UNSPECIFIED'
19
- SAVINGS = 'DEPOSIT_TYPE_SAVINGS'
20
- CHECKING = 'DEPOSIT_TYPE_CHECKING'
18
+ UNSPECIFIED = "DEPOSIT_TYPE_UNSPECIFIED".freeze
19
+ SAVINGS = "DEPOSIT_TYPE_SAVINGS".freeze
20
+ CHECKING = "DEPOSIT_TYPE_CHECKING".freeze
21
21
 
22
22
  def self.all_vars
23
23
  @all_vars ||= [UNSPECIFIED, SAVINGS, CHECKING].freeze
@@ -35,7 +35,6 @@ module Api
35
35
  # @return [String] The enum value
36
36
  def build_from_hash(value)
37
37
  return value if DepositType.all_vars.include?(value)
38
-
39
38
  raise "Invalid ENUM value #{value} for class #DepositType"
40
39
  end
41
40
  end
@@ -0,0 +1,233 @@
1
+ =begin
2
+ #Jamm 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
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Api
17
+ class ErrorDetail
18
+ attr_accessor :type
19
+
20
+ # Base64 encoded value of the message.
21
+ attr_accessor :value
22
+
23
+ attr_accessor :debug
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'type' => :'type',
29
+ :'value' => :'value',
30
+ :'debug' => :'debug'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'type' => :'String',
43
+ :'value' => :'String',
44
+ :'debug' => :'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 `Api::ErrorDetail` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Api::ErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'type')
70
+ self.type = attributes[:'type']
71
+ end
72
+
73
+ if attributes.key?(:'value')
74
+ self.value = attributes[:'value']
75
+ end
76
+
77
+ if attributes.key?(:'debug')
78
+ self.debug = attributes[:'debug']
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
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ type == o.type &&
103
+ value == o.value &&
104
+ debug == o.debug
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [type, value, debug].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def self._deserialize(type, value)
147
+ case type.to_sym
148
+ when :Time
149
+ Time.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ # models (e.g. Pet) or oneOf
180
+ klass = Api.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end