json_api_client 0.7.1 → 0.8.0

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: cd50c912be37cfaa8ead84b20c023ab79a94f257
4
- data.tar.gz: 2a67f3e6aa19bd595576edd9d545dfb8f0361f9e
3
+ metadata.gz: dd8f9ac0212ca4fcb8d9cf42de90d3c785a9a207
4
+ data.tar.gz: a522a5b045fa0dbf337ad6e7da4eb147940c6ad6
5
5
  SHA512:
6
- metadata.gz: ea477831ece6014e86aeb9ac1ab7d4b88126adbeaff79fa556b8674e67e4cadb3b16f32a5530369c6646f7f8fbb3f8f00ddd6aadfde50d19558e3a435d1cd09e
7
- data.tar.gz: c2748f7e4a570f95fe690748f3e8d168a23a05ed92e6872b437c122d801016436bbc14d1a05cbfae32efd36ab5411927b6616c5e3ad3ed4de94bc2aae66c2473
6
+ metadata.gz: e7c0439be92a37d160da10076a88a2a83206fb92ef9d8508877945ad045477b284cb504353f5376401282b55b58db7f46265dbac31a21fca7b7bac7843524026
7
+ data.tar.gz: 9bbb62d96189a5ba062b8bbcf13abbe51bc14bcea0c604898e2e6ff3bb9a13139d15797b009be56812da103187af27701a64fc53b8a5ea38efe8c9bbc74a094d
@@ -30,7 +30,7 @@ module JsonApiClient
30
30
  def path(params = nil)
31
31
  parts = [table_name]
32
32
  if params
33
- slurp = params.slice(*prefix_params)
33
+ slurp = params.symbolize_keys.slice(*prefix_params)
34
34
  prefix_params.each do |param|
35
35
  params.delete(param)
36
36
  end
@@ -8,11 +8,16 @@ module JsonApiClient
8
8
  @klass = klass
9
9
  build_params(args)
10
10
  @headers = klass.default_headers.dup
11
+ build_path(@params)
12
+ end
11
13
 
14
+ def build_path(parameters)
12
15
  @path = begin
13
- p = klass.path(@params)
14
- if @params.has_key?(klass.primary_key) && !@params[klass.primary_key].is_a?(Array)
15
- p = File.join(p, @params.delete(klass.primary_key).to_s)
16
+ p = klass.path(parameters)
17
+ if parameters.has_key?(klass.primary_key) && !parameters[klass.primary_key].is_a?(Array)
18
+ resource_id = parameters.delete(klass.primary_key).to_s
19
+ encoded_resource_id = Addressable::URI.encode_component(resource_id, Addressable::URI::CharacterClasses::UNRESERVED)
20
+ p = File.join(p, encoded_resource_id)
16
21
  end
17
22
  p
18
23
  end
@@ -7,6 +7,11 @@ module JsonApiClient
7
7
  @params = {klass.resource_name => args.except(klass.primary_key)}
8
8
  end
9
9
 
10
+ # we've nested the parameters, so un-nest them
11
+ def build_path(parameters)
12
+ super(parameters[klass.resource_name])
13
+ end
14
+
10
15
  end
11
16
  end
12
17
  end
@@ -1,3 +1,3 @@
1
1
  module JsonApiClient
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.0"
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: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-06 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: addressable
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.2'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: webmock
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
149
  version: '0'
136
150
  requirements: []
137
151
  rubyforge_project:
138
- rubygems_version: 2.2.0
152
+ rubygems_version: 2.2.2
139
153
  signing_key:
140
154
  specification_version: 4
141
155
  summary: Build client libraries compliant with specification defined by jsonapi.org