Class: GdsApi::AssetManager
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#asset(id) ⇒ Response?
Fetches an asset given the id.
-
#create_asset(asset) ⇒ Net::HTTPResponse
Creates an asset given attributes.
-
#update_asset(id, asset) ⇒ Net::HTTPResponse
Updates an asset given attributes.
Methods inherited from Base
#client, #create_client, #get_list!, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#asset(id) ⇒ Response?
Fetches an asset given the id
44 45 46 |
# File 'lib/gds_api/asset_manager.rb', line 44 def asset(id) get_json("#{base_url}/assets/#{id}") end |
#create_asset(asset) ⇒ Net::HTTPResponse
Creates an asset given attributes
Makes a ‘POST` request to the asset manager api to create an asset. The api accepts
the following attributes:
-
‘file` - a File object
17 18 19 |
# File 'lib/gds_api/asset_manager.rb', line 17 def create_asset(asset) post_multipart("#{base_url}/assets", { :asset => asset }) end |
#update_asset(id, asset) ⇒ Net::HTTPResponse
Updates an asset given attributes
Makes a ‘PUT` request to the asset manager api to update an asset. The api accepts the following attributes:
-
‘file` - a File object
33 34 35 |
# File 'lib/gds_api/asset_manager.rb', line 33 def update_asset(id, asset) put_multipart("#{base_url}/assets/#{id}", { :asset => asset }) end |