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

Inherits:
Base
  • Object
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

Constructor Details

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

Dynamic Method Handling

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

Class Method Details

.allObject



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

def all
  mapped_objects(routes.challenges)
end

.closedObject



16
17
18
# File 'lib/wes/data/api/challenge.rb', line 16

def closed
  mapped_objects("#{routes.challenges}/closed")
end

.draftsObject



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

.openObject



24
25
26
# File 'lib/wes/data/api/challenge.rb', line 24

def open
  mapped_objects("#{routes.challenges}/open")
end

Instance Method Details

#purchased_videosObject



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

#rewardsObject



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

#videosObject



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