Class: GoogleContactsApi::ContactSet

Inherits:
ResultSet
  • Object
show all
Defined in:
lib/google_contacts_api/contact_set.rb

Overview

Represents a set of contacts.

Instance Attribute Summary

Attributes inherited from ResultSet

#api, #items_per_page, #parsed, #start_index, #total_results

Instance Method Summary collapse

Methods inherited from ResultSet

#each, #has_more?, #inspect

Constructor Details

#initialize(response_body, api = nil) ⇒ ContactSet

Initialize a ContactSet from an API response body that contains contacts data



5
6
7
8
9
10
11
12
# File 'lib/google_contacts_api/contact_set.rb', line 5

def initialize(response_body, api = nil)
  super
  if @parsed.nil? || @parsed.feed.nil? || @parsed.feed.entry.nil?
    @results = []
  else
    @results = @parsed.feed.entry.map { |e| GoogleContactsApi::Contact.new(e, nil, api) }
  end
end