weft-sdk 0.23.2 → 0.25.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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/docs/BalanceResponse.md +4 -0
  3. data/docs/FetchApi.md +1 -1
  4. data/docs/FetchBalanceSnapshot.md +4 -2
  5. data/docs/FetchResponse.md +1 -3
  6. data/docs/Purchase.md +1 -1
  7. data/docs/SearchApi.md +0 -67
  8. data/lib/weft/generated/api/account_api.rb +1 -1
  9. data/lib/weft/generated/api/agent_bootstrap_api.rb +1 -1
  10. data/lib/weft/generated/api/api_keys_api.rb +1 -1
  11. data/lib/weft/generated/api/auth_api.rb +1 -1
  12. data/lib/weft/generated/api/balance_api.rb +1 -1
  13. data/lib/weft/generated/api/documentation_api.rb +1 -1
  14. data/lib/weft/generated/api/fetch_api.rb +3 -3
  15. data/lib/weft/generated/api/payments_api.rb +1 -1
  16. data/lib/weft/generated/api/purchases_api.rb +1 -1
  17. data/lib/weft/generated/api/resources_api.rb +1 -1
  18. data/lib/weft/generated/api/search_api.rb +1 -80
  19. data/lib/weft/generated/api_client.rb +1 -1
  20. data/lib/weft/generated/api_error.rb +1 -1
  21. data/lib/weft/generated/api_model_base.rb +1 -1
  22. data/lib/weft/generated/configuration.rb +1 -1
  23. data/lib/weft/generated/models/account_bootstrap_approval.rb +1 -1
  24. data/lib/weft/generated/models/account_bootstrap_created.rb +1 -1
  25. data/lib/weft/generated/models/account_bootstrap_created_approval.rb +1 -1
  26. data/lib/weft/generated/models/account_bootstrap_created_response.rb +1 -1
  27. data/lib/weft/generated/models/account_bootstrap_request.rb +1 -1
  28. data/lib/weft/generated/models/account_bootstrap_status.rb +1 -1
  29. data/lib/weft/generated/models/account_bootstrap_status_response.rb +1 -1
  30. data/lib/weft/generated/models/account_details.rb +1 -1
  31. data/lib/weft/generated/models/api_key.rb +1 -1
  32. data/lib/weft/generated/models/api_key_created.rb +1 -1
  33. data/lib/weft/generated/models/api_key_created_response.rb +1 -1
  34. data/lib/weft/generated/models/api_key_list_response.rb +1 -1
  35. data/lib/weft/generated/models/auth_response.rb +1 -1
  36. data/lib/weft/generated/models/auth_response_data.rb +1 -1
  37. data/lib/weft/generated/models/balance_response.rb +56 -2
  38. data/lib/weft/generated/models/confirm_request.rb +1 -1
  39. data/lib/weft/generated/models/create_api_key_request.rb +1 -1
  40. data/lib/weft/generated/models/enrolled_resource.rb +1 -1
  41. data/lib/weft/generated/models/error.rb +1 -1
  42. data/lib/weft/generated/models/error_response.rb +1 -1
  43. data/lib/weft/generated/models/fetch403_response.rb +1 -1
  44. data/lib/weft/generated/models/fetch_balance_snapshot.rb +33 -5
  45. data/lib/weft/generated/models/fetch_error_response.rb +3 -3
  46. data/lib/weft/generated/models/fetch_request.rb +1 -1
  47. data/lib/weft/generated/models/fetch_request_body.rb +1 -1
  48. data/lib/weft/generated/models/fetch_response.rb +6 -33
  49. data/lib/weft/generated/models/insufficient_scope_response.rb +1 -1
  50. data/lib/weft/generated/models/me_api_key.rb +1 -1
  51. data/lib/weft/generated/models/me_api_key_creator.rb +1 -1
  52. data/lib/weft/generated/models/me_response.rb +1 -1
  53. data/lib/weft/generated/models/me_response_data.rb +1 -1
  54. data/lib/weft/generated/models/message_response.rb +1 -1
  55. data/lib/weft/generated/models/message_response_data.rb +1 -1
  56. data/lib/weft/generated/models/pagination.rb +1 -1
  57. data/lib/weft/generated/models/password_reset_request.rb +1 -1
  58. data/lib/weft/generated/models/password_update_request.rb +1 -1
  59. data/lib/weft/generated/models/payment.rb +1 -1
  60. data/lib/weft/generated/models/payment_list_response.rb +1 -1
  61. data/lib/weft/generated/models/payment_response.rb +1 -1
  62. data/lib/weft/generated/models/principal_wallet.rb +1 -1
  63. data/lib/weft/generated/models/promo_balance.rb +1 -1
  64. data/lib/weft/generated/models/purchase.rb +2 -2
  65. data/lib/weft/generated/models/purchase_artifact.rb +1 -1
  66. data/lib/weft/generated/models/purchase_list_response.rb +1 -1
  67. data/lib/weft/generated/models/purchase_response.rb +1 -1
  68. data/lib/weft/generated/models/rate_limit_response.rb +1 -1
  69. data/lib/weft/generated/models/resend_confirmation_request.rb +1 -1
  70. data/lib/weft/generated/models/resource_enrollment_request.rb +1 -1
  71. data/lib/weft/generated/models/resource_enrollment_response.rb +1 -1
  72. data/lib/weft/generated/models/resource_stats.rb +1 -1
  73. data/lib/weft/generated/models/search_access_method.rb +1 -1
  74. data/lib/weft/generated/models/search_capability_ref.rb +1 -1
  75. data/lib/weft/generated/models/search_curated_callability.rb +1 -1
  76. data/lib/weft/generated/models/search_curated_execution.rb +1 -1
  77. data/lib/weft/generated/models/search_curated_operation.rb +1 -1
  78. data/lib/weft/generated/models/search_curated_service.rb +1 -1
  79. data/lib/weft/generated/models/search_curated_source.rb +1 -1
  80. data/lib/weft/generated/models/search_endpoint_call.rb +1 -1
  81. data/lib/weft/generated/models/search_endpoint_hit.rb +1 -1
  82. data/lib/weft/generated/models/search_endpoint_price.rb +1 -1
  83. data/lib/weft/generated/models/search_error_response.rb +1 -1
  84. data/lib/weft/generated/models/search_execution_mode_filter.rb +1 -1
  85. data/lib/weft/generated/models/search_filter_spec.rb +1 -1
  86. data/lib/weft/generated/models/search_method_filter.rb +1 -1
  87. data/lib/weft/generated/models/search_payment_offer.rb +1 -1
  88. data/lib/weft/generated/models/search_price_atomic_filter.rb +1 -1
  89. data/lib/weft/generated/models/search_price_usd_filter.rb +1 -1
  90. data/lib/weft/generated/models/search_protocol_filter.rb +1 -1
  91. data/lib/weft/generated/models/search_provider_ref.rb +1 -1
  92. data/lib/weft/generated/models/search_request.rb +1 -1
  93. data/lib/weft/generated/models/search_resource_type_filter.rb +1 -1
  94. data/lib/weft/generated/models/search_response.rb +1 -1
  95. data/lib/weft/generated/models/search_response_warnings_inner.rb +1 -1
  96. data/lib/weft/generated/models/search_result.rb +1 -1
  97. data/lib/weft/generated/models/search_string_set_filter.rb +1 -1
  98. data/lib/weft/generated/models/search_weft_fetch_compatibility.rb +1 -1
  99. data/lib/weft/generated/models/sign_in_request.rb +1 -1
  100. data/lib/weft/generated/models/sign_up_request.rb +1 -1
  101. data/lib/weft/generated/models/spending_policy.rb +1 -1
  102. data/lib/weft/generated/models/user.rb +1 -1
  103. data/lib/weft/generated/models/user_principal.rb +1 -1
  104. data/lib/weft/generated/models/wallet.rb +1 -1
  105. data/lib/weft/generated/version.rb +2 -2
  106. data/lib/weft/sdk.rb +1 -1
  107. metadata +2 -6
  108. data/docs/CuratedMarketplaceContract.md +0 -31
  109. data/docs/Merchant.md +0 -23
  110. data/lib/weft/generated/models/curated_marketplace_contract.rb +0 -384
  111. data/lib/weft/generated/models/merchant.rb +0 -264
@@ -1,384 +0,0 @@
1
- =begin
2
- #Weft API
3
-
4
- #The Weft API powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and third-party applications that discover and pay for resources on Weft. The buyer runtime covers six concerns: 1. Account creation and recovery (`/api/v1/auth/*`) 2. Credential identity (`/api/v1/me`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/purchases`) Buyer runtime calls require a dashboard-created `wk_*` account key, an OAuth access token with the relevant scope, or a claimed `wbt_*` bearer on its fixed allowlist. The organization-scoped API key and payment operations in this document are seller administration surfaces and require an `ax_live_*` resource key. These credential types are not interchangeable. This document is a deliberate subset of the `/api/v1` surface, not an inventory of it. The seller-side management endpoints — `/api/v1/agents`, `/api/v1/webhook_endpoints`, and `/api/v1/analytics` — are reachable with an `ax_live_*` key but are intentionally left undocumented: they are dashboard-facing and not part of the published client contract. Nothing outside this document is a supported contract, and the response-validation gate in `config/environments/test.rb` enforces only what is declared here. Before claim, a `wbt_*` bearer is temporary and permits only search plus its own status/cancel operations for 30 minutes. Human approval binds it to the User and promotes the same secret to durable identity, search, balance, fetch, purchase-history, status, and revocation capabilities. It remains valid until revoked. Seller, organization, API-key administration, dashboard-session, transfer, withdrawal, and MCP surfaces always refuse it. Bootstrap lifecycle successes follow the API-standard `{ \"data\": ... }` envelope. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
-
6
- The version of the OpenAPI document: 0.23.2
7
-
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.19.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Weft
17
- class CuratedMarketplaceContract < ApiModelBase
18
- attr_accessor :schema_version
19
-
20
- attr_accessor :snapshot
21
-
22
- attr_accessor :provider
23
-
24
- attr_accessor :service
25
-
26
- attr_accessor :operation
27
-
28
- attr_accessor :request
29
-
30
- attr_accessor :access_methods
31
-
32
- attr_accessor :evidence
33
-
34
- class EnumAttributeValidator
35
- attr_reader :datatype
36
- attr_reader :allowable_values
37
-
38
- def initialize(datatype, allowable_values)
39
- @allowable_values = allowable_values.map do |value|
40
- case datatype.to_s
41
- when /Integer/i
42
- value.to_i
43
- when /Float/i
44
- value.to_f
45
- else
46
- value
47
- end
48
- end
49
- end
50
-
51
- def valid?(value)
52
- !value || allowable_values.include?(value)
53
- end
54
- end
55
-
56
- # Attribute mapping from ruby-style variable name to JSON key.
57
- def self.attribute_map
58
- {
59
- :'schema_version' => :'schema_version',
60
- :'snapshot' => :'snapshot',
61
- :'provider' => :'provider',
62
- :'service' => :'service',
63
- :'operation' => :'operation',
64
- :'request' => :'request',
65
- :'access_methods' => :'access_methods',
66
- :'evidence' => :'evidence'
67
- }
68
- end
69
-
70
- # Returns attribute mapping this model knows about
71
- def self.acceptable_attribute_map
72
- attribute_map
73
- end
74
-
75
- # Returns all the JSON keys this model knows about
76
- def self.acceptable_attributes
77
- acceptable_attribute_map.values
78
- end
79
-
80
- # Attribute type mapping.
81
- def self.openapi_types
82
- {
83
- :'schema_version' => :'Integer',
84
- :'snapshot' => :'Hash<String, Object>',
85
- :'provider' => :'Hash<String, Object>',
86
- :'service' => :'Hash<String, Object>',
87
- :'operation' => :'Hash<String, Object>',
88
- :'request' => :'Hash<String, Object>',
89
- :'access_methods' => :'Array<Hash<String, Object>>',
90
- :'evidence' => :'Array<Hash<String, Object>>'
91
- }
92
- end
93
-
94
- # List of attributes with nullable: true
95
- def self.openapi_nullable
96
- Set.new([
97
- ])
98
- end
99
-
100
- # Initializes the object
101
- # @param [Hash] attributes Model attributes in the form of hash
102
- def initialize(attributes = {})
103
- if (!attributes.is_a?(Hash))
104
- fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::CuratedMarketplaceContract` initialize method"
105
- end
106
-
107
- # check to see if the attribute exists and convert string to symbol for hash key
108
- acceptable_attribute_map = self.class.acceptable_attribute_map
109
- attributes = attributes.each_with_object({}) { |(k, v), h|
110
- if (!acceptable_attribute_map.key?(k.to_sym))
111
- fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::CuratedMarketplaceContract`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
112
- end
113
- h[k.to_sym] = v
114
- }
115
-
116
- if attributes.key?(:'schema_version')
117
- self.schema_version = attributes[:'schema_version']
118
- else
119
- self.schema_version = nil
120
- end
121
-
122
- if attributes.key?(:'snapshot')
123
- if (value = attributes[:'snapshot']).is_a?(Hash)
124
- self.snapshot = value
125
- end
126
- else
127
- self.snapshot = nil
128
- end
129
-
130
- if attributes.key?(:'provider')
131
- if (value = attributes[:'provider']).is_a?(Hash)
132
- self.provider = value
133
- end
134
- else
135
- self.provider = nil
136
- end
137
-
138
- if attributes.key?(:'service')
139
- if (value = attributes[:'service']).is_a?(Hash)
140
- self.service = value
141
- end
142
- else
143
- self.service = nil
144
- end
145
-
146
- if attributes.key?(:'operation')
147
- if (value = attributes[:'operation']).is_a?(Hash)
148
- self.operation = value
149
- end
150
- else
151
- self.operation = nil
152
- end
153
-
154
- if attributes.key?(:'request')
155
- if (value = attributes[:'request']).is_a?(Hash)
156
- self.request = value
157
- end
158
- else
159
- self.request = nil
160
- end
161
-
162
- if attributes.key?(:'access_methods')
163
- if (value = attributes[:'access_methods']).is_a?(Array)
164
- self.access_methods = value
165
- end
166
- else
167
- self.access_methods = nil
168
- end
169
-
170
- if attributes.key?(:'evidence')
171
- if (value = attributes[:'evidence']).is_a?(Array)
172
- self.evidence = value
173
- end
174
- else
175
- self.evidence = nil
176
- end
177
- end
178
-
179
- # Show invalid properties with the reasons. Usually used together with valid?
180
- # @return Array for valid properties with the reasons
181
- def list_invalid_properties
182
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
183
- invalid_properties = Array.new
184
- if @schema_version.nil?
185
- invalid_properties.push('invalid value for "schema_version", schema_version cannot be nil.')
186
- end
187
-
188
- if @snapshot.nil?
189
- invalid_properties.push('invalid value for "snapshot", snapshot cannot be nil.')
190
- end
191
-
192
- if @provider.nil?
193
- invalid_properties.push('invalid value for "provider", provider cannot be nil.')
194
- end
195
-
196
- if @service.nil?
197
- invalid_properties.push('invalid value for "service", service cannot be nil.')
198
- end
199
-
200
- if @operation.nil?
201
- invalid_properties.push('invalid value for "operation", operation cannot be nil.')
202
- end
203
-
204
- if @request.nil?
205
- invalid_properties.push('invalid value for "request", request cannot be nil.')
206
- end
207
-
208
- if @access_methods.nil?
209
- invalid_properties.push('invalid value for "access_methods", access_methods cannot be nil.')
210
- end
211
-
212
- if @evidence.nil?
213
- invalid_properties.push('invalid value for "evidence", evidence cannot be nil.')
214
- end
215
-
216
- invalid_properties
217
- end
218
-
219
- # Check to see if the all the properties in the model are valid
220
- # @return true if the model is valid
221
- def valid?
222
- warn '[DEPRECATED] the `valid?` method is obsolete'
223
- return false if @schema_version.nil?
224
- schema_version_validator = EnumAttributeValidator.new('Integer', [1])
225
- return false unless schema_version_validator.valid?(@schema_version)
226
- return false if @snapshot.nil?
227
- return false if @provider.nil?
228
- return false if @service.nil?
229
- return false if @operation.nil?
230
- return false if @request.nil?
231
- return false if @access_methods.nil?
232
- return false if @evidence.nil?
233
- true
234
- end
235
-
236
- # Custom attribute writer method checking allowed values (enum).
237
- # @param [Object] schema_version Object to be assigned
238
- def schema_version=(schema_version)
239
- validator = EnumAttributeValidator.new('Integer', [1])
240
- unless validator.valid?(schema_version)
241
- fail ArgumentError, "invalid value for \"schema_version\", must be one of #{validator.allowable_values}."
242
- end
243
- @schema_version = schema_version
244
- end
245
-
246
- # Custom attribute writer method with validation
247
- # @param [Object] snapshot Value to be assigned
248
- def snapshot=(snapshot)
249
- if snapshot.nil?
250
- fail ArgumentError, 'snapshot cannot be nil'
251
- end
252
-
253
- @snapshot = snapshot
254
- end
255
-
256
- # Custom attribute writer method with validation
257
- # @param [Object] provider Value to be assigned
258
- def provider=(provider)
259
- if provider.nil?
260
- fail ArgumentError, 'provider cannot be nil'
261
- end
262
-
263
- @provider = provider
264
- end
265
-
266
- # Custom attribute writer method with validation
267
- # @param [Object] service Value to be assigned
268
- def service=(service)
269
- if service.nil?
270
- fail ArgumentError, 'service cannot be nil'
271
- end
272
-
273
- @service = service
274
- end
275
-
276
- # Custom attribute writer method with validation
277
- # @param [Object] operation Value to be assigned
278
- def operation=(operation)
279
- if operation.nil?
280
- fail ArgumentError, 'operation cannot be nil'
281
- end
282
-
283
- @operation = operation
284
- end
285
-
286
- # Custom attribute writer method with validation
287
- # @param [Object] request Value to be assigned
288
- def request=(request)
289
- if request.nil?
290
- fail ArgumentError, 'request cannot be nil'
291
- end
292
-
293
- @request = request
294
- end
295
-
296
- # Custom attribute writer method with validation
297
- # @param [Object] access_methods Value to be assigned
298
- def access_methods=(access_methods)
299
- if access_methods.nil?
300
- fail ArgumentError, 'access_methods cannot be nil'
301
- end
302
-
303
- @access_methods = access_methods
304
- end
305
-
306
- # Custom attribute writer method with validation
307
- # @param [Object] evidence Value to be assigned
308
- def evidence=(evidence)
309
- if evidence.nil?
310
- fail ArgumentError, 'evidence cannot be nil'
311
- end
312
-
313
- @evidence = evidence
314
- end
315
-
316
- # Checks equality by comparing each attribute.
317
- # @param [Object] Object to be compared
318
- def ==(o)
319
- return true if self.equal?(o)
320
- self.class == o.class &&
321
- schema_version == o.schema_version &&
322
- snapshot == o.snapshot &&
323
- provider == o.provider &&
324
- service == o.service &&
325
- operation == o.operation &&
326
- request == o.request &&
327
- access_methods == o.access_methods &&
328
- evidence == o.evidence
329
- end
330
-
331
- # @see the `==` method
332
- # @param [Object] Object to be compared
333
- def eql?(o)
334
- self == o
335
- end
336
-
337
- # Calculates hash code according to all attributes.
338
- # @return [Integer] Hash code
339
- def hash
340
- [schema_version, snapshot, provider, service, operation, request, access_methods, evidence].hash
341
- end
342
-
343
- # Builds the object from hash
344
- # @param [Hash] attributes Model attributes in the form of hash
345
- # @return [Object] Returns the model itself
346
- def self.build_from_hash(attributes)
347
- return nil unless attributes.is_a?(Hash)
348
- attributes = attributes.transform_keys(&:to_sym)
349
- transformed_hash = {}
350
- openapi_types.each_pair do |key, type|
351
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
352
- transformed_hash["#{key}"] = nil
353
- elsif type =~ /\AArray<(.*)>/i
354
- # check to ensure the input is an array given that the attribute
355
- # is documented as an array but the input is not
356
- if attributes[attribute_map[key]].is_a?(Array)
357
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
358
- end
359
- elsif !attributes[attribute_map[key]].nil?
360
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
361
- end
362
- end
363
- new(transformed_hash)
364
- end
365
-
366
- # Returns the object in the form of hash
367
- # @return [Hash] Returns the object in the form of hash
368
- def to_hash
369
- hash = {}
370
- self.class.attribute_map.each_pair do |attr, param|
371
- value = self.send(attr)
372
- if value.nil?
373
- is_nullable = self.class.openapi_nullable.include?(attr)
374
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
375
- end
376
-
377
- hash[param] = _to_hash(value)
378
- end
379
- hash
380
- end
381
-
382
- end
383
-
384
- end
@@ -1,264 +0,0 @@
1
- =begin
2
- #Weft API
3
-
4
- #The Weft API powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and third-party applications that discover and pay for resources on Weft. The buyer runtime covers six concerns: 1. Account creation and recovery (`/api/v1/auth/*`) 2. Credential identity (`/api/v1/me`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/purchases`) Buyer runtime calls require a dashboard-created `wk_*` account key, an OAuth access token with the relevant scope, or a claimed `wbt_*` bearer on its fixed allowlist. The organization-scoped API key and payment operations in this document are seller administration surfaces and require an `ax_live_*` resource key. These credential types are not interchangeable. This document is a deliberate subset of the `/api/v1` surface, not an inventory of it. The seller-side management endpoints — `/api/v1/agents`, `/api/v1/webhook_endpoints`, and `/api/v1/analytics` — are reachable with an `ax_live_*` key but are intentionally left undocumented: they are dashboard-facing and not part of the published client contract. Nothing outside this document is a supported contract, and the response-validation gate in `config/environments/test.rb` enforces only what is declared here. Before claim, a `wbt_*` bearer is temporary and permits only search plus its own status/cancel operations for 30 minutes. Human approval binds it to the User and promotes the same secret to durable identity, search, balance, fetch, purchase-history, status, and revocation capabilities. It remains valid until revoked. Seller, organization, API-key administration, dashboard-session, transfer, withdrawal, and MCP surfaces always refuse it. Bootstrap lifecycle successes follow the API-standard `{ \"data\": ... }` envelope. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
-
6
- The version of the OpenAPI document: 0.23.2
7
-
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.19.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Weft
17
- class Merchant < ApiModelBase
18
- # EVM address that received the payment.
19
- attr_accessor :address
20
-
21
- # All-time settlement count for this merchant address.
22
- attr_accessor :settlement_count
23
-
24
- # First time Weft observed a payment to this address.
25
- attr_accessor :first_seen_at
26
-
27
- # All-time dispute count for this merchant address.
28
- attr_accessor :dispute_count
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'address' => :'address',
34
- :'settlement_count' => :'settlement_count',
35
- :'first_seen_at' => :'first_seen_at',
36
- :'dispute_count' => :'dispute_count'
37
- }
38
- end
39
-
40
- # Returns attribute mapping this model knows about
41
- def self.acceptable_attribute_map
42
- attribute_map
43
- end
44
-
45
- # Returns all the JSON keys this model knows about
46
- def self.acceptable_attributes
47
- acceptable_attribute_map.values
48
- end
49
-
50
- # Attribute type mapping.
51
- def self.openapi_types
52
- {
53
- :'address' => :'String',
54
- :'settlement_count' => :'Integer',
55
- :'first_seen_at' => :'Time',
56
- :'dispute_count' => :'Integer'
57
- }
58
- end
59
-
60
- # List of attributes with nullable: true
61
- def self.openapi_nullable
62
- Set.new([
63
- ])
64
- end
65
-
66
- # Initializes the object
67
- # @param [Hash] attributes Model attributes in the form of hash
68
- def initialize(attributes = {})
69
- if (!attributes.is_a?(Hash))
70
- fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::Merchant` initialize method"
71
- end
72
-
73
- # check to see if the attribute exists and convert string to symbol for hash key
74
- acceptable_attribute_map = self.class.acceptable_attribute_map
75
- attributes = attributes.each_with_object({}) { |(k, v), h|
76
- if (!acceptable_attribute_map.key?(k.to_sym))
77
- fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::Merchant`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
- end
79
- h[k.to_sym] = v
80
- }
81
-
82
- if attributes.key?(:'address')
83
- self.address = attributes[:'address']
84
- else
85
- self.address = nil
86
- end
87
-
88
- if attributes.key?(:'settlement_count')
89
- self.settlement_count = attributes[:'settlement_count']
90
- else
91
- self.settlement_count = nil
92
- end
93
-
94
- if attributes.key?(:'first_seen_at')
95
- self.first_seen_at = attributes[:'first_seen_at']
96
- else
97
- self.first_seen_at = nil
98
- end
99
-
100
- if attributes.key?(:'dispute_count')
101
- self.dispute_count = attributes[:'dispute_count']
102
- else
103
- self.dispute_count = nil
104
- end
105
- end
106
-
107
- # Show invalid properties with the reasons. Usually used together with valid?
108
- # @return Array for valid properties with the reasons
109
- def list_invalid_properties
110
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
- invalid_properties = Array.new
112
- if @address.nil?
113
- invalid_properties.push('invalid value for "address", address cannot be nil.')
114
- end
115
-
116
- if @settlement_count.nil?
117
- invalid_properties.push('invalid value for "settlement_count", settlement_count cannot be nil.')
118
- end
119
-
120
- if @settlement_count < 0
121
- invalid_properties.push('invalid value for "settlement_count", must be greater than or equal to 0.')
122
- end
123
-
124
- if @first_seen_at.nil?
125
- invalid_properties.push('invalid value for "first_seen_at", first_seen_at cannot be nil.')
126
- end
127
-
128
- if @dispute_count.nil?
129
- invalid_properties.push('invalid value for "dispute_count", dispute_count cannot be nil.')
130
- end
131
-
132
- if @dispute_count < 0
133
- invalid_properties.push('invalid value for "dispute_count", must be greater than or equal to 0.')
134
- end
135
-
136
- invalid_properties
137
- end
138
-
139
- # Check to see if the all the properties in the model are valid
140
- # @return true if the model is valid
141
- def valid?
142
- warn '[DEPRECATED] the `valid?` method is obsolete'
143
- return false if @address.nil?
144
- return false if @settlement_count.nil?
145
- return false if @settlement_count < 0
146
- return false if @first_seen_at.nil?
147
- return false if @dispute_count.nil?
148
- return false if @dispute_count < 0
149
- true
150
- end
151
-
152
- # Custom attribute writer method with validation
153
- # @param [Object] address Value to be assigned
154
- def address=(address)
155
- if address.nil?
156
- fail ArgumentError, 'address cannot be nil'
157
- end
158
-
159
- @address = address
160
- end
161
-
162
- # Custom attribute writer method with validation
163
- # @param [Object] settlement_count Value to be assigned
164
- def settlement_count=(settlement_count)
165
- if settlement_count.nil?
166
- fail ArgumentError, 'settlement_count cannot be nil'
167
- end
168
-
169
- if settlement_count < 0
170
- fail ArgumentError, 'invalid value for "settlement_count", must be greater than or equal to 0.'
171
- end
172
-
173
- @settlement_count = settlement_count
174
- end
175
-
176
- # Custom attribute writer method with validation
177
- # @param [Object] first_seen_at Value to be assigned
178
- def first_seen_at=(first_seen_at)
179
- if first_seen_at.nil?
180
- fail ArgumentError, 'first_seen_at cannot be nil'
181
- end
182
-
183
- @first_seen_at = first_seen_at
184
- end
185
-
186
- # Custom attribute writer method with validation
187
- # @param [Object] dispute_count Value to be assigned
188
- def dispute_count=(dispute_count)
189
- if dispute_count.nil?
190
- fail ArgumentError, 'dispute_count cannot be nil'
191
- end
192
-
193
- if dispute_count < 0
194
- fail ArgumentError, 'invalid value for "dispute_count", must be greater than or equal to 0.'
195
- end
196
-
197
- @dispute_count = dispute_count
198
- end
199
-
200
- # Checks equality by comparing each attribute.
201
- # @param [Object] Object to be compared
202
- def ==(o)
203
- return true if self.equal?(o)
204
- self.class == o.class &&
205
- address == o.address &&
206
- settlement_count == o.settlement_count &&
207
- first_seen_at == o.first_seen_at &&
208
- dispute_count == o.dispute_count
209
- end
210
-
211
- # @see the `==` method
212
- # @param [Object] Object to be compared
213
- def eql?(o)
214
- self == o
215
- end
216
-
217
- # Calculates hash code according to all attributes.
218
- # @return [Integer] Hash code
219
- def hash
220
- [address, settlement_count, first_seen_at, dispute_count].hash
221
- end
222
-
223
- # Builds the object from hash
224
- # @param [Hash] attributes Model attributes in the form of hash
225
- # @return [Object] Returns the model itself
226
- def self.build_from_hash(attributes)
227
- return nil unless attributes.is_a?(Hash)
228
- attributes = attributes.transform_keys(&:to_sym)
229
- transformed_hash = {}
230
- openapi_types.each_pair do |key, type|
231
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
232
- transformed_hash["#{key}"] = nil
233
- elsif type =~ /\AArray<(.*)>/i
234
- # check to ensure the input is an array given that the attribute
235
- # is documented as an array but the input is not
236
- if attributes[attribute_map[key]].is_a?(Array)
237
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
238
- end
239
- elsif !attributes[attribute_map[key]].nil?
240
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
241
- end
242
- end
243
- new(transformed_hash)
244
- end
245
-
246
- # Returns the object in the form of hash
247
- # @return [Hash] Returns the object in the form of hash
248
- def to_hash
249
- hash = {}
250
- self.class.attribute_map.each_pair do |attr, param|
251
- value = self.send(attr)
252
- if value.nil?
253
- is_nullable = self.class.openapi_nullable.include?(attr)
254
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
- end
256
-
257
- hash[param] = _to_hash(value)
258
- end
259
- hash
260
- end
261
-
262
- end
263
-
264
- end