Class: OpenAssets::Protocol::HttpAssetDefinitionLoader
- Inherits:
-
Object
- Object
- OpenAssets::Protocol::HttpAssetDefinitionLoader
- Defined in:
- lib/openassets/protocol/http_asset_definition_loader.rb
Overview
Asset Definition loader for http or https uri scheme
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ HttpAssetDefinitionLoader
constructor
A new instance of HttpAssetDefinitionLoader.
-
#load ⇒ Object
load asset definition.
Constructor Details
#initialize(url) ⇒ HttpAssetDefinitionLoader
Returns a new instance of HttpAssetDefinitionLoader.
9 10 11 |
# File 'lib/openassets/protocol/http_asset_definition_loader.rb', line 9 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/openassets/protocol/http_asset_definition_loader.rb', line 7 def url @url end |
Instance Method Details
#load ⇒ Object
load asset definition
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/openassets/protocol/http_asset_definition_loader.rb', line 14 def load begin definition = AssetDefinition.parse_json(RestClient::Request.execute(:method => :get, :url => url, :timeout => 10, :open_timeout => 10)) definition.asset_definition_url = url definition rescue => e puts e nil end end |