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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bba96e8360159bc95c214c30eabb3fc8110afc44
4
- data.tar.gz: 0e06f41c3f1b27a969d7c54a353fbc937dfb9e11
3
+ metadata.gz: 9e989a483c3cf9e0775337128c1dce711e073f6e
4
+ data.tar.gz: bbe903bf2c2b5de92e525f63f8f2837c075cc949
5
5
  SHA512:
6
- metadata.gz: 67111dca97aac5329ddac374d83ed7338c3a8cd8f25f060352aa75e2d3ecf9a3ac38a2b0a3488bd6215837110801e4874807d854e1bfc1261602db618af051b8
7
- data.tar.gz: 0ed557f7fdfaf5685089d1bd0035b7c48d1ec4e9f281f9b925abe58573208f5574a7e4582ee8585c220579bdecc7770a67b9a04b3b0ace8042597d1232b94e0f
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
- if self.use_additional_params and unknown_keys.any?
93
- additional_params = URI.encode_www_form params.select{|k, v| unknown_keys.include? k }
94
- if uri.include? '?'
95
- uri + '&' + additional_params
96
- else
97
- uri + '?' + additional_params
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
 
@@ -18,7 +18,7 @@ require 'json_home'
18
18
 
19
19
  module RubyJSONHome
20
20
 
21
- VERSION = '0.0.2'
21
+ VERSION = '0.0.4'
22
22
 
23
23
  end
24
24
 
@@ -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
- # -*- encoding: utf-8 -*-
16
- $:.push File.expand_path("../lib", __FILE__)
17
- require "ruby-json-home"
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 = "ruby-json-home"
21
+ s.name = 'ruby-json-home'
21
22
  s.version = RubyJSONHome::VERSION
22
23
  s.platform = Gem::Platform::RUBY
23
- s.authors = ["Till Schulte-Coerne"]
24
- s.email = ["till.schulte-coerne@innoq.com"]
25
- s.homepage = "http://github.com/innoq/ruby-json-home"
26
- s.summary = "A client for json-home"
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 "bundler"
31
+ s.add_dependency 'bundler'
31
32
 
32
- s.files = %w(LICENSE README.md Rakefile ruby-json-home.gemspec) + Dir.glob("{lib,test}/**/*")
33
- s.test_files = Dir.glob("{test}/**/*")
34
- s.executables = Dir.glob("{bin}/**/*")
35
- s.require_paths = ["lib"]
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.2
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-09-11 00:00:00.000000000 Z
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: