Class: Wes::Data::API::Video

Inherits:
Object
  • Object
show all
Extended by:
Base
Defined in:
lib/wes/data/api/video.rb

Class Method Summary collapse

Methods included from Base

add_state, apply_pagination, client, configuration, map_objects, routes

Class Method Details

.create(options) ⇒ Object



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

def create(options)
  attributes = client.post(routes.video, options).first
  attributes.nil? ? nil : model_klass.new(attributes)
end

.feed(limit, offset) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/wes/data/api/video.rb', line 22

def feed(limit, offset)
  route      = apply_pagination(
							[routes.videos, routes.feed].join('/'),
							limit,
							offset
						)
  attributes = client.get(route)
  attributes.map_results(model_klass)
end

.find(key, value) ⇒ Object



16
17
18
19
20
# File 'lib/wes/data/api/video.rb', line 16

def find(key, value)
  route      = generate_route(key, value)
  attributes = client.get(route).first
  attributes.nil? ? nil : model_klass.new(attributes)
end