Class: Wes::Data::API::Model::BrandUser

Inherits:
Base
  • Object
show all
Defined in:
lib/wes/data/api/model/brand_user.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

#exist?, #id, #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

#brands(fetch: false) ⇒ Object



18
19
20
21
22
23
# File 'lib/wes/data/api/model/brand_user.rb', line 18

def brands(fetch: false)
  records = fetch ? fetch_brands : @attributes.brands
  map_objects(
    records, Wes::Data::API::Model::Brand
  )
end

#update(changes) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/wes/data/api/model/brand_user.rb', line 9

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

  self
end