Class: Wes::Data::API::Model::CreatorUser

Inherits:
Base
  • Object
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

Constructor Details

This class inherits a constructor from Wes::Data::API::Model::Base

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



36
37
38
39
40
# File 'lib/wes/data/api/model/creator_user.rb', line 36

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) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/wes/data/api/model/creator_user.rb', line 11

def submissions(state = nil)
  route = add_state(
    [routes.creator_user, id, routes.submissions].join("/"), state
  )
  map_objects(
    client.get(route), Wes::Data::API::Model::Submission
  )
end

#update(changes) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/wes/data/api/model/creator_user.rb', line 20

def update(changes)
  route = [routes.creator_user, id].join("/")
  attributes = client.put(
    route, attributes.to_h.merge(changes)
  ).first

  self
end

#videosObject



29
30
31
32
33
34
# File 'lib/wes/data/api/model/creator_user.rb', line 29

def videos
  route = [routes.creator_user, id, routes.videos].join("/")
  map_objects(
    client.get(route), Wes::Data::API::Model::Video
  )
end