Class: Podium::Resource

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



19
20
21
# File 'lib/podium/resource.rb', line 19

def name
  @name
end

#uriObject (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

#manifestObject



26
27
28
# File 'lib/podium/resource.rb', line 26

def manifest
  @manifest ||= fetch_manifest
end