weft-sdk 0.9.1 → 0.14.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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/docs/APIKeysApi.md +4 -0
  3. data/docs/AccountApi.md +1 -1
  4. data/docs/AccountBootstrapApproval.md +21 -0
  5. data/docs/AccountBootstrapCreated.md +29 -0
  6. data/docs/AccountBootstrapCreatedApproval.md +23 -0
  7. data/docs/AccountBootstrapCreatedResponse.md +17 -0
  8. data/docs/AccountBootstrapRequest.md +27 -0
  9. data/docs/AccountBootstrapStatus.md +25 -0
  10. data/docs/AccountBootstrapStatusResponse.md +17 -0
  11. data/docs/AgentBootstrapApi.md +209 -0
  12. data/docs/BalanceApi.md +1 -1
  13. data/docs/CuratedMarketplaceContract.md +31 -0
  14. data/docs/FetchApi.md +1 -1
  15. data/docs/FetchBalanceSnapshot.md +1 -1
  16. data/docs/FetchRequest.md +7 -1
  17. data/docs/RateLimitResponse.md +19 -0
  18. data/docs/SearchAccessMethod.md +37 -0
  19. data/docs/SearchApi.md +68 -1
  20. data/docs/SearchCuratedCallability.md +19 -0
  21. data/docs/SearchCuratedExecution.md +17 -0
  22. data/docs/SearchCuratedOperation.md +21 -0
  23. data/docs/SearchCuratedService.md +19 -0
  24. data/docs/SearchCuratedSource.md +21 -0
  25. data/docs/SearchEndpointHit.md +18 -0
  26. data/docs/SearchExecutionModeFilter.md +19 -0
  27. data/docs/SearchFilterSpec.md +11 -1
  28. data/docs/SearchMethodFilter.md +19 -0
  29. data/docs/SearchResponse.md +1 -3
  30. data/docs/SearchStringSetFilter.md +19 -0
  31. data/docs/SearchWeftFetchCompatibility.md +21 -0
  32. data/docs/Wallet.md +7 -3
  33. data/lib/weft/generated/api/account_api.rb +4 -4
  34. data/lib/weft/generated/api/agent_bootstrap_api.rb +224 -0
  35. data/lib/weft/generated/api/api_keys_api.rb +6 -2
  36. data/lib/weft/generated/api/auth_api.rb +2 -2
  37. data/lib/weft/generated/api/balance_api.rb +4 -4
  38. data/lib/weft/generated/api/default_api.rb +2 -2
  39. data/lib/weft/generated/api/fetch_api.rb +4 -4
  40. data/lib/weft/generated/api/payments_api.rb +2 -2
  41. data/lib/weft/generated/api/purchases_api.rb +2 -2
  42. data/lib/weft/generated/api/resources_api.rb +2 -2
  43. data/lib/weft/generated/api/search_api.rb +83 -4
  44. data/lib/weft/generated/api_client.rb +2 -2
  45. data/lib/weft/generated/api_error.rb +2 -2
  46. data/lib/weft/generated/api_model_base.rb +2 -2
  47. data/lib/weft/generated/configuration.rb +10 -10
  48. data/lib/weft/generated/models/account_bootstrap_approval.rb +259 -0
  49. data/lib/weft/generated/models/account_bootstrap_created.rb +349 -0
  50. data/lib/weft/generated/models/account_bootstrap_created_approval.rb +297 -0
  51. data/lib/weft/generated/models/account_bootstrap_created_response.rb +164 -0
  52. data/lib/weft/generated/models/account_bootstrap_request.rb +317 -0
  53. data/lib/weft/generated/models/account_bootstrap_status.rb +282 -0
  54. data/lib/weft/generated/models/account_bootstrap_status_response.rb +164 -0
  55. data/lib/weft/generated/models/account_details.rb +2 -2
  56. data/lib/weft/generated/models/api_key.rb +2 -2
  57. data/lib/weft/generated/models/api_key_created.rb +2 -2
  58. data/lib/weft/generated/models/api_key_created_response.rb +2 -2
  59. data/lib/weft/generated/models/api_key_list_response.rb +2 -2
  60. data/lib/weft/generated/models/auth_response.rb +2 -2
  61. data/lib/weft/generated/models/auth_response_data.rb +2 -2
  62. data/lib/weft/generated/models/balance_response.rb +2 -2
  63. data/lib/weft/generated/models/confirm_request.rb +2 -2
  64. data/lib/weft/generated/models/create_api_key_request.rb +2 -2
  65. data/lib/weft/generated/models/curated_marketplace_contract.rb +384 -0
  66. data/lib/weft/generated/models/enrolled_resource.rb +2 -2
  67. data/lib/weft/generated/models/error.rb +2 -2
  68. data/lib/weft/generated/models/error_response.rb +2 -2
  69. data/lib/weft/generated/models/fetch403_response.rb +2 -2
  70. data/lib/weft/generated/models/fetch_balance_snapshot.rb +3 -3
  71. data/lib/weft/generated/models/fetch_error_response.rb +4 -4
  72. data/lib/weft/generated/models/fetch_request.rb +36 -6
  73. data/lib/weft/generated/models/fetch_request_body.rb +2 -2
  74. data/lib/weft/generated/models/fetch_response.rb +2 -2
  75. data/lib/weft/generated/models/insufficient_scope_response.rb +2 -2
  76. data/lib/weft/generated/models/me_api_key.rb +2 -2
  77. data/lib/weft/generated/models/me_api_key_creator.rb +2 -2
  78. data/lib/weft/generated/models/me_response.rb +2 -2
  79. data/lib/weft/generated/models/me_response_data.rb +2 -2
  80. data/lib/weft/generated/models/merchant.rb +2 -2
  81. data/lib/weft/generated/models/message_response.rb +2 -2
  82. data/lib/weft/generated/models/message_response_data.rb +2 -2
  83. data/lib/weft/generated/models/pagination.rb +2 -2
  84. data/lib/weft/generated/models/password_reset_request.rb +2 -2
  85. data/lib/weft/generated/models/password_update_request.rb +2 -2
  86. data/lib/weft/generated/models/payment.rb +2 -2
  87. data/lib/weft/generated/models/payment_list_response.rb +2 -2
  88. data/lib/weft/generated/models/payment_response.rb +2 -2
  89. data/lib/weft/generated/models/principal_wallet.rb +2 -2
  90. data/lib/weft/generated/models/promo_balance.rb +2 -2
  91. data/lib/weft/generated/models/purchase.rb +2 -2
  92. data/lib/weft/generated/models/purchase_artifact.rb +2 -2
  93. data/lib/weft/generated/models/purchase_list_response.rb +2 -2
  94. data/lib/weft/generated/models/purchase_response.rb +2 -2
  95. data/lib/weft/generated/models/rate_limit_response.rb +214 -0
  96. data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
  97. data/lib/weft/generated/models/resource_enrollment_request.rb +2 -2
  98. data/lib/weft/generated/models/resource_enrollment_response.rb +2 -2
  99. data/lib/weft/generated/models/resource_stats.rb +2 -2
  100. data/lib/weft/generated/models/search_access_method.rb +341 -0
  101. data/lib/weft/generated/models/search_capability_ref.rb +2 -2
  102. data/lib/weft/generated/models/search_curated_callability.rb +216 -0
  103. data/lib/weft/generated/models/search_curated_execution.rb +181 -0
  104. data/lib/weft/generated/models/search_curated_operation.rb +199 -0
  105. data/lib/weft/generated/models/search_curated_service.rb +190 -0
  106. data/lib/weft/generated/models/search_curated_source.rb +240 -0
  107. data/lib/weft/generated/models/search_endpoint_call.rb +2 -2
  108. data/lib/weft/generated/models/search_endpoint_hit.rb +86 -3
  109. data/lib/weft/generated/models/search_endpoint_price.rb +2 -2
  110. data/lib/weft/generated/models/search_error_response.rb +2 -2
  111. data/lib/weft/generated/models/search_execution_mode_filter.rb +197 -0
  112. data/lib/weft/generated/models/search_filter_spec.rb +55 -6
  113. data/lib/weft/generated/models/search_method_filter.rb +197 -0
  114. data/lib/weft/generated/models/search_payment_offer.rb +2 -2
  115. data/lib/weft/generated/models/search_price_atomic_filter.rb +2 -2
  116. data/lib/weft/generated/models/search_price_usd_filter.rb +2 -2
  117. data/lib/weft/generated/models/search_protocol_filter.rb +2 -2
  118. data/lib/weft/generated/models/search_provider_ref.rb +2 -2
  119. data/lib/weft/generated/models/search_request.rb +2 -2
  120. data/lib/weft/generated/models/search_resource_type_filter.rb +2 -2
  121. data/lib/weft/generated/models/search_response.rb +7 -17
  122. data/lib/weft/generated/models/search_response_warnings_inner.rb +2 -2
  123. data/lib/weft/generated/models/search_result.rb +2 -2
  124. data/lib/weft/generated/models/search_string_set_filter.rb +177 -0
  125. data/lib/weft/generated/models/search_weft_fetch_compatibility.rb +240 -0
  126. data/lib/weft/generated/models/sign_in_request.rb +2 -2
  127. data/lib/weft/generated/models/sign_up_request.rb +2 -2
  128. data/lib/weft/generated/models/spending_policy.rb +2 -2
  129. data/lib/weft/generated/models/user.rb +2 -2
  130. data/lib/weft/generated/models/user_principal.rb +2 -2
  131. data/lib/weft/generated/models/wallet.rb +84 -6
  132. data/lib/weft/generated/version.rb +3 -3
  133. data/lib/weft/sdk.rb +1 -1
  134. metadata +42 -2
@@ -0,0 +1,164 @@
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. 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.14.1
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 AccountBootstrapCreatedResponse < 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' => :'AccountBootstrapCreated'
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 `Weft::AccountBootstrapCreatedResponse` 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 `Weft::AccountBootstrapCreatedResponse`. 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
+ self.data = attributes[:'data']
68
+ else
69
+ self.data = 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 @data.nil?
79
+ invalid_properties.push('invalid value for "data", data 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 @data.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] data Value to be assigned
95
+ def data=(data)
96
+ if data.nil?
97
+ fail ArgumentError, 'data cannot be nil'
98
+ end
99
+
100
+ @data = data
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
+ data == o.data
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
+ [data].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,317 @@
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. 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.14.1
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 AccountBootstrapRequest < ApiModelBase
18
+ attr_accessor :email
19
+
20
+ attr_accessor :agent_name
21
+
22
+ attr_accessor :host_name
23
+
24
+ attr_accessor :reason
25
+
26
+ # Transitional compatibility for older CLI releases that use OAuth device exchange.
27
+ attr_accessor :oauth_client_id
28
+
29
+ # Transitional compatibility for older CLI releases that use OAuth device exchange.
30
+ attr_accessor :requested_scopes
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'email' => :'email',
58
+ :'agent_name' => :'agent_name',
59
+ :'host_name' => :'host_name',
60
+ :'reason' => :'reason',
61
+ :'oauth_client_id' => :'oauth_client_id',
62
+ :'requested_scopes' => :'requested_scopes'
63
+ }
64
+ end
65
+
66
+ # Returns attribute mapping this model knows about
67
+ def self.acceptable_attribute_map
68
+ attribute_map
69
+ end
70
+
71
+ # Returns all the JSON keys this model knows about
72
+ def self.acceptable_attributes
73
+ acceptable_attribute_map.values
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'email' => :'String',
80
+ :'agent_name' => :'String',
81
+ :'host_name' => :'String',
82
+ :'reason' => :'String',
83
+ :'oauth_client_id' => :'String',
84
+ :'requested_scopes' => :'Array<String>'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::AccountBootstrapRequest` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::AccountBootstrapRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'email')
111
+ self.email = attributes[:'email']
112
+ else
113
+ self.email = nil
114
+ end
115
+
116
+ if attributes.key?(:'agent_name')
117
+ self.agent_name = attributes[:'agent_name']
118
+ else
119
+ self.agent_name = nil
120
+ end
121
+
122
+ if attributes.key?(:'host_name')
123
+ self.host_name = attributes[:'host_name']
124
+ end
125
+
126
+ if attributes.key?(:'reason')
127
+ self.reason = attributes[:'reason']
128
+ end
129
+
130
+ if attributes.key?(:'oauth_client_id')
131
+ self.oauth_client_id = attributes[:'oauth_client_id']
132
+ end
133
+
134
+ if attributes.key?(:'requested_scopes')
135
+ if (value = attributes[:'requested_scopes']).is_a?(Array)
136
+ self.requested_scopes = value
137
+ end
138
+ end
139
+ end
140
+
141
+ # Show invalid properties with the reasons. Usually used together with valid?
142
+ # @return Array for valid properties with the reasons
143
+ def list_invalid_properties
144
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
145
+ invalid_properties = Array.new
146
+ if @email.nil?
147
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
148
+ end
149
+
150
+ if @email.to_s.length > 320
151
+ invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 320.')
152
+ end
153
+
154
+ if @agent_name.nil?
155
+ invalid_properties.push('invalid value for "agent_name", agent_name cannot be nil.')
156
+ end
157
+
158
+ if @agent_name.to_s.length > 100
159
+ invalid_properties.push('invalid value for "agent_name", the character length must be smaller than or equal to 100.')
160
+ end
161
+
162
+ if @agent_name.to_s.length < 1
163
+ invalid_properties.push('invalid value for "agent_name", the character length must be greater than or equal to 1.')
164
+ end
165
+
166
+ if !@host_name.nil? && @host_name.to_s.length > 100
167
+ invalid_properties.push('invalid value for "host_name", the character length must be smaller than or equal to 100.')
168
+ end
169
+
170
+ if !@reason.nil? && @reason.to_s.length > 500
171
+ invalid_properties.push('invalid value for "reason", the character length must be smaller than or equal to 500.')
172
+ end
173
+
174
+ invalid_properties
175
+ end
176
+
177
+ # Check to see if the all the properties in the model are valid
178
+ # @return true if the model is valid
179
+ def valid?
180
+ warn '[DEPRECATED] the `valid?` method is obsolete'
181
+ return false if @email.nil?
182
+ return false if @email.to_s.length > 320
183
+ return false if @agent_name.nil?
184
+ return false if @agent_name.to_s.length > 100
185
+ return false if @agent_name.to_s.length < 1
186
+ return false if !@host_name.nil? && @host_name.to_s.length > 100
187
+ return false if !@reason.nil? && @reason.to_s.length > 500
188
+ true
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] email Value to be assigned
193
+ def email=(email)
194
+ if email.nil?
195
+ fail ArgumentError, 'email cannot be nil'
196
+ end
197
+
198
+ if email.to_s.length > 320
199
+ fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 320.'
200
+ end
201
+
202
+ @email = email
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] agent_name Value to be assigned
207
+ def agent_name=(agent_name)
208
+ if agent_name.nil?
209
+ fail ArgumentError, 'agent_name cannot be nil'
210
+ end
211
+
212
+ if agent_name.to_s.length > 100
213
+ fail ArgumentError, 'invalid value for "agent_name", the character length must be smaller than or equal to 100.'
214
+ end
215
+
216
+ if agent_name.to_s.length < 1
217
+ fail ArgumentError, 'invalid value for "agent_name", the character length must be greater than or equal to 1.'
218
+ end
219
+
220
+ @agent_name = agent_name
221
+ end
222
+
223
+ # Custom attribute writer method with validation
224
+ # @param [Object] host_name Value to be assigned
225
+ def host_name=(host_name)
226
+ if host_name.nil?
227
+ fail ArgumentError, 'host_name cannot be nil'
228
+ end
229
+
230
+ if host_name.to_s.length > 100
231
+ fail ArgumentError, 'invalid value for "host_name", the character length must be smaller than or equal to 100.'
232
+ end
233
+
234
+ @host_name = host_name
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] reason Value to be assigned
239
+ def reason=(reason)
240
+ if reason.nil?
241
+ fail ArgumentError, 'reason cannot be nil'
242
+ end
243
+
244
+ if reason.to_s.length > 500
245
+ fail ArgumentError, 'invalid value for "reason", the character length must be smaller than or equal to 500.'
246
+ end
247
+
248
+ @reason = reason
249
+ end
250
+
251
+ # Checks equality by comparing each attribute.
252
+ # @param [Object] Object to be compared
253
+ def ==(o)
254
+ return true if self.equal?(o)
255
+ self.class == o.class &&
256
+ email == o.email &&
257
+ agent_name == o.agent_name &&
258
+ host_name == o.host_name &&
259
+ reason == o.reason &&
260
+ oauth_client_id == o.oauth_client_id &&
261
+ requested_scopes == o.requested_scopes
262
+ end
263
+
264
+ # @see the `==` method
265
+ # @param [Object] Object to be compared
266
+ def eql?(o)
267
+ self == o
268
+ end
269
+
270
+ # Calculates hash code according to all attributes.
271
+ # @return [Integer] Hash code
272
+ def hash
273
+ [email, agent_name, host_name, reason, oauth_client_id, requested_scopes].hash
274
+ end
275
+
276
+ # Builds the object from hash
277
+ # @param [Hash] attributes Model attributes in the form of hash
278
+ # @return [Object] Returns the model itself
279
+ def self.build_from_hash(attributes)
280
+ return nil unless attributes.is_a?(Hash)
281
+ attributes = attributes.transform_keys(&:to_sym)
282
+ transformed_hash = {}
283
+ openapi_types.each_pair do |key, type|
284
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
285
+ transformed_hash["#{key}"] = nil
286
+ elsif type =~ /\AArray<(.*)>/i
287
+ # check to ensure the input is an array given that the attribute
288
+ # is documented as an array but the input is not
289
+ if attributes[attribute_map[key]].is_a?(Array)
290
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
291
+ end
292
+ elsif !attributes[attribute_map[key]].nil?
293
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
294
+ end
295
+ end
296
+ new(transformed_hash)
297
+ end
298
+
299
+ # Returns the object in the form of hash
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_hash
302
+ hash = {}
303
+ self.class.attribute_map.each_pair do |attr, param|
304
+ value = self.send(attr)
305
+ if value.nil?
306
+ is_nullable = self.class.openapi_nullable.include?(attr)
307
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
308
+ end
309
+
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ end
316
+
317
+ end