ruby-json-home 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_home.rb +12 -10
- data/lib/ruby-json-home.rb +1 -1
- data/ruby-json-home.gemspec +15 -14
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e989a483c3cf9e0775337128c1dce711e073f6e
|
4
|
+
data.tar.gz: bbe903bf2c2b5de92e525f63f8f2837c075cc949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6df672465490dc400a1732372ebff2b0332595a5253a0855ef05914d54b16331fd4d4196a1ca17df76a586ac80b3d272004cc65aa6ba7e6689974da08124c23
|
7
|
+
data.tar.gz: 8e08d2efd35be25dc26280dbddbdf8c722319c442b07a13d781b3769e5baad59141d5cf698c606eec56b495f82feeaa3806263c918613feb75e2012a7c0df346
|
data/lib/json_home.rb
CHANGED
@@ -33,7 +33,7 @@ class JSONHome
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def reload(local_resources = nil)
|
36
|
-
Net::HTTP.start(@base_uri.host, @base_uri.port) do |http|
|
36
|
+
Net::HTTP.start(@base_uri.host, @base_uri.port, :use_ssl => @base_uri.scheme == 'https') do |http|
|
37
37
|
req = if local_resources.is_a?(Hash)
|
38
38
|
r = Net::HTTP::Put.new(@base_uri.request_uri)
|
39
39
|
r.body = JSON.generate('resources' => with_namespaces(local_resources))
|
@@ -80,7 +80,8 @@ class JSONHome
|
|
80
80
|
data = resources[resource.to_s]
|
81
81
|
|
82
82
|
if data['href'].is_a?(String)
|
83
|
-
data['href']
|
83
|
+
uri = data['href']
|
84
|
+
unknown_keys = params.keys
|
84
85
|
elsif data['href-template'].is_a?(String)
|
85
86
|
uri = data['href-template']
|
86
87
|
unknown_keys = (params.keys - data['href-vars'].keys)
|
@@ -89,16 +90,17 @@ class JSONHome
|
|
89
90
|
self.warn("Missing key '#{key}' in ForeignLinks#uri call") unless params[key]
|
90
91
|
uri = uri.gsub("{#{key}}", params[key].to_s)
|
91
92
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
93
|
+
end
|
94
|
+
|
95
|
+
if self.use_additional_params and unknown_keys.any?
|
96
|
+
additional_params = URI.encode_www_form params.select{|k, v| unknown_keys.include? k }
|
97
|
+
if uri.include? '?'
|
98
|
+
uri + '&' + additional_params
|
99
99
|
else
|
100
|
-
uri
|
100
|
+
uri + '?' + additional_params
|
101
101
|
end
|
102
|
+
else
|
103
|
+
uri
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
data/lib/ruby-json-home.rb
CHANGED
data/ruby-json-home.gemspec
CHANGED
@@ -12,25 +12,26 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
15
|
+
# encoding: utf-8
|
16
|
+
|
17
|
+
$:.push File.expand_path('../lib', __FILE__)
|
18
|
+
require 'ruby-json-home'
|
18
19
|
|
19
20
|
Gem::Specification.new do |s|
|
20
|
-
s.name =
|
21
|
+
s.name = 'ruby-json-home'
|
21
22
|
s.version = RubyJSONHome::VERSION
|
22
23
|
s.platform = Gem::Platform::RUBY
|
23
|
-
s.authors = [
|
24
|
-
s.email = [
|
25
|
-
s.homepage =
|
26
|
-
s.summary =
|
24
|
+
s.authors = ['Till Schulte-Coerne', 'Willem van Kerkhof']
|
25
|
+
s.email = ['till.schulte-coerne@innoq.com', 'willem.van-kerkhof@innoq.com']
|
26
|
+
s.homepage = 'http://github.com/innoq/ruby-json-home'
|
27
|
+
s.summary = 'A client for json-home'
|
27
28
|
s.description = s.summary
|
28
29
|
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
29
30
|
|
30
|
-
s.add_dependency
|
31
|
+
s.add_dependency 'bundler'
|
31
32
|
|
32
|
-
s.files = %w(LICENSE README.md Rakefile ruby-json-home.gemspec) + Dir.glob(
|
33
|
-
s.test_files
|
34
|
-
s.executables
|
35
|
-
s.require_paths = [
|
36
|
-
end
|
33
|
+
s.files = %w(LICENSE README.md Rakefile ruby-json-home.gemspec) + Dir.glob('{lib,test}/**/*')
|
34
|
+
s.test_files = Dir.glob '{test}/**/*'
|
35
|
+
s.executables = Dir.glob '{bin}/**/*'
|
36
|
+
s.require_paths = ['lib']
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-json-home
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Till Schulte-Coerne
|
8
|
+
- Willem van Kerkhof
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -27,6 +28,7 @@ dependencies:
|
|
27
28
|
description: A client for json-home
|
28
29
|
email:
|
29
30
|
- till.schulte-coerne@innoq.com
|
31
|
+
- willem.van-kerkhof@innoq.com
|
30
32
|
executables: []
|
31
33
|
extensions: []
|
32
34
|
extra_rdoc_files:
|