json_api_client 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70ed96e8dad9bdeec5923280be1cd87e1f1d41b2
4
- data.tar.gz: 6a3e93637e3b6dd1f744962088766e6a9d785891
3
+ metadata.gz: 97343e5f4ab100e19f26bc047874835f90d8e76a
4
+ data.tar.gz: 6009f0ddb1f43af631e3b10a6e0bd9bd5cf7c9c7
5
5
  SHA512:
6
- metadata.gz: 3b435a4a8989ea0fd2b5571728feb3a175c2e7ad300c51769c245c7b4775dd5318ce9e087602d08d988ce6524339a63d43cb8ff0dc467c1a4bd3f17fd429a5f2
7
- data.tar.gz: 994419ad14dcb898d9a7dd753834ac582398ea841f3671d5b8f234d908d536d400a3a601ea2fcf566b4b839be5fd2421123277742bb7082bee36b4fba4724252
6
+ metadata.gz: f35608521648cf8337507f466831598a4bb77e5254f60c18a0bbeeac854c8832eeb5b7d8faf63b356e953d1bb4f11958339c98e9d453e69dab21d50c3b0e211d
7
+ data.tar.gz: e3a07f87d572b36eab928742f87688d38dc02bbb2f65e62ee8e30f71fc125a6c1c5715f32e17e62a6d0a5bc63ab7f4386d76ccbecdfb9ed6719ae5b670accc72
data/README.md CHANGED
@@ -381,6 +381,23 @@ module MyApi
381
381
  end
382
382
  ```
383
383
 
384
+ ##### Specifying an HTTP Proxy
385
+
386
+ All resources have a class method ```connection_options``` used to pass options to the JsonApiClient::Connection initializer.
387
+
388
+ ```ruby
389
+ MyApi::Base.connection_options[:proxy] = 'http://proxy.example.com'
390
+ MyApi::Base.connection do |connection|
391
+ # ...
392
+ end
393
+
394
+ module MyApi
395
+ class User < Base
396
+ # will use the customized connection with proxy
397
+ end
398
+ end
399
+ ```
400
+
384
401
  ### Custom Parser
385
402
 
386
403
  You can configure your API client to use a custom parser that implements the `parse` class method. It should return a `JsonApiClient::ResultSet` instance. You can use it by setting the parser attribute on your model:
@@ -5,8 +5,9 @@ module JsonApiClient
5
5
 
6
6
  def initialize(options = {})
7
7
  site = options.fetch(:site)
8
+ connection_options = options.slice(:proxy, :ssl, :request, :headers, :params)
8
9
  adapter_options = Array(options.fetch(:adapter, Faraday.default_adapter))
9
- @faraday = Faraday.new(site) do |builder|
10
+ @faraday = Faraday.new(site, connection_options) do |builder|
10
11
  builder.request :json
11
12
  builder.use Middleware::JsonRequest
12
13
  builder.use Middleware::Status
@@ -410,8 +410,9 @@ module JsonApiClient
410
410
  return nil unless relationship_definitions = relationships[method]
411
411
 
412
412
  # look in included data
413
- data = last_result_set.included.data_for(method, relationship_definitions)
414
- return data if data
413
+ if relationship_definitions.key?("data")
414
+ return last_result_set.included.data_for(method, relationship_definitions)
415
+ end
415
416
 
416
417
  if association = association_for(method)
417
418
  # look for a defined relationship url
@@ -1,3 +1,3 @@
1
1
  module JsonApiClient
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-10 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport