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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1030e7427ab1393c68f0f03b306b841e237c3eed
4
- data.tar.gz: 4f6630aae34aac32caee6c9ef0b449233a823b42
3
+ metadata.gz: b5df0b41e067304be736fe4b4e6471d9fe1662d7
4
+ data.tar.gz: 88c8a126b6b0922082beb52fd985d09282a972ce
5
5
  SHA512:
6
- metadata.gz: 137ec48b052e6fda33489b30988724b83ec96b423d2e008304854971bab427ff8c02563e34adc4b04bf404c097b0028cdcba49ab7c1abe755402197a99f0ee48
7
- data.tar.gz: 2a21fb9f0f11365fe65e66bcb02096aa66ce29b735a865179bbf2f1d425514d20449553877d46014ecefe84d53c62f53131ea4dc7cfb530886a740eb83cc46cb
6
+ metadata.gz: ac3c43362ec8da80e8028ff612fc9bfa7a92c55aa2e40dd5f995f8a3395e2672ef370fa91c8d0e0a5e6e83736c8838ba7946177dae66da3eb540a0de0cd22270
7
+ data.tar.gz: c2ec6269eded759af22fa5970b17b0a5a84183cd1361ef0f68669bd111079cacc650d3f9f8d3ecedb42b2fc3a5f60f42c0758d51f27b9326ee428b17bdab88fb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- consumer (0.0.3)
4
+ consumer (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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")
@@ -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 }
@@ -1,3 +1,3 @@
1
1
  module Consumer
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -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.3
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-01-28 00:00:00.000000000 Z
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.4.5
140
+ rubygems_version: 2.2.2
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Simple gem to consume json api