Class: Wes::Data::API::Model::Challenge

Inherits:
Base
  • Object
show all
Defined in:
lib/wes/data/api/model/challenge.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

#exist?, #id, #initialize

Constructor Details

This class inherits a constructor from Wes::Data::API::Model::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Wes::Data::API::Model::Base

Instance Method Details

#rewardsObject



11
12
13
14
15
16
# File 'lib/wes/data/api/model/challenge.rb', line 11

def rewards
  route = [routes.challenge, id, routes.rewards].join("/")
  map_objects(
    client.get(route), Wes::Data::API::Model::ChallengeReward
  )
end

#update_status(s) ⇒ Object



27
28
29
# File 'lib/wes/data/api/model/challenge.rb', line 27

def update_status(s)
  update(:status => s)
end

#users(state = nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/wes/data/api/model/challenge.rb', line 18

def users(state = nil)
  route = add_state(
    [routes.challenge, id, routes.creator_users].join("/"), state
  )
  map_objects(
    client.get(route), Wes::Data::API::Model::CreatorUser
  )
end

#videos(state = nil) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/wes/data/api/model/challenge.rb', line 31

def videos(state = nil)
  route = add_state(
    [routes.challenge, id, routes.videos].join("/"), state
  )
  map_objects(
    client.get(route), Wes::Data::API::Model::Video
  )
end