consumer 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/consumer.gemspec +1 -1
- data/lib/consumer/proxy.rb +3 -1
- data/lib/consumer/version.rb +1 -1
- data/spec/consumer_spec.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5df0b41e067304be736fe4b4e6471d9fe1662d7
|
4
|
+
data.tar.gz: 88c8a126b6b0922082beb52fd985d09282a972ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac3c43362ec8da80e8028ff612fc9bfa7a92c55aa2e40dd5f995f8a3395e2672ef370fa91c8d0e0a5e6e83736c8838ba7946177dae66da3eb540a0de0cd22270
|
7
|
+
data.tar.gz: c2ec6269eded759af22fa5970b17b0a5a84183cd1361ef0f68669bd111079cacc650d3f9f8d3ecedb42b2fc3a5f60f42c0758d51f27b9326ee428b17bdab88fb
|
data/Gemfile.lock
CHANGED
data/consumer.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["nadilsons@gmail.com"]
|
11
11
|
spec.summary = %q{Simple gem to consume json api}
|
12
12
|
spec.description = ""
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/nadilsons/consumer"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/consumer/proxy.rb
CHANGED
@@ -11,7 +11,9 @@ module Consumer
|
|
11
11
|
return methodize_me(self[_method])
|
12
12
|
end
|
13
13
|
|
14
|
-
def link(rel)
|
14
|
+
def link(rel = nil)
|
15
|
+
return method_missing(:link) if rel.nil?
|
16
|
+
|
15
17
|
_link = self["link"] || self["links"]
|
16
18
|
_link = [_link].flatten
|
17
19
|
_link = _link.find {|l| l.is_a?(Hash) and l["rel"] == rel }
|
data/lib/consumer/version.rb
CHANGED
data/spec/consumer_spec.rb
CHANGED
@@ -85,12 +85,14 @@ describe Consumer do
|
|
85
85
|
context "when node is link" do
|
86
86
|
context "when is an array" do
|
87
87
|
let(:link) { {"link" => example } }
|
88
|
+
its(:link) { should be_an_instance_of Array }
|
88
89
|
it_behaves_like "first item"
|
89
90
|
it_behaves_like "second item"
|
90
91
|
end
|
91
92
|
|
92
93
|
context "when is a hash" do
|
93
94
|
let(:link) { {"link" => example.first } }
|
95
|
+
its(:link) { should be_an_instance_of Consumer::Proxy }
|
94
96
|
it_behaves_like "first item"
|
95
97
|
it { expect(subject.link("externo")).to be_nil }
|
96
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consumer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nadilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,7 +117,7 @@ files:
|
|
117
117
|
- spec/fixtures/example.json
|
118
118
|
- spec/fixtures/link.json
|
119
119
|
- spec/spec_helper.rb
|
120
|
-
homepage:
|
120
|
+
homepage: https://github.com/nadilsons/consumer
|
121
121
|
licenses:
|
122
122
|
- MIT
|
123
123
|
metadata: {}
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.2.2
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Simple gem to consume json api
|