Class: Raas::PageModel
- Defined in:
- lib/raas/models/page_model.rb
Instance Attribute Summary collapse
-
#elements_per_block ⇒ Integer
Elements per page.
-
#number ⇒ Integer
Page Number.
-
#result_count ⇒ Integer
Result Count.
-
#total_count ⇒ Integer
Total Count.
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(number = nil, elements_per_block = nil, result_count = nil, total_count = nil) ⇒ PageModel
constructor
A new instance of PageModel.
Methods inherited from BaseModel
Constructor Details
#initialize(number = nil, elements_per_block = nil, result_count = nil, total_count = nil) ⇒ PageModel
Returns a new instance of PageModel.
33 34 35 36 37 38 39 40 41 |
# File 'lib/raas/models/page_model.rb', line 33 def initialize(number = nil, elements_per_block = nil, result_count = nil, total_count = nil) @number = number @elements_per_block = elements_per_block @result_count = result_count @total_count = total_count end |
Instance Attribute Details
#elements_per_block ⇒ Integer
Elements per page
11 12 13 |
# File 'lib/raas/models/page_model.rb', line 11 def elements_per_block @elements_per_block end |
#number ⇒ Integer
Page Number
7 8 9 |
# File 'lib/raas/models/page_model.rb', line 7 def number @number end |
#result_count ⇒ Integer
Result Count
15 16 17 |
# File 'lib/raas/models/page_model.rb', line 15 def result_count @result_count end |
#total_count ⇒ Integer
Total Count
19 20 21 |
# File 'lib/raas/models/page_model.rb', line 19 def total_count @total_count end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/raas/models/page_model.rb', line 44 def self.from_hash(hash) return nil unless hash # Extract variables from the hash number = hash['number'] elements_per_block = hash['elementsPerBlock'] result_count = hash['resultCount'] total_count = hash['totalCount'] # Create object from extracted values PageModel.new(number, elements_per_block, result_count, total_count) end |
.names ⇒ Object
A mapping from model property names to API property names
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/raas/models/page_model.rb', line 22 def self.names if @_hash.nil? @_hash = {} @_hash["number"] = "number" @_hash["elements_per_block"] = "elementsPerBlock" @_hash["result_count"] = "resultCount" @_hash["total_count"] = "totalCount" end @_hash end |