Class: Marver::DataContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/marver/data_container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ DataContainer

Returns a new instance of DataContainer.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/marver/data_container.rb', line 5

def initialize(response)
  json_results = response.data

  @offset = json_results['offset'].to_i
  @limit = json_results['limit'].to_i
  @total = json_results['total'].to_i
  if @total == 1
    @results = json_results['results'].first
  else
    @results = json_results['results']
  end
end

Instance Attribute Details

#limitObject (readonly)

Returns the value of attribute limit.



3
4
5
# File 'lib/marver/data_container.rb', line 3

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



3
4
5
# File 'lib/marver/data_container.rb', line 3

def offset
  @offset
end

#resultsObject (readonly)

Returns the value of attribute results.



3
4
5
# File 'lib/marver/data_container.rb', line 3

def results
  @results
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/marver/data_container.rb', line 3

def total
  @total
end