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

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Client

set_api_key, set_endpoint, set_routes, set_version

Constructor Details

#initialize(id = nil) ⇒ Brand

Returns a new instance of Brand.



7
8
9
# File 'lib/vidsy/data/api/brand.rb', line 7

def initialize(id = nil)
  @id = id
end

Class Method Details

.allObject



17
18
19
20
# File 'lib/vidsy/data/api/brand.rb', line 17

def self.all
  brands = get "#{routes.brands}"
  brands.size == 0 ? nil : brands
end

Instance Method Details

#challengesObject

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/vidsy/data/api/brand.rb', line 11

def challenges
  raise(ArgumentError, "ID not set for Brand") if id.nil?
  challenges = get "#{routes.brand}/#{id}/#{routes.challenges}"
  challenges.size == 0 ? nil : challenges
end