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