Module: Checkdin::Activities

Included in:
Client
Defined in:
lib/checkdin/activities.rb

Instance Method Summary collapse

Instance Method Details

#activities(options = {}) ⇒ Object

Get a list of all activities for the authenticating client.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • Integer (Object)

    :campaign_id - Only return won rewards for this campaign.

  • String (Object)

    :classification - Only return activities for users in this classification.

  • Integer (Object)

    :user_id - Only return won rewards for this user.

  • Integer (Object)

    :since - Only fetch updates since this time (UNIX timestamp)

  • Integer (Object)

    :limit - The maximum number of records to return.



22
23
24
25
26
27
# File 'lib/checkdin/activities.rb', line 22

def activities(options={})
  response = connection.get do |req|
    req.url "activities", options
  end
  return_error_or_body(response)
end

#activity(id) ⇒ Object

Retrieve information about a single activity

param [Integer] id The ID of the activity



8
9
10
11
# File 'lib/checkdin/activities.rb', line 8

def activity(id)
  response = connection.get("activities/#{id}")
  return_error_or_body(response)
end

#add_vote_on_activity(id, options = {}) ⇒ Object

Add a vote for a single activity when voting is enabled for its promotion

param [Integer] id The ID of the activity

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • Integer (Object)

    :user_id - The user that is performing this vote.



35
36
37
38
39
40
# File 'lib/checkdin/activities.rb', line 35

def add_vote_on_activity(id, options={})
  response = connection.post do |req|
    req.url "activities/#{id}/vote", options
  end
  return_error_or_body(response)
end