Class: GooglePlus::Person
- Inherits:
-
Object
- Object
- GooglePlus::Person
- Extended by:
- Resource
- Includes:
- Entity
- Defined in:
- lib/google_plus/person.rb
Overview
A Person in Google Plus
Constant Summary
Constants included from Resource
Instance Attribute Summary
Attributes included from Entity
Class Method Summary collapse
-
.get(user_id, params = {}) ⇒ GooglePlus::Person
Get a person by id.
-
.search(query, params = {}) ⇒ GooglePlus::Cursor
Search for a person.
Instance Method Summary collapse
-
#initialize(hash) ⇒ GooglePlus::Person
constructor
Load a new instance from an attributes hash Useful if you have the underlying response data for an object - Generally, what you want is #get though.
-
#list_activities ⇒ GooglePlus::Cursor
List the activities for this person.
Methods included from Resource
Methods included from Entity
included, #method_missing, #respond_to?
Constructor Details
#initialize(hash) ⇒ GooglePlus::Person
Load a new instance from an attributes hash Useful if you have the underlying response data for an object - Generally, what you want is #get though
41 42 43 |
# File 'lib/google_plus/person.rb', line 41 def initialize(hash) load_hash(hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GooglePlus::Entity
Class Method Details
.get(user_id, params = {}) ⇒ GooglePlus::Person
Get a person by id
15 16 17 18 |
# File 'lib/google_plus/person.rb', line 15 def self.get(user_id, params = {}) data = make_request(:get, "people/#{user_id}", params) Person.new(JSON.parse(data)) if data end |
.search(query, params = {}) ⇒ GooglePlus::Cursor
Search for a person
25 26 27 28 29 |
# File 'lib/google_plus/person.rb', line 25 def self.search(query, params = {}) params[:query] = URI.escape(query) resource = 'people' GooglePlus::Cursor.new(self, :get, resource, params) end |
Instance Method Details
#list_activities ⇒ GooglePlus::Cursor
List the activities for this person
33 34 35 |
# File 'lib/google_plus/person.rb', line 33 def list_activities GooglePlus::Activity.for_person(id) end |