Class: Courier::Tenants::ListUsersForTenantResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/tenants/types/list_users_for_tenant_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(has_more:, url:, type:, items: nil, next_url: nil, cursor: nil, additional_properties: nil) ⇒ Tenants::ListUsersForTenantResponse

Parameters:

  • items (Array<Commons::UserTenantAssociation>) (defaults to: nil)
  • has_more (Boolean)

    Set to true when there are more pages that can be retrieved.

  • url (String)

    A url that may be used to generate these results.

  • next_url (String) (defaults to: nil)

    A url that may be used to generate fetch the next set of results. Defined only when ‘has_more` is set to true

  • cursor (String) (defaults to: nil)

    A pointer to the next page of results. Defined only when ‘has_more` is set to true

  • type (String)

    Always set to ‘list`. Represents the type of this object.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 21

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_propertiesObject (readonly)

Returns the value of attribute additional_properties.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def additional_properties
  @additional_properties
end

#cursorObject (readonly)

Returns the value of attribute cursor.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def cursor
  @cursor
end

#has_moreObject (readonly)

Returns the value of attribute has_more.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def has_more
  @has_more
end

#itemsObject (readonly)

Returns the value of attribute items.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def items
  @items
end

#next_urlObject (readonly)

Returns the value of attribute next_url.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def next_url
  @next_url
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 9

def url
  @url
end

Class Method Details

.from_json(json_object:) ⇒ Tenants::ListUsersForTenantResponse

Deserialize a JSON object to an instance of ListUsersForTenantResponse

Parameters:

  • json_object (JSON)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 44

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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


78
79
80
81
82
83
84
85
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 78

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 ListUsersForTenantResponse to a JSON object

Returns:

  • (JSON)


63
64
65
66
67
68
69
70
71
72
# File 'lib/trycourier/tenants/types/list_users_for_tenant_response.rb', line 63

def to_json(*_args)
  {
    "items": @items,
    "has_more": @has_more,
    "url": @url,
    "next_url": @next_url,
    "cursor": @cursor,
    "type": @type
  }.to_json
end