Class: Wes::Data::API::Model::CreatorUser
- Inherits:
-
Base
- Object
- Base
- Wes::Data::API::Model::CreatorUser
show all
- Defined in:
- lib/wes/data/api/model/creator_user.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes
Instance Method Summary
collapse
Methods inherited from Base
#exist?, #initialize
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Wes::Data::API::Model::Base
Instance Method Details
#assign_collectives(collective_ids) ⇒ Object
11
12
13
14
15
|
# File 'lib/wes/data/api/model/creator_user.rb', line 11
def assign_collectives(collective_ids)
validate_collectives(collective_ids)
records = create_collectives(collective_ids)
map_objects(records, Wes::Data::API::Model::Collective)
end
|
#submissions(state: nil, fetch: false) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/wes/data/api/model/creator_user.rb', line 17
def submissions(state: nil, fetch: false)
records = fetch || !state.nil? ? fetch_submissions(state)
: @attributes.submissions
map_objects(
records, Wes::Data::API::Model::Submission
)
end
|
#update(changes) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/wes/data/api/model/creator_user.rb', line 25
def update(changes)
route = [routes.creator_user, id].join('/')
@attributes = client.put(
route, @attributes.to_h.merge(changes)
).first
self
end
|
#videos(fetch: false, state: nil, not_under_nda: false) ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/wes/data/api/model/creator_user.rb', line 34
def videos(fetch: false, state: nil, not_under_nda: false)
route = [
routes.creator_user, id, routes.videos, state
].compact.join('/')
route = format('%s?not_under_nda', route) if not_under_nda
records = fetch ? client.get(route) : @attributes.videos
map_objects(records, Wes::Data::API::Model::Video)
end
|