Class: ConstantContact::Components::ResultSet

Inherits:
Object
  • Object
show all
Defined in:
lib/constantcontact/components/result_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results, meta) ⇒ ResultSet

Constructor to create a ResultSet from the results/meta response when performing a get on a collection

Parameters:

  • results (Array<Hash>)
    • results array from request

  • meta (Hash)
    • meta hash from request



16
17
18
19
20
21
22
23
# File 'lib/constantcontact/components/result_set.rb', line 16

def initialize(results, meta)
  @results = results

  if meta.has_key?('pagination') and meta['pagination'].has_key?('next_link')
    next_link = meta['pagination']['next_link']
    @next = next_link[next_link.index('?'), next_link.length]
  end
end

Instance Attribute Details

#nextObject

Returns the value of attribute next



10
11
12
# File 'lib/constantcontact/components/result_set.rb', line 10

def next
  @next
end

#resultsObject

Returns the value of attribute results



10
11
12
# File 'lib/constantcontact/components/result_set.rb', line 10

def results
  @results
end