cat_api 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0702e039ad000739e71865792dea238b9361b74
4
- data.tar.gz: 8b3a8912f9b41ac91649e7732849efed0a6c285b
3
+ metadata.gz: a19b454424ad75a44a9e53899d0e7268c7cf61cd
4
+ data.tar.gz: b7f26f36202d59ce74e9599d8e2293c0340a18d0
5
5
  SHA512:
6
- metadata.gz: 4c6d3b12ed1c4f4e4c16d9adb138a2f77c362245e1110b3fa364a0927dc14d85c6a378e10ca879415d8abbee2b21b9bc999c945e42f0afc396fb875f4cfa0777
7
- data.tar.gz: 32b77421b0f71cf7ee8917cb72bab55b57eaf34fe77041827f02065745fba2cc82d1a47bb4fe2b56077891dc790cba7446ee60b4b8898deea51efa9f23ef3157
6
+ metadata.gz: e68b6c078fb57d95a6532ec0f3fc2bc893a30aafe047d482063bf10e63a9f6dffde47c1c8d272b0490f570c7d06c198fd7f46555a4ce2f109c9ed23b1ae6484f
7
+ data.tar.gz: 4f88da13a4a7d8b1bfdf86a5a27c153d26241087c57dfb707576657fad66db6a38102af6041b2cbf1f0de236951513d3c429131d56efc0f7e6d7265fa89af4f0
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ guard :rspec, cmd: 'bundle exec rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch('spec/spec_helper.rb') { 'spec' }
4
+
5
+ watch(%r{^(\w+)\.rb$}) { 'spec' }
6
+
7
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
8
+ end
data/cat_api.gemspec CHANGED
@@ -18,6 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.add_dependency 'rest-client', '~> 1.7.2'
22
+ spec.add_dependency 'nokogiri', '~> 1.6.5'
23
+
21
24
  spec.add_development_dependency 'bundler', '~> 1.7'
22
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.1.0'
27
+ spec.add_development_dependency 'simplecov', '~> 0.9.1'
28
+ spec.add_development_dependency 'guard-rspec', '~> 4.5.0'
23
29
  end
@@ -12,6 +12,7 @@ class CatAPI::Client
12
12
 
13
13
  def get_images(options={})
14
14
  options = @defaults.merge(options)
15
+ options.delete_if {|k,v| v.nil? || v.empty? }
15
16
  response = get "#{ BASE_URL }images/get?format=xml&#{ URI.encode_www_form options }"
16
17
  CatAPI::ImageSearch.new( Nokogiri::XML(response) ).results
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module CatAPI
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,45 @@
1
+ describe CatAPI::Client do
2
+
3
+ describe '.new' do
4
+
5
+ it 'returns a new client' do
6
+ expect( CatAPI::Client.new ).to be_a_kind_of( CatAPI::Client )
7
+ end
8
+
9
+ it 'is delegated to from the CatAPI module' do
10
+ expect( CatAPI.new ).to be_a_kind_of( CatAPI::Client )
11
+ end
12
+
13
+ end
14
+
15
+ describe '#get_images' do
16
+
17
+ let(:client) { CatAPI.new }
18
+
19
+ context 'when passed nothing' do
20
+
21
+ let(:results) { client.get_images }
22
+
23
+ it 'returns an array with a single image' do
24
+ expect( results ).to be_an( Array )
25
+ expect( results.count ).to eq( 1 )
26
+ expect( results.first ).to be_a( CatAPI::Image )
27
+ end
28
+
29
+ end
30
+
31
+ context 'when passed a nil parameter' do
32
+
33
+ let(:results) { client.get_images(category: nil) }
34
+
35
+ it 'should still return a single image' do
36
+ expect( results ).to be_an( Array )
37
+ expect( results.count ).to eq( 1 )
38
+ expect( results.first ).to be_a( CatAPI::Image )
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,4 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ require_relative '../lib/cat_api'
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cat_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Fritz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-07 00:00:00.000000000 Z
11
+ date: 2015-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.7.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.7.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.6.5
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +66,48 @@ dependencies:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.1.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.1.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 4.5.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 4.5.0
41
111
  description: CatAPI is a Ruby gem to facilitate communication with the Cat API.
42
112
  email:
43
113
  - chrisvfritz@gmail.com
@@ -46,7 +116,9 @@ extensions: []
46
116
  extra_rdoc_files: []
47
117
  files:
48
118
  - ".gitignore"
119
+ - ".rspec"
49
120
  - Gemfile
121
+ - Guardfile
50
122
  - LICENSE.txt
51
123
  - README.md
52
124
  - Rakefile
@@ -56,6 +128,8 @@ files:
56
128
  - lib/cat_api/image.rb
57
129
  - lib/cat_api/image_search.rb
58
130
  - lib/cat_api/version.rb
131
+ - spec/lib/cat_api/client_spec.rb
132
+ - spec/spec_helper.rb
59
133
  homepage: ''
60
134
  licenses:
61
135
  - MIT
@@ -80,4 +154,6 @@ rubygems_version: 2.4.5
80
154
  signing_key:
81
155
  specification_version: 4
82
156
  summary: CatAPI is a Ruby gem to facilitate communication with the Cat API.
83
- test_files: []
157
+ test_files:
158
+ - spec/lib/cat_api/client_spec.rb
159
+ - spec/spec_helper.rb