zanoxrb 0.3 → 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: e259a4e6312026b1c4660963c4173c44a90b328c
4
- data.tar.gz: 997286ec7075c92a64c4c84b59059fd4c981f4b7
3
+ metadata.gz: 619cbe2a3526db513228244f180a67a3b3f493dd
4
+ data.tar.gz: 4e5bace7088bf59b45e64d39836466ed82f44c6f
5
5
  SHA512:
6
- metadata.gz: 661fdb1f33a9de6f8a5105673c5dac3efb30e4ba44dddb277394d3837b6fd9f6fc38891b8b2b3968b9eee412fa2553dc66104cd19be94be1325609b7df843c2e
7
- data.tar.gz: 9889e8f69ec3b9c081487ece8fb8fad05fd9b41cb487ff5c12dbd33ebbcbd0d6ea680ee5fafbb5fe06053b0db7497348acc37b869f86db8cc072dd82a0e3b23d
6
+ metadata.gz: 79558047d1956ffa69b617a23b1a120b3b52a7b6b94800bb63f16509a35400c1ad31a7ab21b15a29d38a7334aa92369b88f86fb70102ec3579f25e148cdc0468
7
+ data.tar.gz: 8d4f1f09239abe591fc568f981101cb6c3c053cf10ab563cc915a4ec723f185a8f3198f73793b1e6410bc3336111293ce456dc7014ce80d75d13004acf8db656
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zanoxrb (0.3)
4
+ zanoxrb (0.4)
5
5
  httparty (~> 0.13)
6
6
 
7
7
  GEM
@@ -38,6 +38,3 @@ DEPENDENCIES
38
38
  rspec (~> 3.3)
39
39
  rspec-collection_matchers (~> 1.1)
40
40
  zanoxrb!
41
-
42
- BUNDLED WITH
43
- 1.10.4
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ end
14
14
  task :test do
15
15
  FileUtils.cd 'specs' do
16
16
  Dir['*_spec.rb'].each do |spec|
17
- sh "rspec #{spec} --backtrace --color --format doc -r ./spec_helper.rb"
17
+ sh "rspec #{spec} --backtrace --color --format doc"
18
18
  end
19
19
  end
20
20
  end
@@ -60,8 +60,15 @@ module Zanox
60
60
 
61
61
  def method_missing(m, *args, &block)
62
62
  key = m.to_s
63
+
63
64
  response = @response[key] || @response["@#{key}"] || @response[camelize(key)]
64
- response.kind_of?(Hash) && response.length == 1 ? response.values.first : response
65
+ results = if response.kind_of?(Hash) && response.length == 1
66
+ response.values.first # sugar to get items (i.e. programItems)
67
+ else
68
+ response
69
+ end
70
+
71
+ key.end_with?('_items') && !results ? [] : results
65
72
  end
66
73
 
67
74
  private
@@ -23,5 +23,5 @@
23
23
  #++
24
24
 
25
25
  module Zanox
26
- VERSION = '0.3'
26
+ VERSION = '0.4'
27
27
  end
@@ -1,3 +1,5 @@
1
+ require_relative 'spec_helper'
2
+
1
3
  describe Zanox::API do
2
4
  describe '#request' do
3
5
  before :each do
@@ -36,6 +38,7 @@ describe Zanox::API do
36
38
  end
37
39
  end
38
40
 
41
+ # TODO: Implement this
39
42
  # context 'products#next_page!' do
40
43
  # let(:products) { Zanox::API.request('products', q: 'iPod', items: 50) }
41
44
  #
@@ -1,3 +1,5 @@
1
+ require_relative 'spec_helper'
2
+
1
3
  describe Zanox::API do
2
4
  describe '#request' do
3
5
  context 'profiles' do
@@ -1,3 +1,5 @@
1
+ require_relative 'spec_helper'
2
+
1
3
  describe Zanox::API do
2
4
  describe '#request' do
3
5
  context 'program applications' do
@@ -1,3 +1,5 @@
1
+ require_relative 'spec_helper'
2
+
1
3
  describe Zanox::API do
2
4
  describe '#request' do
3
5
  context 'programs' do
@@ -0,0 +1,25 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Zanox::API do
4
+ describe '#method_missing' do
5
+ context '*_items always returns an array' do
6
+ let(:response) { Zanox::API.request('programs') }
7
+
8
+ context 'has items' do
9
+ it 'returns one or more items' do
10
+ items = response.program_items
11
+ expect(items).to be_an(Array)
12
+ expect(items).to have_exactly(10).items
13
+ end
14
+ end
15
+
16
+ context 'has no items' do
17
+ it 'returns an empty array' do
18
+ items = response.tasukete_items
19
+ expect(items).to be_an(Array)
20
+ expect(items).to have_exactly(0).items
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zanoxrb
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,6 +91,7 @@ files:
91
91
  - specs/profiles_spec.rb
92
92
  - specs/program_application_spec.rb
93
93
  - specs/programs_spec.rb
94
+ - specs/response_spec.rb
94
95
  - specs/spec_helper.rb
95
96
  - zanoxrb.gemspec
96
97
  homepage: http://github.com/mozestudio/zanoxrb