Class: SuggestGrid::UsersResponse
- Defined in:
- lib/suggestgrid/models/users_response.rb
Overview
Get users response.
Instance Attribute Summary collapse
-
#count ⇒ Long
The number of users in the response.
-
#total_count ⇒ Long
The total number of users available.
-
#users ⇒ List of Metadata
The total number of users available.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(count = nil, total_count = nil, users = nil) ⇒ UsersResponse
constructor
A new instance of UsersResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(count = nil, total_count = nil, users = nil) ⇒ UsersResponse
Returns a new instance of UsersResponse.
28 29 30 31 32 33 34 |
# File 'lib/suggestgrid/models/users_response.rb', line 28 def initialize(count = nil, total_count = nil, users = nil) @count = count @total_count = total_count @users = users end |
Instance Attribute Details
#count ⇒ Long
The number of users in the response.
9 10 11 |
# File 'lib/suggestgrid/models/users_response.rb', line 9 def count @count end |
#total_count ⇒ Long
The total number of users available.
13 14 15 |
# File 'lib/suggestgrid/models/users_response.rb', line 13 def total_count @total_count end |
#users ⇒ List of Metadata
The total number of users available.
17 18 19 |
# File 'lib/suggestgrid/models/users_response.rb', line 17 def users @users end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/suggestgrid/models/users_response.rb', line 37 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. count = hash['count'] total_count = hash['total_count'] # Parameter is an array, so we need to iterate through it users = nil unless hash['users'].nil? users = [] hash['users'].each do |structure| users << (Metadata.from_hash(structure) if structure) end end # Create object from extracted values. UsersResponse.new(count, total_count, users) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 25 26 |
# File 'lib/suggestgrid/models/users_response.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['count'] = 'count' @_hash['total_count'] = 'total_count' @_hash['users'] = 'users' @_hash end |