Class: Vidsy::Data::API::Challenge
- Inherits:
-
Object
- Object
- Vidsy::Data::API::Challenge
- Defined in:
- lib/vidsy/data/api/challenge.rb
Class Method Summary collapse
Instance Method Summary collapse
- #closed ⇒ Object
- #find(id) ⇒ Object
-
#initialize(id = nil) ⇒ Challenge
constructor
A new instance of Challenge.
- #open ⇒ Object
- #videos ⇒ Object
Constructor Details
#initialize(id = nil) ⇒ Challenge
Returns a new instance of Challenge.
8 9 10 |
# File 'lib/vidsy/data/api/challenge.rb', line 8 def initialize(id = nil) @id = id end |
Class Method Details
.find(id) ⇒ Object
12 13 14 |
# File 'lib/vidsy/data/api/challenge.rb', line 12 def self.find(id) new.find id end |
.open ⇒ Object
16 17 18 |
# File 'lib/vidsy/data/api/challenge.rb', line 16 def self.open new.open end |
Instance Method Details
#closed ⇒ Object
20 21 22 |
# File 'lib/vidsy/data/api/challenge.rb', line 20 def closed client.get "#{routes.challenges}/closed" end |
#find(id) ⇒ Object
24 25 26 |
# File 'lib/vidsy/data/api/challenge.rb', line 24 def find(id) client.get("#{routes.challenge}/#{id}").first end |
#open ⇒ Object
28 29 30 |
# File 'lib/vidsy/data/api/challenge.rb', line 28 def open client.get "#{routes.challenges}/open" end |
#videos ⇒ Object
32 33 34 35 |
# File 'lib/vidsy/data/api/challenge.rb', line 32 def videos raise(ArgumentError, "ID not set for Challenge") if id.nil? client.get "#{routes.challenge}/#{id}#{routes.videos}" end |