Skip to content

Releases: local-ch/lhc

v3.8.0

07 Nov 10:15
Compare
Choose a tag to compare

You can also access response data directly through the response object (with square bracket notation only):

  LHC.json.get(url: 'http://datastore/entry/1')[:name]

This makes accessing the data object with .data unnecessary and direct data retrieval a little more convenient.

v3.7.3

03 Nov 12:10
Compare
Choose a tag to compare

Bump resolves some version conflicts with previous 'pre' release

v3.7.2

03 Nov 12:00
Compare
Choose a tag to compare

Minor fixes in regards of requiring files and std. libraries and gracefully initializing constants.

v3.7.1

26 Oct 09:34
Compare
Choose a tag to compare

3.7.0 introduced data accessing improvements but also improved the following different behaviour:

before 3.7.0

LHC.get('something').data.not_existing_key # nil

after 3.7.0

LHC.get('something').data.not_existing_key
# throws no method error

v3.7.0

19 Oct 11:03
Compare
Choose a tag to compare

Accessing data

The response data can be access with dot-notation and square-bracket notation. You can convert response data to open structs or json (if the response format is json).

  response = LHC.request(url: 'http://datastore/entry/1')
  response.data.as_open_struct #<OpenStruct name='local.ch'>
  response.data.as_json # { name: 'local.ch' }
  response.data.name # 'local.ch'
  response.data[:name] # 'local.ch'

v3.6.1

30 Aug 09:56
Compare
Choose a tag to compare
  • fix active support dependency

v3.6.0

25 Aug 14:21
Compare
Choose a tag to compare

Custom error handling

You can provide custom error handlers to handle errors happening during the request.

If a error handler is provided nothing is raised.

If your error handler returns anything else but nil it replaces the response body.

handler = ->{ do_something; return {name: 'unknown'} }
response = LHC.get('http://something', error_handler: handler)
response.data.name # 'unknown'

v3.5.5

25 Jul 13:15
Compare
Choose a tag to compare
  • Fixes #56
  • Fixes some complex cases with names placeholders

v3.5.4

13 Jul 09:18
Compare
Choose a tag to compare

Fixes problem with URL-Templates containing . (dots)
e.g.

http://datastore/entries/:id.json

v3.5.3

17 Jun 16:09
Compare
Choose a tag to compare

Also sets the Accept header when format json is set.