Class: Plus::Activities

Inherits:
Object
  • Object
show all
Defined in:
lib/plus/activities.rb

Class Method Summary collapse

Class Method Details

.get(activity_id, options = {}) ⇒ Object

Retrieves the detail for a given activity.



16
17
18
19
20
21
22
23
24
# File 'lib/plus/activities.rb', line 16

def self.get(activity_id, options={})
  endpoint_prefix = 'activities'

  default_options = { :alt => :json }
  options = default_options.merge(options)
  url = Plus::ENDPOINT + endpoint_prefix + '/' + activity_id

  HTTParty.get(url, :query => options.merge(:key => Plus.options[:api_key]))
end

.list(user_id, options = {}) ⇒ Object

Retrieves the recent posts for a given user.



5
6
7
8
9
10
11
12
13
# File 'lib/plus/activities.rb', line 5

def self.list(user_id, options={})
  endpoint_prefix = 'people'

  default_options = { :collection => :public, :alt => :json }
  options = default_options.merge(options)
  url = Plus::ENDPOINT + endpoint_prefix + '/' + user_id.to_s + '/activities/' + options.delete(:collection).to_s

  HTTParty.get(url, :query => options.merge(:key => Plus.options[:api_key]))
end

.search(query, options = {}) ⇒ Object

Searches public activities for the given search term



27
28
29
30
31
32
33
34
35
# File 'lib/plus/activities.rb', line 27

def self.search(query, options={})
  endpoint_prefix = 'activities'

  default_options = { :alt => :json }
  options = default_options.merge(options)
  url = Plus::ENDPOINT + endpoint_prefix

  HTTParty.get(url, :query => options.merge(:key => Plus.options[:api_key], :query => query))
end