Class: Podium::Resource
- Inherits:
-
Object
- Object
- Podium::Resource
- Defined in:
- lib/podium/resource.rb
Defined Under Namespace
Classes: VersionMismatchError
Constant Summary collapse
- HTTP_OPTS =
{ open_timeout: 5, read_timeout: 5, write_timeout: 5, ssl_timeout: 5, }
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #fetch(context = {}) ⇒ Object
-
#initialize(uri, name) ⇒ Resource
constructor
A new instance of Resource.
- #manifest ⇒ Object
Constructor Details
#initialize(uri, name) ⇒ Resource
Returns a new instance of Resource.
21 22 23 24 |
# File 'lib/podium/resource.rb', line 21 def initialize(uri, name) @uri = uri @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/podium/resource.rb', line 19 def name @name end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
19 20 21 |
# File 'lib/podium/resource.rb', line 19 def uri @uri end |
Instance Method Details
#fetch(context = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/podium/resource.rb', line 30 def fetch(context = {}) response = make_request(content_uri, context) check_podlet_version!(response["podlet-version"]) response.body.force_encoding("UTF-8") end |
#manifest ⇒ Object
26 27 28 |
# File 'lib/podium/resource.rb', line 26 def manifest @manifest ||= fetch_manifest end |