Class: Courier::Users::Tenants::ListTenantsForUserResponse
- Inherits:
-
Object
- Object
- Courier::Users::Tenants::ListTenantsForUserResponse
- Defined in:
- lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
-
#has_more ⇒ Object
readonly
Returns the value of attribute has_more.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#next_url ⇒ Object
readonly
Returns the value of attribute next_url.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Users::Tenants::ListTenantsForUserResponse
Deserialize a JSON object to an instance of ListTenantsForUserResponse.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(has_more:, url:, type:, items: nil, next_url: nil, cursor: nil, additional_properties: nil) ⇒ Users::Tenants::ListTenantsForUserResponse constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ListTenantsForUserResponse to a JSON object.
Constructor Details
#initialize(has_more:, url:, type:, items: nil, next_url: nil, cursor: nil, additional_properties: nil) ⇒ Users::Tenants::ListTenantsForUserResponse
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 22 def initialize(has_more:, url:, type:, items: nil, next_url: nil, cursor: nil, additional_properties: nil) # @type [Array<Commons::UserTenantAssociation>] @items = items # @type [Boolean] Set to true when there are more pages that can be retrieved. @has_more = has_more # @type [String] A url that may be used to generate these results. @url = url # @type [String] A url that may be used to generate fetch the next set of results. # Defined only when `has_more` is set to true @next_url = next_url # @type [String] A pointer to the next page of results. Defined # only when `has_more` is set to true @cursor = cursor # @type [String] Always set to `list`. Represents the type of this object. @type = type # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def additional_properties @additional_properties end |
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def cursor @cursor end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def has_more @has_more end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def items @items end |
#next_url ⇒ Object (readonly)
Returns the value of attribute next_url.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def next_url @next_url end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 10 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ Users::Tenants::ListTenantsForUserResponse
Deserialize a JSON object to an instance of ListTenantsForUserResponse
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) items = parsed_json["items"]&.map do |v| v = v.to_json Commons::UserTenantAssociation.from_json(json_object: v) end has_more = struct.has_more url = struct.url next_url = struct.next_url cursor = struct.cursor type = struct.type new(items: items, has_more: has_more, url: url, next_url: next_url, cursor: cursor, type: type, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
79 80 81 82 83 84 85 86 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 79 def self.validate_raw(obj:) obj.items&.is_a?(Array) != false || raise("Passed value for field obj.items is not the expected type, validation failed.") obj.has_more.is_a?(Boolean) != false || raise("Passed value for field obj.has_more is not the expected type, validation failed.") obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.next_url&.is_a?(String) != false || raise("Passed value for field obj.next_url is not the expected type, validation failed.") obj.cursor&.is_a?(String) != false || raise("Passed value for field obj.cursor is not the expected type, validation failed.") obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ListTenantsForUserResponse to a JSON object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb', line 64 def to_json(*_args) { "items": @items, "has_more": @has_more, "url": @url, "next_url": @next_url, "cursor": @cursor, "type": @type }.to_json end |