Class: Courier::Tenants::TenantListResponse
- Inherits:
-
Object
- Object
- Courier::Tenants::TenantListResponse
- Defined in:
- lib/trycourier/tenants/types/tenant_list_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:) ⇒ Tenants::TenantListResponse
Deserialize a JSON object to an instance of TenantListResponse.
-
.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:, items:, url:, type:, cursor: nil, next_url: nil, additional_properties: nil) ⇒ Tenants::TenantListResponse constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of TenantListResponse to a JSON object.
Constructor Details
#initialize(has_more:, items:, url:, type:, cursor: nil, next_url: nil, additional_properties: nil) ⇒ Tenants::TenantListResponse
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 20 def initialize(has_more:, items:, url:, type:, cursor: nil, next_url: nil, additional_properties: nil) # @type [String] A pointer to the next page of results. Defined only when has_more is set to true. @cursor = cursor # @type [Boolean] Set to true when there are more pages that can be retrieved. @has_more = has_more # @type [Array<Tenants::Tenant>] An array of Tenants @items = items # @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 url that may be used to generate these results. @url = url # @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.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def additional_properties @additional_properties end |
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def cursor @cursor end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def has_more @has_more end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def items @items end |
#next_url ⇒ Object (readonly)
Returns the value of attribute next_url.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def next_url @next_url end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 9 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ Tenants::TenantListResponse
Deserialize a JSON object to an instance of TenantListResponse
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 42 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) cursor = struct.cursor has_more = struct.has_more items = parsed_json["items"]&.map do |v| v = v.to_json Tenants::Tenant.from_json(json_object: v) end next_url = struct.next_url url = struct.url type = struct.type new(cursor: cursor, has_more: has_more, items: items, next_url: next_url, url: url, 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.
76 77 78 79 80 81 82 83 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 76 def self.validate_raw(obj:) obj.cursor&.is_a?(String) != false || raise("Passed value for field obj.cursor 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.items.is_a?(Array) != false || raise("Passed value for field obj.items 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.url.is_a?(String) != false || raise("Passed value for field obj.url 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 TenantListResponse to a JSON object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/trycourier/tenants/types/tenant_list_response.rb', line 61 def to_json(*_args) { "cursor": @cursor, "has_more": @has_more, "items": @items, "next_url": @next_url, "url": @url, "type": @type }.to_json end |