Class: HalClient
- Inherits:
-
Object
- Object
- HalClient
- Extended by:
- EntryPointCovenienceMethods
- Defined in:
- lib/hal_client.rb,
lib/hal_client/version.rb,
lib/hal_client/curie_resolver.rb,
lib/hal_client/representation.rb,
lib/hal_client/representation_set.rb
Overview
Adapter used to access resources.
Defined Under Namespace
Modules: EntryPointCovenienceMethods Classes: CurieResolver, Representation, RepresentationSet
Constant Summary collapse
- VERSION =
"1.5.0"
Instance Method Summary collapse
-
#get(url, options = {}) ⇒ Object
Returns a
Representationof the resource identified byurl. -
#initialize(options = {}) ⇒ HalClient
constructor
Initializes a new client instance.
Constructor Details
#initialize(options = {}) ⇒ HalClient
Initializes a new client instance
options - hash of configuration options
:accept - one or more content types that should be
prepended to the Accept header field of each request.
15 16 17 |
# File 'lib/hal_client.rb', line 15 def initialize(={}) @default_accept = .fetch(:accept, 'application/hal+json') end |
Instance Method Details
#get(url, options = {}) ⇒ Object
Returns a Representation of the resource identified by url.
url - The URL of the resource of interest.
options - set of options to pass to RestClient#get
23 24 25 26 |
# File 'lib/hal_client.rb', line 23 def get(url, ={}) resp = RestClient.get url, () Representation.new self, MultiJson.load(resp) end |