Class: Evri::RPX::ContactList
- Inherits:
-
Object
- Object
- Evri::RPX::ContactList
- Defined in:
- lib/evri/rpx/contact_list.rb
Instance Attribute Summary collapse
-
#contacts ⇒ Object
readonly
Returns an array of Contact objects.
-
#items_per_page ⇒ Object
readonly
Returns the number of contacts returned per page.
-
#start_index ⇒ Object
readonly
Returns the current pagination index into the contact results.
-
#total_results ⇒ Object
readonly
Returns the total amount of contacts found for this user.
Instance Method Summary collapse
-
#initialize(json) ⇒ ContactList
constructor
A new instance of ContactList.
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
#contacts ⇒ Object (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_page ⇒ Object (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_index ⇒ Object (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_results ⇒ Object (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 |