zanoxrb 0.3 → 0.4
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 -4
- data/Rakefile +1 -1
- data/lib/zanox/response.rb +8 -1
- data/lib/zanox/version.rb +1 -1
- data/specs/products_spec.rb +3 -0
- data/specs/profiles_spec.rb +2 -0
- data/specs/program_application_spec.rb +2 -0
- data/specs/programs_spec.rb +2 -0
- data/specs/response_spec.rb +25 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619cbe2a3526db513228244f180a67a3b3f493dd
|
4
|
+
data.tar.gz: 4e5bace7088bf59b45e64d39836466ed82f44c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79558047d1956ffa69b617a23b1a120b3b52a7b6b94800bb63f16509a35400c1ad31a7ab21b15a29d38a7334aa92369b88f86fb70102ec3579f25e148cdc0468
|
7
|
+
data.tar.gz: 8d4f1f09239abe591fc568f981101cb6c3c053cf10ab563cc915a4ec723f185a8f3198f73793b1e6410bc3336111293ce456dc7014ce80d75d13004acf8db656
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/lib/zanox/response.rb
CHANGED
@@ -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
|
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
|
data/lib/zanox/version.rb
CHANGED
data/specs/products_spec.rb
CHANGED
@@ -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
|
#
|
data/specs/profiles_spec.rb
CHANGED
data/specs/programs_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|