Class: Vidsy::Data::API::Brand

Inherits:
Object
  • Object
show all
Defined in:
lib/vidsy/data/api/brand.rb

Class Method Summary collapse

Instance Method Summary collapse

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

.allObject



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

#allObject



20
21
22
# File 'lib/vidsy/data/api/brand.rb', line 20

def all
  client.get "#{routes.brands}"
end

#challengesObject

Raises:

  • (ArgumentError)


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