Class: Wes::Data::API::Challenge
- Inherits:
-
Base
- Object
- Base
- Wes::Data::API::Challenge
show all
- Defined in:
- lib/wes/data/api/challenge.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
client, configuration, create, #exist?, #initialize, mapped_objects, #method_missing, routes, #update
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Wes::Data::API::Base
Class Method Details
.all ⇒ Object
12
13
14
|
# File 'lib/wes/data/api/challenge.rb', line 12
def all
mapped_objects(routes.challenges)
end
|
.closed ⇒ Object
16
17
18
|
# File 'lib/wes/data/api/challenge.rb', line 16
def closed
mapped_objects("#{routes.challenges}/closed")
end
|
.drafts ⇒ Object
20
21
22
|
# File 'lib/wes/data/api/challenge.rb', line 20
def drafts
mapped_objects("#{routes.challenges}/drafts")
end
|
.find(id) ⇒ Object
8
9
10
|
# File 'lib/wes/data/api/challenge.rb', line 8
def find(id)
super("#{routes.challenge}/#{id}")
end
|
.open ⇒ Object
24
25
26
|
# File 'lib/wes/data/api/challenge.rb', line 24
def open
mapped_objects("#{routes.challenges}/open")
end
|
Instance Method Details
#purchased_videos ⇒ Object
29
30
31
32
|
# File 'lib/wes/data/api/challenge.rb', line 29
def purchased_videos
id_set?
mapped_objects("#{routes.challenge}/#{id}#{routes.videos}/purchased")
end
|
#rewards ⇒ Object
34
35
36
37
|
# File 'lib/wes/data/api/challenge.rb', line 34
def rewards
id_set?
mapped_objects("#{routes.challenge}/#{id}/rewards")
end
|
#users(state = nil) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/wes/data/api/challenge.rb', line 39
def users(state = nil)
id_set?
route = state ? "#{routes.challenge}/#{id}/users/#{state}"
: "#{routes.challenge}/#{id}/users"
mapped_objects(route)
end
|
#videos ⇒ Object
46
47
48
49
|
# File 'lib/wes/data/api/challenge.rb', line 46
def videos
id_set?
mapped_objects("#{routes.challenge}/#{id}#{routes.videos}")
end
|