stage-ruby 0.0.02 → 0.0.04
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.
- checksums.yaml +4 -4
- data/README.md +46 -14
- data/docs/ClientUserObjectForm.md +3 -0
- data/docs/FeatureObjectForm.md +11 -0
- data/docs/PlanObjectForm.md +12 -0
- data/docs/StageApi.md +199 -12
- data/docs/StageUserObjectForm.md +17 -0
- data/lib/.DS_Store +0 -0
- data/lib/stage-ruby/.DS_Store +0 -0
- data/lib/stage-ruby/api/stage_api.rb +203 -3
- data/lib/stage-ruby/configuration.rb +7 -0
- data/lib/stage-ruby/models/client_user_object_form.rb +33 -4
- data/lib/stage-ruby/models/feature_object_form.rb +247 -0
- data/lib/stage-ruby/models/plan_object_form.rb +259 -0
- data/lib/stage-ruby/models/stage_user_object_form.rb +296 -0
- data/lib/stage-ruby/utils.rb +2 -0
- data/lib/stage-ruby/version.rb +1 -1
- data/lib/stage-ruby.rb +3 -0
- data/spec/.DS_Store +0 -0
- data/spec/api/stage_api_spec.rb +13 -2
- data/spec/models/client_user_object_form_spec.rb +6 -0
- data/spec/models/feature_object_form_spec.rb +64 -0
- data/spec/models/plan_object_form_spec.rb +70 -0
- data/spec/models/stage_user_object_form_spec.rb +64 -0
- data/stage-ruby-0.0.02.gem +0 -0
- data/stage-ruby-0.0.03.gem +0 -0
- metadata +19 -2
@@ -84,6 +84,54 @@ module Stage
|
|
84
84
|
return data, status_code, headers
|
85
85
|
end
|
86
86
|
|
87
|
+
# Gets all plans.
|
88
|
+
# @return [Array<PlanObjectForm>]
|
89
|
+
def get_plans()
|
90
|
+
data, _status_code, _headers = get_plans_with_http_info({})
|
91
|
+
data
|
92
|
+
end
|
93
|
+
|
94
|
+
# Gets all plans.
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [Array<(Array<PlanObjectForm>, Integer, Hash)>] Array<PlanObjectForm> data, response status code and response headers
|
97
|
+
def get_plans_with_http_info(opts = {})
|
98
|
+
if @api_client.config.debugging
|
99
|
+
@api_client.config.logger.debug 'Calling API: StageApi.get_plans ...'
|
100
|
+
end
|
101
|
+
# resource path
|
102
|
+
local_var_path = PLANS_PATH
|
103
|
+
|
104
|
+
# query parameters
|
105
|
+
query_params = opts[:query_params] || {}
|
106
|
+
|
107
|
+
# header parameters
|
108
|
+
header_params = opts[:header_params] || {}
|
109
|
+
# HTTP header 'Accept' (if needed)
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
|
+
|
112
|
+
# form parameters
|
113
|
+
form_params = opts[:form_params] || {}
|
114
|
+
|
115
|
+
# http body (model)
|
116
|
+
post_body = opts[:body]
|
117
|
+
|
118
|
+
return_type = opts[:return_type] || 'Array<PlanObjectForm>'
|
119
|
+
|
120
|
+
auth_names = opts[:auth_names] || ['stage-api-token']
|
121
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
122
|
+
:header_params => header_params,
|
123
|
+
:query_params => query_params,
|
124
|
+
:form_params => form_params,
|
125
|
+
:body => post_body,
|
126
|
+
:auth_names => auth_names,
|
127
|
+
:return_type => return_type)
|
128
|
+
|
129
|
+
if @api_client.config.debugging
|
130
|
+
@api_client.config.logger.debug "API called: StageApi#get_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
131
|
+
end
|
132
|
+
return data, status_code, headers
|
133
|
+
end
|
134
|
+
|
87
135
|
# Checks if a user has access to the identified feature.
|
88
136
|
# @param user_identifier The identifier of the user who is accessing the feature.
|
89
137
|
# @param feature_identifiers identifiers
|
@@ -108,8 +156,8 @@ module Stage
|
|
108
156
|
end
|
109
157
|
|
110
158
|
# Checks if a user has access to the identified feature.
|
111
|
-
# @param feature_identifiers identifiers
|
112
159
|
# @param user_identifier The identifier of the user who is accessing the feature.
|
160
|
+
# @param feature_identifiers identifiers
|
113
161
|
# @param [Hash] opts the optional parameters
|
114
162
|
# @return [Array<(AccessForm, Integer, Hash)>] AccessForm data, response status code and response headers
|
115
163
|
def has_access_with_http_info(user_identifier, feature_identifiers, opts = {})
|
@@ -159,7 +207,159 @@ module Stage
|
|
159
207
|
return data, status_code, headers
|
160
208
|
end
|
161
209
|
|
162
|
-
#
|
210
|
+
# If the user has access to the feature, this marks that feature as accessed.
|
211
|
+
# @param user_identifier The identifier of the user who is accessing the feature.
|
212
|
+
# @param feature_identifier The feature_identifier of the feature being accessed.
|
213
|
+
# @param [Hash] opts the optional parameters
|
214
|
+
# @return [AccessForm]
|
215
|
+
def access(user_identifier, feature_identifier, opts = {})
|
216
|
+
data, _status_code, _headers = access_with_http_info(user_identifier, [feature_identifier], opts)
|
217
|
+
data
|
218
|
+
end
|
219
|
+
|
220
|
+
# If the user has access to the features, this marks those features as accessed.
|
221
|
+
# @param user_identifier The identifier of the user who is accessing the feature.
|
222
|
+
# @param feature_identifiers The feature_identifiers of the features being accessed.
|
223
|
+
# @param [Hash] opts the optional parameters
|
224
|
+
# @return [AccessForm]
|
225
|
+
def accessAll(user_identifier, feature_identifiers, opts = {})
|
226
|
+
data, _status_code, _headers = access_with_http_info(user_identifier, feature_identifiers, opts)
|
227
|
+
data
|
228
|
+
end
|
229
|
+
|
230
|
+
# If the user has access to the features, this marks those features as accessed.
|
231
|
+
# @param user_identifier The identifier of the user who is accessing the feature.
|
232
|
+
# @param feature_identifiers The identifiers of the features being accessed.
|
233
|
+
# @param [Hash] opts the optional parameters
|
234
|
+
# @return [Array<(AccessForm, Integer, Hash)>] AccessForm data, response status code and response headers
|
235
|
+
def access_with_http_info(user_identifier, feature_identifiers, opts = {})
|
236
|
+
if @api_client.config.debugging
|
237
|
+
@api_client.config.logger.debug 'Calling API: StageApi.access ...'
|
238
|
+
end
|
239
|
+
# verify the required parameter 'feature_identifiers' is set
|
240
|
+
if @api_client.config.client_side_validation && feature_identifiers.nil?
|
241
|
+
fail ArgumentError, "Missing the required parameter 'feature_identifiers' when calling StageApi.access"
|
242
|
+
end
|
243
|
+
# verify the required parameter 'user_identifier' is set
|
244
|
+
if @api_client.config.client_side_validation && user_identifier.nil?
|
245
|
+
fail ArgumentError, "Missing the required parameter 'user_identifier' when calling StageApi.access"
|
246
|
+
end
|
247
|
+
# resource path
|
248
|
+
local_var_path = '/sdk-api/v1/users/{userIdentifier}/features'.sub('{' + 'userIdentifier' + '}', user_identifier.to_s)
|
249
|
+
|
250
|
+
# query parameters
|
251
|
+
query_params = opts[:query_params] || {}
|
252
|
+
query_params[:'identifiers'] = @api_client.build_collection_param(feature_identifiers, :multi)
|
253
|
+
|
254
|
+
# header parameters
|
255
|
+
header_params = opts[:header_params] || {}
|
256
|
+
# HTTP header 'Accept' (if needed)
|
257
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
258
|
+
|
259
|
+
# form parameters
|
260
|
+
form_params = opts[:form_params] || {}
|
261
|
+
|
262
|
+
# http body (model)
|
263
|
+
post_body = opts[:body]
|
264
|
+
|
265
|
+
return_type = opts[:return_type] || 'AccessForm'
|
266
|
+
|
267
|
+
auth_names = opts[:auth_names] || ['stage-api-token', 'stage-read-only-api-token']
|
268
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
269
|
+
:header_params => header_params,
|
270
|
+
:query_params => query_params,
|
271
|
+
:form_params => form_params,
|
272
|
+
:body => post_body,
|
273
|
+
:auth_names => auth_names,
|
274
|
+
:return_type => return_type)
|
275
|
+
|
276
|
+
if @api_client.config.debugging
|
277
|
+
@api_client.config.logger.debug "API called: StageApi#access\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
278
|
+
end
|
279
|
+
return data, status_code, headers
|
280
|
+
end
|
281
|
+
|
282
|
+
# If the user has access to the feature, this un-accesses that features.
|
283
|
+
# @param user_identifier The identifier of the user who is accessing the feature.
|
284
|
+
# @param feature_identifier The identifier of the feature being accessed.
|
285
|
+
# @param as_credit When set to true, this un-accessing of a feature is treated as a credit instead of decrementing the access count.
|
286
|
+
# @param [Hash] opts the optional parameters
|
287
|
+
# @return [AccessForm]
|
288
|
+
def un_access(user_identifier, feature_identifier, as_credit, opts = {})
|
289
|
+
data, _status_code, _headers = un_access_with_http_info(as_credit, [feature_identifier], user_identifier, opts)
|
290
|
+
data
|
291
|
+
end
|
292
|
+
|
293
|
+
# If the user has access to the features, this un-accesses those features.
|
294
|
+
# @param user_identifier The identifier of the user who is accessing the feature.
|
295
|
+
# @param feature_identifiers The identifiers of the features being accessed.
|
296
|
+
# @param as_credit When set to true, this un-accessing of a feature is treated as a credit instead of decrementing the access count.
|
297
|
+
# @param [Hash] opts the optional parameters
|
298
|
+
# @return [AccessForm]
|
299
|
+
def un_access_all(user_identifier, feature_identifiers, as_credit, opts = {})
|
300
|
+
data, _status_code, _headers = un_access_with_http_info(as_credit, feature_identifiers, user_identifier, opts)
|
301
|
+
data
|
302
|
+
end
|
303
|
+
|
304
|
+
# If the user has access to the features, this un-accesses those features.
|
305
|
+
# @param as_credit When set to true, this un-accessing of a feature is treated as a credit instead of decrementing the access count.
|
306
|
+
# @param feature_identifiers The identifiers of the features being accessed.
|
307
|
+
# @param user_identifier The identifier of the user who is accessing the feature.
|
308
|
+
# @param [Hash] opts the optional parameters
|
309
|
+
# @return [Array<(AccessForm, Integer, Hash)>] AccessForm data, response status code and response headers
|
310
|
+
def un_access_with_http_info(user_identifier, feature_identifiers, as_credit, opts = {})
|
311
|
+
if @api_client.config.debugging
|
312
|
+
@api_client.config.logger.debug 'Calling API: StageApi.un_access ...'
|
313
|
+
end
|
314
|
+
# verify the required parameter 'as_credit' is set
|
315
|
+
if @api_client.config.client_side_validation && as_credit.nil?
|
316
|
+
fail ArgumentError, "Missing the required parameter 'as_credit' when calling StageApi.un_access"
|
317
|
+
end
|
318
|
+
# verify the required parameter 'feature_identifiers' is set
|
319
|
+
if @api_client.config.client_side_validation && feature_identifiers.nil?
|
320
|
+
fail ArgumentError, "Missing the required parameter 'feature_identifiers' when calling StageApi.un_access"
|
321
|
+
end
|
322
|
+
# verify the required parameter 'user_identifier' is set
|
323
|
+
if @api_client.config.client_side_validation && user_identifier.nil?
|
324
|
+
fail ArgumentError, "Missing the required parameter 'user_identifier' when calling StageApi.un_access"
|
325
|
+
end
|
326
|
+
# resource path
|
327
|
+
local_var_path = '/sdk-api/v1/users/{userIdentifier}/features'.sub('{' + 'userIdentifier' + '}', user_identifier.to_s)
|
328
|
+
|
329
|
+
# query parameters
|
330
|
+
query_params = opts[:query_params] || {}
|
331
|
+
query_params[:'asCredit'] = as_credit
|
332
|
+
query_params[:'identifiers'] = @api_client.build_collection_param(feature_identifiers, :multi)
|
333
|
+
|
334
|
+
# header parameters
|
335
|
+
header_params = opts[:header_params] || {}
|
336
|
+
# HTTP header 'Accept' (if needed)
|
337
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
338
|
+
|
339
|
+
# form parameters
|
340
|
+
form_params = opts[:form_params] || {}
|
341
|
+
|
342
|
+
# http body (model)
|
343
|
+
post_body = opts[:body]
|
344
|
+
|
345
|
+
return_type = opts[:return_type] || 'AccessForm'
|
346
|
+
|
347
|
+
auth_names = opts[:auth_names] || ['stage-api-token', 'stage-read-only-api-token']
|
348
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
349
|
+
:header_params => header_params,
|
350
|
+
:query_params => query_params,
|
351
|
+
:form_params => form_params,
|
352
|
+
:body => post_body,
|
353
|
+
:auth_names => auth_names,
|
354
|
+
:return_type => return_type)
|
355
|
+
|
356
|
+
if @api_client.config.debugging
|
357
|
+
@api_client.config.logger.debug "API called: StageApi#un_access\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
358
|
+
end
|
359
|
+
return data, status_code, headers
|
360
|
+
end
|
361
|
+
|
362
|
+
# Updates a user's plan.
|
163
363
|
# @param user_identifier The identifier of the user.
|
164
364
|
# @param plan_identifier The plan identifier.
|
165
365
|
# @return [ClientUserForm]
|
@@ -176,7 +376,7 @@ module Stage
|
|
176
376
|
data
|
177
377
|
end
|
178
378
|
|
179
|
-
# Updates a user's plan
|
379
|
+
# Updates a user's plan.
|
180
380
|
# @param user_identifier The identifier of the user.
|
181
381
|
# @param body The payload containing the information to update a user's plan. Only identifier and planIdentifier fields are required.
|
182
382
|
# @param [Hash] opts the optional parameters
|
@@ -199,6 +199,13 @@ module Stage
|
|
199
199
|
key: 'Authorization',
|
200
200
|
value: api_key_with_prefix('Authorization')
|
201
201
|
},
|
202
|
+
'stage-read-only-api-token' =>
|
203
|
+
{
|
204
|
+
type: 'api_key',
|
205
|
+
in: 'header',
|
206
|
+
key: 'Authorization',
|
207
|
+
value: api_key_with_prefix('Authorization')
|
208
|
+
},
|
202
209
|
}
|
203
210
|
end
|
204
211
|
end
|
@@ -19,6 +19,8 @@ module Stage
|
|
19
19
|
# The creation date.
|
20
20
|
attr_accessor :created_at
|
21
21
|
|
22
|
+
attr_accessor :created_by
|
23
|
+
|
22
24
|
# A boolean value indicating whether the client user is deleted or not.
|
23
25
|
attr_accessor :deleted
|
24
26
|
|
@@ -28,22 +30,31 @@ module Stage
|
|
28
30
|
# A client user identifier.
|
29
31
|
attr_accessor :identifier
|
30
32
|
|
33
|
+
# The organization this user belongs to.
|
34
|
+
attr_accessor :organization_id
|
35
|
+
|
31
36
|
# The plan to be assigned to the client user.
|
32
37
|
attr_accessor :plan_id
|
33
38
|
|
34
39
|
# The plan to be assigned to the user.
|
35
40
|
attr_accessor :plan_identifier
|
36
41
|
|
42
|
+
# The role within the organization's plan this user is assigned.
|
43
|
+
attr_accessor :plan_role_id
|
44
|
+
|
37
45
|
# Attribute mapping from ruby-style variable name to JSON key.
|
38
46
|
def self.attribute_map
|
39
47
|
{
|
40
48
|
:'arena_id' => :'arenaId',
|
41
49
|
:'created_at' => :'createdAt',
|
50
|
+
:'created_by' => :'createdBy',
|
42
51
|
:'deleted' => :'deleted',
|
43
52
|
:'id' => :'id',
|
44
53
|
:'identifier' => :'identifier',
|
54
|
+
:'organization_id' => :'organizationId',
|
45
55
|
:'plan_id' => :'planId',
|
46
|
-
:'plan_identifier' => :'planIdentifier'
|
56
|
+
:'plan_identifier' => :'planIdentifier',
|
57
|
+
:'plan_role_id' => :'planRoleId'
|
47
58
|
}
|
48
59
|
end
|
49
60
|
|
@@ -52,11 +63,14 @@ module Stage
|
|
52
63
|
{
|
53
64
|
:'arena_id' => :'Object',
|
54
65
|
:'created_at' => :'Object',
|
66
|
+
:'created_by' => :'Object',
|
55
67
|
:'deleted' => :'Object',
|
56
68
|
:'id' => :'Object',
|
57
69
|
:'identifier' => :'Object',
|
70
|
+
:'organization_id' => :'Object',
|
58
71
|
:'plan_id' => :'Object',
|
59
|
-
:'plan_identifier' => :'Object'
|
72
|
+
:'plan_identifier' => :'Object',
|
73
|
+
:'plan_role_id' => :'Object'
|
60
74
|
}
|
61
75
|
end
|
62
76
|
|
@@ -89,6 +103,10 @@ module Stage
|
|
89
103
|
self.created_at = attributes[:'created_at']
|
90
104
|
end
|
91
105
|
|
106
|
+
if attributes.key?(:'created_by')
|
107
|
+
self.created_by = attributes[:'created_by']
|
108
|
+
end
|
109
|
+
|
92
110
|
if attributes.key?(:'deleted')
|
93
111
|
self.deleted = attributes[:'deleted']
|
94
112
|
end
|
@@ -101,6 +119,10 @@ module Stage
|
|
101
119
|
self.identifier = attributes[:'identifier']
|
102
120
|
end
|
103
121
|
|
122
|
+
if attributes.key?(:'organization_id')
|
123
|
+
self.organization_id = attributes[:'organization_id']
|
124
|
+
end
|
125
|
+
|
104
126
|
if attributes.key?(:'plan_id')
|
105
127
|
self.plan_id = attributes[:'plan_id']
|
106
128
|
end
|
@@ -108,6 +130,10 @@ module Stage
|
|
108
130
|
if attributes.key?(:'plan_identifier')
|
109
131
|
self.plan_identifier = attributes[:'plan_identifier']
|
110
132
|
end
|
133
|
+
|
134
|
+
if attributes.key?(:'plan_role_id')
|
135
|
+
self.plan_role_id = attributes[:'plan_role_id']
|
136
|
+
end
|
111
137
|
end
|
112
138
|
|
113
139
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -130,11 +156,14 @@ module Stage
|
|
130
156
|
self.class == o.class &&
|
131
157
|
arena_id == o.arena_id &&
|
132
158
|
created_at == o.created_at &&
|
159
|
+
created_by == o.created_by &&
|
133
160
|
deleted == o.deleted &&
|
134
161
|
id == o.id &&
|
135
162
|
identifier == o.identifier &&
|
163
|
+
organization_id == o.organization_id &&
|
136
164
|
plan_id == o.plan_id &&
|
137
|
-
plan_identifier == o.plan_identifier
|
165
|
+
plan_identifier == o.plan_identifier &&
|
166
|
+
plan_role_id == o.plan_role_id
|
138
167
|
end
|
139
168
|
|
140
169
|
# @see the `==` method
|
@@ -146,7 +175,7 @@ module Stage
|
|
146
175
|
# Calculates hash code according to all attributes.
|
147
176
|
# @return [Integer] Hash code
|
148
177
|
def hash
|
149
|
-
[arena_id, created_at, deleted, id, identifier, plan_id, plan_identifier].hash
|
178
|
+
[arena_id, created_at, created_by, deleted, id, identifier, organization_id, plan_id, plan_identifier, plan_role_id].hash
|
150
179
|
end
|
151
180
|
|
152
181
|
# Builds the object from hash
|
@@ -0,0 +1,247 @@
|
|
1
|
+
=begin
|
2
|
+
#Stage API Docs
|
3
|
+
|
4
|
+
#Stage Technologies complete API Documentation
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
Contact: support@heystage.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.33
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module Stage
|
15
|
+
class FeatureObjectForm
|
16
|
+
# Feature description.
|
17
|
+
attr_accessor :description
|
18
|
+
|
19
|
+
# Feature identifier.
|
20
|
+
attr_accessor :identifier
|
21
|
+
|
22
|
+
# Feature limit.
|
23
|
+
attr_accessor :limit
|
24
|
+
|
25
|
+
# Feature name.
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# Feature order.
|
29
|
+
attr_accessor :order
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'description' => :'description',
|
35
|
+
:'identifier' => :'identifier',
|
36
|
+
:'limit' => :'limit',
|
37
|
+
:'name' => :'name',
|
38
|
+
:'order' => :'order'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'description' => :'Object',
|
46
|
+
:'identifier' => :'Object',
|
47
|
+
:'limit' => :'Object',
|
48
|
+
:'name' => :'Object',
|
49
|
+
:'order' => :'Object'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# List of attributes with nullable: true
|
54
|
+
def self.openapi_nullable
|
55
|
+
Set.new([
|
56
|
+
])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
if (!attributes.is_a?(Hash))
|
63
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Stage::FeatureObjectForm` initialize method"
|
64
|
+
end
|
65
|
+
|
66
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
68
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Stage::FeatureObjectForm`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
70
|
+
end
|
71
|
+
h[k.to_sym] = v
|
72
|
+
}
|
73
|
+
|
74
|
+
if attributes.key?(:'description')
|
75
|
+
self.description = attributes[:'description']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'identifier')
|
79
|
+
self.identifier = attributes[:'identifier']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'limit')
|
83
|
+
self.limit = attributes[:'limit']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'name')
|
87
|
+
self.name = attributes[:'name']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'order')
|
91
|
+
self.order = attributes[:'order']
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
96
|
+
# @return Array for valid properties with the reasons
|
97
|
+
def list_invalid_properties
|
98
|
+
invalid_properties = Array.new
|
99
|
+
invalid_properties
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to see if the all the properties in the model are valid
|
103
|
+
# @return true if the model is valid
|
104
|
+
def valid?
|
105
|
+
true
|
106
|
+
end
|
107
|
+
|
108
|
+
# Checks equality by comparing each attribute.
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def ==(o)
|
111
|
+
return true if self.equal?(o)
|
112
|
+
self.class == o.class &&
|
113
|
+
description == o.description &&
|
114
|
+
identifier == o.identifier &&
|
115
|
+
limit == o.limit &&
|
116
|
+
name == o.name &&
|
117
|
+
order == o.order
|
118
|
+
end
|
119
|
+
|
120
|
+
# @see the `==` method
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def eql?(o)
|
123
|
+
self == o
|
124
|
+
end
|
125
|
+
|
126
|
+
# Calculates hash code according to all attributes.
|
127
|
+
# @return [Integer] Hash code
|
128
|
+
def hash
|
129
|
+
[description, identifier, limit, name, order].hash
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def self.build_from_hash(attributes)
|
136
|
+
new.build_from_hash(attributes)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def build_from_hash(attributes)
|
143
|
+
return nil unless attributes.is_a?(Hash)
|
144
|
+
self.class.openapi_types.each_pair do |key, type|
|
145
|
+
if type =~ /\AArray<(.*)>/i
|
146
|
+
# check to ensure the input is an array given that the attribute
|
147
|
+
# is documented as an array but the input is not
|
148
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
149
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
150
|
+
end
|
151
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
152
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
153
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
154
|
+
self.send("#{key}=", nil)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
self
|
159
|
+
end
|
160
|
+
|
161
|
+
# Deserializes the data based on type
|
162
|
+
# @param string type Data type
|
163
|
+
# @param string value Value to be deserialized
|
164
|
+
# @return [Object] Deserialized data
|
165
|
+
def _deserialize(type, value)
|
166
|
+
case type.to_sym
|
167
|
+
when :DateTime
|
168
|
+
DateTime.parse(value)
|
169
|
+
when :Date
|
170
|
+
Date.parse(value)
|
171
|
+
when :String
|
172
|
+
value.to_s
|
173
|
+
when :Integer
|
174
|
+
value.to_i
|
175
|
+
when :Float
|
176
|
+
value.to_f
|
177
|
+
when :Boolean
|
178
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
179
|
+
true
|
180
|
+
else
|
181
|
+
false
|
182
|
+
end
|
183
|
+
when :Object
|
184
|
+
# generic object (usually a Hash), return directly
|
185
|
+
value
|
186
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
187
|
+
inner_type = Regexp.last_match[:inner_type]
|
188
|
+
value.map { |v| _deserialize(inner_type, v) }
|
189
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
190
|
+
k_type = Regexp.last_match[:k_type]
|
191
|
+
v_type = Regexp.last_match[:v_type]
|
192
|
+
{}.tap do |hash|
|
193
|
+
value.each do |k, v|
|
194
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
else # model
|
198
|
+
Stage.const_get(type).build_from_hash(value)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the string representation of the object
|
203
|
+
# @return [String] String presentation of the object
|
204
|
+
def to_s
|
205
|
+
to_hash.to_s
|
206
|
+
end
|
207
|
+
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_body
|
211
|
+
to_hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the object in the form of hash
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_hash
|
217
|
+
hash = {}
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
219
|
+
value = self.send(attr)
|
220
|
+
if value.nil?
|
221
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
222
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
223
|
+
end
|
224
|
+
|
225
|
+
hash[param] = _to_hash(value)
|
226
|
+
end
|
227
|
+
hash
|
228
|
+
end
|
229
|
+
|
230
|
+
# Outputs non-array value in the form of hash
|
231
|
+
# For object, use to_hash. Otherwise, just return the value
|
232
|
+
# @param [Object] value Any valid value
|
233
|
+
# @return [Hash] Returns the value in the form of hash
|
234
|
+
def _to_hash(value)
|
235
|
+
if value.is_a?(Array)
|
236
|
+
value.compact.map { |v| _to_hash(v) }
|
237
|
+
elsif value.is_a?(Hash)
|
238
|
+
{}.tap do |hash|
|
239
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
240
|
+
end
|
241
|
+
elsif value.respond_to? :to_hash
|
242
|
+
value.to_hash
|
243
|
+
else
|
244
|
+
value
|
245
|
+
end
|
246
|
+
end end
|
247
|
+
end
|