Class: Wes::Data::API::Model::CreatorUser
- Defined in:
- lib/wes/data/api/model/creator_user.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #address(fetch: false) ⇒ Object
- #assign_collectives(collective_ids) ⇒ Object
- #submissions(state: nil, fetch: false) ⇒ Object
- #transactions(limit = 50, offset = nil) ⇒ Object
- #update(changes) ⇒ Object
- #videos(fetch: false, state: nil, not_under_nda: false, limit: 12, offset: 0) ⇒ Object
Methods inherited from Base
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
#address(fetch: false) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/wes/data/api/model/creator_user.rb', line 13 def address(fetch: false) route = [ routes.creator_user, id, routes.address ].join('/') records = fetch ? client.get(route) : @attributes.addresses map_objects( records, Wes::Data::API::Model::Address, [false] ) end |
#assign_collectives(collective_ids) ⇒ Object
24 25 26 27 28 |
# File 'lib/wes/data/api/model/creator_user.rb', line 24 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
30 31 32 33 34 35 36 |
# File 'lib/wes/data/api/model/creator_user.rb', line 30 def submissions(state: nil, fetch: false) records = fetch || !state.nil? ? fetch_submissions(state) : @attributes.submissions map_objects( records, Wes::Data::API::Model::Submission ) end |
#transactions(limit = 50, offset = nil) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/wes/data/api/model/creator_user.rb', line 64 def transactions(limit = 50, offset = nil) route = apply_pagination( [routes.creator_user, id, routes.transactions].join('/'), limit, offset ) records = client.get(route) records.map_results(Wes::Data::API::Model::Transaction) end |
#update(changes) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/wes/data/api/model/creator_user.rb', line 38 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, limit: 12, offset: 0) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/wes/data/api/model/creator_user.rb', line 47 def videos(fetch: false, state: nil, not_under_nda: false, limit: 12, offset: 0) route = [ routes.creator_user, id, routes.videos, state ].compact.join('/') route = format('%s?not_under_nda', route) if not_under_nda if state == 'not-pending' route = apply_pagination(route, limit, offset) attributes = client.get(route) attributes.map_results(Wes::Data::API::Model::Video) else records = fetch ? client.get(route) : @attributes.videos map_objects(records, Wes::Data::API::Model::Video) end end |