Class: SuggestGrid::ActionsResponse
- Defined in:
- lib/suggestgrid/models/actions_response.rb
Instance Attribute Summary collapse
-
#actions ⇒ List of Action
The total number of actions.
-
#count ⇒ Long
The number of actions in the response.
-
#total_count ⇒ Long
The total number of actions.
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, actions = nil) ⇒ ActionsResponse
constructor
A new instance of ActionsResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(count = nil, total_count = nil, actions = nil) ⇒ ActionsResponse
Returns a new instance of ActionsResponse.
28 29 30 31 32 33 34 |
# File 'lib/suggestgrid/models/actions_response.rb', line 28 def initialize(count = nil, total_count = nil, actions = nil) @count = count @total_count = total_count @actions = actions end |
Instance Attribute Details
#actions ⇒ List of Action
The total number of actions.
15 16 17 |
# File 'lib/suggestgrid/models/actions_response.rb', line 15 def actions @actions end |
#count ⇒ Long
The number of actions in the response.
7 8 9 |
# File 'lib/suggestgrid/models/actions_response.rb', line 7 def count @count end |
#total_count ⇒ Long
The total number of actions.
11 12 13 |
# File 'lib/suggestgrid/models/actions_response.rb', line 11 def total_count @total_count 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 |
# File 'lib/suggestgrid/models/actions_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 actions = nil if hash['actions'] != nil actions = Array.new hash['actions'].each{|structure| actions << (Action.from_hash(structure) if structure)} end # Create object from extracted values ActionsResponse.new(count, total_count, actions) end |
.names ⇒ Object
A mapping from model property names to API property names
18 19 20 21 22 23 24 25 26 |
# File 'lib/suggestgrid/models/actions_response.rb', line 18 def self.names if @_hash.nil? @_hash = {} @_hash["count"] = "count" @_hash["total_count"] = "total_count" @_hash["actions"] = "actions" end @_hash end |