cat_api 0.1.0 → 0.1.1

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: bf22d9af6d38ad497c726cf60c94244c9fe27d93
4
- data.tar.gz: 008963b65576c83cb9898c182048e65f3d729a8b
3
+ metadata.gz: 80d276b39f0e922dbece4c0a55e02ea1840ef619
4
+ data.tar.gz: 38a7f3af11239a2886f6f2591e562e6f77ae6ec4
5
5
  SHA512:
6
- metadata.gz: 4634d3e16bbfbd0f9fae73d9d9b4d8ec3660e41b0e9cca0d03e5c9adb6ffe3044b63107e2fdc21f68d86168bceeb360f4e482f43018191c3a1fbfba78cc382cb
7
- data.tar.gz: a436b55b4121a4e6bc439dd6308f4c60cc9922b4f6a1c2f9a75a0fa95fcb719a2ce06323a8c888408770ee13015c3b2cc29a774f69225c0418ba23e3016d6563
6
+ metadata.gz: 06df321d4789afcf96ecad995cf6b1297a9770e1390a1a849f9696f835afa0cc35a7ba4c5c6f1aa53a85688eeb9909e3b55255efbdafb828bec6f76874dd0194
7
+ data.tar.gz: 101c9869f2a5d38754a301884e116e4ed76208ba8bf62a0a30a43a5dd54a89fe0f3fd9aec974a5f29b70bca2e1a539140521fad612c72a11bc6fc43962730014
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CatAPI
2
2
 
3
- I'm not sure how this happened, but there was not yet a Ruby wrapper for the awesome Cat API. Problems solved. I'm putting this together for use in a class, so there are no specs and it only hits a single endpoint, but it's something.
3
+ I'm not sure how this happened, but there was not yet a Ruby wrapper for the awesome Cat API. Well, problem solved. I'm putting this together for use in a class, so there are no specs and it only hits a single endpoint, but it's something.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,7 @@ 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'
21
+ spec.add_dependency 'rest-client', '~> 2.0.0'
22
22
  spec.add_dependency 'nokogiri', '~> 1.6.5'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.7'
@@ -0,0 +1,11 @@
1
+ class CatAPI::Categories
2
+ attr_reader :results
3
+
4
+ def initialize(xml)
5
+ @results = []
6
+ xml.xpath('//name').map do |name|
7
+ results.push(name.text)
8
+ end
9
+ end
10
+
11
+ end
@@ -1,13 +1,17 @@
1
1
  require 'rest-client'
2
2
  require 'nokogiri'
3
3
  require 'cat_api/image_search'
4
+ require 'cat_api/categories'
4
5
 
5
6
  class CatAPI::Client
7
+ attr_reader :categories
6
8
 
7
9
  BASE_URL = 'http://thecatapi.com/api/'
8
10
 
9
11
  def initialize(defaults={})
10
12
  @defaults = defaults
13
+ response = get "#{ BASE_URL }categories/list"
14
+ @categories = CatAPI::Categories.new( Nokogiri::XML(response) ).results
11
15
  end
12
16
 
13
17
  def get_images(options={})
@@ -23,4 +27,4 @@ private
23
27
  RestClient.get url
24
28
  end
25
29
 
26
- end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module CatAPI
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cat_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-02-22 00:00:00.000000000 Z
11
+ date: 2016-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.2
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.2
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +124,7 @@ files:
124
124
  - Rakefile
125
125
  - cat_api.gemspec
126
126
  - lib/cat_api.rb
127
+ - lib/cat_api/categories.rb
127
128
  - lib/cat_api/client.rb
128
129
  - lib/cat_api/image.rb
129
130
  - lib/cat_api/image_search.rb
@@ -150,11 +151,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
151
  version: '0'
151
152
  requirements: []
152
153
  rubyforge_project:
153
- rubygems_version: 2.4.5
154
+ rubygems_version: 2.5.1
154
155
  signing_key:
155
156
  specification_version: 4
156
157
  summary: CatAPI is a Ruby gem to facilitate communication with the Cat API.
157
158
  test_files:
158
159
  - spec/lib/cat_api/client_spec.rb
159
160
  - spec/spec_helper.rb
160
- has_rdoc: