chain 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chain/url.rb +8 -3
- data/lib/chain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78f46a473a0b2ca4c82513bb2d4e492cb6e85c46
|
4
|
+
data.tar.gz: ef312f8a83617ba52da44b9f304298c68306932a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36763e8dc1cdf79e8fec74b121b0344412bd9465cc5941264f35888d82b7883421550676e8cc2ee23eb38814c90badaaa4fda4245e318306c2e2ef334dbe6b8f
|
7
|
+
data.tar.gz: 9d04368dacab30f6ca15eaa377599fa6e158e41a724facda1adaf356ba3dbf9fe5f560b8624729a4550e95a48eccdf9fa0bdd61b1359589bed1ddc41ebd2e127
|
data/lib/chain/url.rb
CHANGED
@@ -37,6 +37,9 @@ module Chain
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def method_missing(method_name, path=nil, params={}, &block)
|
40
|
+
if path.is_a? Hash
|
41
|
+
path, params = nil, path.merge(params)
|
42
|
+
end
|
40
43
|
|
41
44
|
# If this is a bang method, prepare to run a _fetch.
|
42
45
|
is_bang_method = method_name.to_s.chars.last == "!"
|
@@ -47,7 +50,10 @@ module Chain
|
|
47
50
|
# should call into #{base}/api/items/My%20Item?f=json
|
48
51
|
combined_path = [method_name, path].compact.join("/")
|
49
52
|
|
50
|
-
|
53
|
+
# If the combined_path is empty (i.e., we're just evaluating parameters from bracket
|
54
|
+
# notation), then we're just going to reuse the url Otherwise, assume that combined_path
|
55
|
+
# appends onto the path.
|
56
|
+
url = combined_path.empty? ? @url : URI.join("#{@url}/", combined_path)
|
51
57
|
|
52
58
|
self.class.new(url, @base_url || self, params, &block).tap do |request|
|
53
59
|
return request._fetch(params, &block) if is_bang_method || !params.empty?
|
@@ -59,8 +65,7 @@ module Chain
|
|
59
65
|
path, params = nil, path.merge(params)
|
60
66
|
end
|
61
67
|
|
62
|
-
|
63
|
-
method_missing(url, nil, **params)
|
68
|
+
method_missing(nil, path, **params)
|
64
69
|
end
|
65
70
|
|
66
71
|
def _fetch(params={}, &block)
|
data/lib/chain/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Novak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|