Class: Hyperpublic::People

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/hyperpublic/people.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#photos, #search_neighborhoods, #search_tags

Constructor Details

#initialize(client) ⇒ People

Returns a new instance of People.



8
9
10
# File 'lib/hyperpublic/people.rb', line 8

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/hyperpublic/people.rb', line 6

def client
  @client
end

Instance Method Details

#create(options = {}) ⇒ Object



28
29
30
# File 'lib/hyperpublic/people.rb', line 28

def create(options={})
  perform_post("/people", :body => options)
end

#find(params) ⇒ Object

param can be

id
{:ids => [1, 2, 3]}, 
{:tags => [tag1, tags]}, or 
{:location => {:lat=>35,:lon=>-70}}
etc


18
19
20
21
22
23
24
25
26
# File 'lib/hyperpublic/people.rb', line 18

def find(params)
  if params.is_a? String
    perform_get("/people/#{params}")
  else
    q = Addressable::URI.new
    q.query_values = stringify(params)
    perform_get("/people?#{q.query}")
  end
end