Class: Evri::RPX::ContactList

Inherits:
Object
  • Object
show all
Defined in:
lib/evri/rpx/contact_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ContactList

Returns a new instance of ContactList.



16
17
18
19
20
21
22
23
24
# File 'lib/evri/rpx/contact_list.rb', line 16

def initialize(json)
  @total_results = json['response']['totalResults'] rescue 0
  @start_index = json['response']['startIndex'] rescue nil
  @items_per_page = json['response']['itemsPerPage']

  @contacts = json['response']['entry'].map do |contact_json|
    Contact.new(contact_json)
  end
end

Instance Attribute Details

#contactsObject (readonly)

Returns an array of Contact objects.



14
15
16
# File 'lib/evri/rpx/contact_list.rb', line 14

def contacts
  @contacts
end

#items_per_pageObject (readonly)

Returns the number of contacts returned per page.



11
12
13
# File 'lib/evri/rpx/contact_list.rb', line 11

def items_per_page
  @items_per_page
end

#start_indexObject (readonly)

Returns the current pagination index into the contact results



8
9
10
# File 'lib/evri/rpx/contact_list.rb', line 8

def start_index
  @start_index
end

#total_resultsObject (readonly)

Returns the total amount of contacts found for this user.



5
6
7
# File 'lib/evri/rpx/contact_list.rb', line 5

def total_results
  @total_results
end