Class: Punchtab::Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

authentication api methods



21
22
23
24
25
26
27
28
# File 'lib/punchtab.rb', line 21

def initialize(options = {})
  # initialize the API
  @api = Punchtab::API.new(options)

  # authenticate
  @access_token = @api.authenticate

end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



14
15
16
# File 'lib/punchtab.rb', line 14

def access_token
  @access_token
end

Class Method Details

.versionObject



16
17
18
# File 'lib/punchtab.rb', line 16

def self.version
  Punchtab::VERSION
end

Instance Method Details

#create_activity(activity_name, options = {}) ⇒ Object



43
44
45
# File 'lib/punchtab.rb', line 43

def create_activity(activity_name, options={})
  @api.create_activity(activity_name, options)
end

#get_activity(options = {}) ⇒ Object

activity api methods



39
40
41
# File 'lib/punchtab.rb', line 39

def get_activity(options={})
  @api.get_activity(options)
end

#get_leaderboard(options = {}) ⇒ Object

leaderboard api methods



62
63
64
# File 'lib/punchtab.rb', line 62

def get_leaderboard(options={})
  @api.get_leaderboard(options)
end

#get_reward(options = {}) ⇒ Object

reward api methods



57
58
59
# File 'lib/punchtab.rb', line 57

def get_reward(options={})
  @api.get_reward(options)
end

#get_userObject

user api methods



52
53
54
# File 'lib/punchtab.rb', line 52

def get_user
  @api.get_user
end

#logoutObject



34
35
36
# File 'lib/punchtab.rb', line 34

def logout
  @api.logout
end

#redeem_activity_offer(reward_id) ⇒ Object



47
48
49
# File 'lib/punchtab.rb', line 47

def redeem_activity_offer(reward_id)
  @api.redeem_activity_offer(reward_id)
end

#statusObject



30
31
32
# File 'lib/punchtab.rb', line 30

def status
  @api.status
end