Class: MyJohnDeereApi::Request::Collection::Assets
- Defined in:
- lib/my_john_deere_api/request/collection/assets.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(attributes) ⇒ Object
Create a new asset.
-
#find(asset_id) ⇒ Object
Retrieve an asset from JD.
-
#model ⇒ Object
This is the class used to model the data.
-
#resource ⇒ Object
The resource path for the first page in the collection.
Methods inherited from Base
#accessor, #all, #count, #each, #initialize
Constructor Details
This class inherits a constructor from MyJohnDeereApi::Request::Collection::Base
Instance Method Details
#create(attributes) ⇒ Object
Create a new asset
22 23 24 25 |
# File 'lib/my_john_deere_api/request/collection/assets.rb', line 22 def create(attributes) merged_attributes = attributes.merge(organization_id: associations[:organization]) Create::Asset.new(client, merged_attributes).object end |
#find(asset_id) ⇒ Object
Retrieve an asset from JD
30 31 32 |
# File 'lib/my_john_deere_api/request/collection/assets.rb', line 30 def find(asset_id) Individual::Asset.new(client, asset_id).object end |
#model ⇒ Object
This is the class used to model the data
15 16 17 |
# File 'lib/my_john_deere_api/request/collection/assets.rb', line 15 def model MyJohnDeereApi::Model::Asset end |
#resource ⇒ Object
The resource path for the first page in the collection
8 9 10 |
# File 'lib/my_john_deere_api/request/collection/assets.rb', line 8 def resource "/organizations/#{associations[:organization]}/assets" end |