comic_vine 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -37
- data/changelog +2 -0
- data/comic_vine.gemspec +1 -0
- data/lib/comic_vine.rb +2 -2
- data/lib/comic_vine/version.rb +1 -1
- data/spec/comic_vine_spec.rb +10 -10
- data/spec/spec_helper.rb +6 -6
- metadata +18 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 710b6ec5cd2f1e3bb84dae52db119d0b50cf4565
|
4
|
+
data.tar.gz: 10d7c6c9b9cfd1bfe33253ae3defb3f808e9b7fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a152e37d8665caed8fb4c622d1ba8e7608e2323b5951fcea95816f3bc68eb653858893a05973fb79a6fa535c35ffa852fa6837c17809161b29908a539ab89eb
|
7
|
+
data.tar.gz: 1d9b36413d46f68393dd43a269930b401072a943667599769c11f0f35b24400ec4eb4ab981457cef32552385c5e86fa941874f8b180d756e65f02b528c37703d
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Add this line to your application's Gemfile:
|
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
15
|
-
$ bundle
|
15
|
+
$ bundle install
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
@@ -26,42 +26,6 @@ Requires that API key be set manually. This is a breaking change from 0.0.4.
|
|
26
26
|
|
27
27
|
ComicVine::API.key = xxxxxx
|
28
28
|
|
29
|
-
works on a subset of the api actions
|
30
|
-
|
31
|
-
characters
|
32
|
-
|
33
|
-
chats
|
34
|
-
|
35
|
-
concepts
|
36
|
-
|
37
|
-
issues
|
38
|
-
|
39
|
-
locations
|
40
|
-
|
41
|
-
movies
|
42
|
-
|
43
|
-
objects
|
44
|
-
|
45
|
-
origins
|
46
|
-
|
47
|
-
persons
|
48
|
-
|
49
|
-
powers
|
50
|
-
|
51
|
-
promos
|
52
|
-
|
53
|
-
publishers
|
54
|
-
|
55
|
-
story_arcs
|
56
|
-
|
57
|
-
teams
|
58
|
-
|
59
|
-
videos
|
60
|
-
|
61
|
-
video_types
|
62
|
-
|
63
|
-
volumes
|
64
|
-
|
65
29
|
|
66
30
|
Calls to plurals return a CVObjectList, which contains the result array as well as the values from the return (total_count, offset, limit, resource).
|
67
31
|
|
@@ -100,6 +64,10 @@ There are associations. Call the association by the key name, prefaced by get_
|
|
100
64
|
|
101
65
|
Error responses from the API will raise a CVError with the error message
|
102
66
|
|
67
|
+
|
68
|
+
This gem is released under the MIT license, if you find it useful in your application, drop me a line and I'll post a link!
|
69
|
+
|
70
|
+
|
103
71
|
## ToDos
|
104
72
|
More Error checking
|
105
73
|
|
data/changelog
CHANGED
data/comic_vine.gemspec
CHANGED
data/lib/comic_vine.rb
CHANGED
@@ -5,7 +5,7 @@ require "cgi"
|
|
5
5
|
|
6
6
|
module ComicVine
|
7
7
|
|
8
|
-
class CVError < StandardError
|
8
|
+
class CVError < StandardError
|
9
9
|
end
|
10
10
|
|
11
11
|
class API
|
@@ -14,7 +14,7 @@ module ComicVine
|
|
14
14
|
@@types = nil
|
15
15
|
@@last_type_check = nil
|
16
16
|
|
17
|
-
@@API_BASE_URL = "http://
|
17
|
+
@@API_BASE_URL = "http://comicvine.gamespot.com/api/"
|
18
18
|
|
19
19
|
class << self
|
20
20
|
def search res, query, opts={}
|
data/lib/comic_vine/version.rb
CHANGED
data/spec/comic_vine_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe ComicVine do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when has valid api key" do
|
18
|
-
before { stub_request(:get, "http://
|
18
|
+
before { stub_request(:get, "http://comicvine.gamespot.com/api/types/").with(:query => {:format => 'json', :api_key => ComicVine::API.key}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => TYPES_BODY, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}) }
|
19
19
|
|
20
20
|
describe "invalid method" do
|
21
21
|
it "should raise NoMethodError" do
|
@@ -41,9 +41,9 @@ describe ComicVine do
|
|
41
41
|
|
42
42
|
describe "ComicVine search" do
|
43
43
|
before do
|
44
|
-
stub_request(:get, "http://
|
45
|
-
stub_request(:get, "http://
|
46
|
-
stub_request(:get, "http://
|
44
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/search/").with(:query => {:format => 'json', :api_key => ComicVine::API.key, :limit => 1, :resources => "volume", :query => "gizmo"}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => SEARCH_BODY_1, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
45
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/search/").with(:query => {:format => 'json', :api_key => ComicVine::API.key, :limit => 1, :page => 1, :resources => "volume", :query => "gizmo"}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => SEARCH_BODY_1, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
46
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/search/").with(:query => {:format => 'json', :api_key => ComicVine::API.key, :limit => 1, :page => 2, :resources => "volume", :query => "gizmo"}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => SEARCH_BODY_2, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
47
47
|
@results = ComicVine::API.search "volume", "gizmo", {:limit => 1}
|
48
48
|
end
|
49
49
|
subject { @results }
|
@@ -66,7 +66,7 @@ describe ComicVine do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should fetch the full CVObject" do
|
69
|
-
stub_request(:get, "http://
|
69
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/volume/4050-24708/").with(:query => {:format => 'json', :api_key => ComicVine::API.key}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => VOLUME_BODY, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
70
70
|
vol = @results.first.fetch
|
71
71
|
vol.should be_a_kind_of ComicVine::CVObject
|
72
72
|
end
|
@@ -74,9 +74,9 @@ describe ComicVine do
|
|
74
74
|
|
75
75
|
describe "ComicVine list" do
|
76
76
|
before do
|
77
|
-
stub_request(:get, "http://
|
78
|
-
stub_request(:get, "http://
|
79
|
-
stub_request(:get, "http://
|
77
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/issues/").with(:query => {:format => 'json', :api_key => ComicVine::API.key}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => ISSUES_BODY_1, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
78
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/issues/").with(:query => {:format => 'json', :api_key => ComicVine::API.key, :limit => 2, :offset => 0}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => ISSUES_BODY_1, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
79
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/issues/").with(:query => {:format => 'json', :api_key => ComicVine::API.key, :limit => 2, :offset => 2}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => ISSUES_BODY_2, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
80
80
|
@issues = ComicVine::API.issues
|
81
81
|
end
|
82
82
|
subject { @issues }
|
@@ -99,7 +99,7 @@ describe ComicVine do
|
|
99
99
|
|
100
100
|
describe "ComicVine detail" do
|
101
101
|
before do
|
102
|
-
stub_request(:get, "http://
|
102
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/issue/4000-145830/").with(:query => {:format => 'json', :api_key => ComicVine::API.key}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => ISSUE_BODY, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
103
103
|
@issue = ComicVine::API.issue 145830
|
104
104
|
end
|
105
105
|
subject { @issue }
|
@@ -110,7 +110,7 @@ describe ComicVine do
|
|
110
110
|
specify { lambda { @issue.get_something }.should raise_error(NoMethodError) }
|
111
111
|
|
112
112
|
it "should have a detail and list association" do
|
113
|
-
stub_request(:get, "http://
|
113
|
+
stub_request(:get, "http://comicvine.gamespot.com/api/volume/4050-24708/").with(:query => {:format => 'json', :api_key => ComicVine::API.key}, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => VOLUME_BODY, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'})
|
114
114
|
vol = @issue.get_volume
|
115
115
|
vol.should be_a_kind_of ComicVine::CVObject
|
116
116
|
iss = vol.get_issues
|
data/spec/spec_helper.rb
CHANGED
@@ -20,15 +20,15 @@ end
|
|
20
20
|
|
21
21
|
TYPES_BODY = '{"number_of_page_results": 17, "status_code": 1, "error": "OK", "results": [{"detail_resource_name": "issue", "id": 4000, "list_resource_name": "issues"}, {"detail_resource_name": "volume", "id": 4050, "list_resource_name": "volumes"}], "limit": 17, "offset": 0, "number_of_total_results": 17}'
|
22
22
|
|
23
|
-
ISSUE_BODY = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": {"site_detail_url": "http://
|
23
|
+
ISSUE_BODY = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": {"site_detail_url": "http://comicvine.gamespot.com/gizmo-/37-145830/", "id": 145830, "volume": {"api_detail_url": "http://comicvine.gamespot.com/api/volume/4050-24708/", "id": 24708, "name": "Gizmo"}, "publish_year": null}, "limit": 1, "offset": 0, "number_of_total_results": 1}'
|
24
24
|
|
25
|
-
ISSUES_BODY_1 = '{"number_of_page_results": 2, "status_code": 1, "error": "OK", "results": [{"api_detail_url": "http://
|
25
|
+
ISSUES_BODY_1 = '{"number_of_page_results": 2, "status_code": 1, "error": "OK", "results": [{"api_detail_url": "http://comicvine.gamespot.com/api/issue/6/", "site_detail_url": "http://comicvine.gamespot.com/chamber-of-chills-magazine-man-in-the-hood-the-lost-race-the-man-germ-the-things/37-6/", "description": "", "deck": "", "aliases": "", "issue_number": "13.00", "publish_year": 1952, "has_staff_review": false, "date_added": "2008-06-06 11:10:16", "publish_day": null, "publish_month": 10, "id": 6, "name": "Man In the Hood; The Lost Race; The Man Germ; The Things; "}, {"api_detail_url": "http://comicvine.gamespot.com/api/issue/7/", "site_detail_url": "http://comicvine.gamespot.com/fighting-fronts-/37-7/", "description": "", "deck": "", "aliases": "", "issue_number": "3.00", "publish_year": 0, "has_staff_review": false, "date_added": "2008-06-06 11:10:16", "publish_day": null, "publish_month": 0, "id": 7, "name": ""}], "limit": 2, "offset": 0, "number_of_total_results": 4}'
|
26
26
|
|
27
|
-
ISSUES_BODY_2 = '{"number_of_page_results": 2, "status_code": 1, "error": "OK", "results": [{"api_detail_url": "http://
|
27
|
+
ISSUES_BODY_2 = '{"number_of_page_results": 2, "status_code": 1, "error": "OK", "results": [{"api_detail_url": "http://comicvine.gamespot.com/api/issue/6/", "site_detail_url": "http://comicvine.gamespot.com/chamber-of-chills-magazine-man-in-the-hood-the-lost-race-the-man-germ-the-things/37-6/", "description": "", "deck": "", "aliases": "", "date_last_updated": "2009-01-27 12:47:44", "volume": {"api_detail_url": "http://comicvine.gamespot.com/api/volume/4050-1487/", "id": 1487, "name": "Chamber of Chills Magazine"}, "issue_number": "13.00", "publish_year": 1952, "has_staff_review": false, "date_added": "2008-06-06 11:10:16", "publish_day": null, "publish_month": 10, "id": 6, "name": "Man In the Hood; The Lost Race; The Man Germ; The Things; "}, {"api_detail_url": "http://comicvine.gamespot.com/api/issue/7/", "site_detail_url": "http://comicvine.gamespot.com/fighting-fronts-/37-7/", "description": "", "deck": "", "aliases": "", "date_last_updated": "2008-06-06 11:32:53", "volume": {"api_detail_url": "http://comicvine.gamespot.com/api/volume/4050-1488/", "id": 1488, "name": "Fighting Fronts!"}, "issue_number": "3.00", "publish_year": 0, "has_staff_review": false, "date_added": "2008-06-06 11:10:16", "publish_day": null, "publish_month": 0, "id": 7, "name": ""}], "limit": 2, "offset": 2, "number_of_total_results": 4}'
|
28
28
|
|
29
|
-
VOLUME_BODY = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": {"id": 24708, "issues": [{"api_detail_url": "http://
|
29
|
+
VOLUME_BODY = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": {"id": 24708, "issues": [{"api_detail_url": "http://comicvine.gamespot.com/api/issue/4000-145830/", "issue_number": "1.00", "id": 145830, "name": " "}]}, "limit": 1, "offset": 0, "number_of_total_results": 1}'
|
30
30
|
|
31
31
|
|
32
|
-
SEARCH_BODY_1 = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": [{"publisher": {"api_detail_url": "http://
|
32
|
+
SEARCH_BODY_1 = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": [{"publisher": {"api_detail_url": "http://comicvine.gamespot.com/api/publisher/517/", "id": 517, "name": "Mirage"}, "start_year": 1985, "description": "", "deck": "", "last_issue": null, "date_last_updated": "2010-07-04 20:51:17", "first_issue": null, "api_detail_url": "http://comicvine.gamespot.com/api/volume/4050-24708/", "count_of_issues": 6, "id": 24708, "date_added": "2008-12-12 16:58:16", "aliases": "", "site_detail_url": "http://comicvine.gamespot.com/gizmo/49-24708/", "resource_type": "volume", "name": "Gizmo"}], "limit": 1, "offset": 0, "number_of_total_results": 2}'
|
33
33
|
|
34
|
-
SEARCH_BODY_2 = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": [{"publisher": {"api_detail_url": "http://
|
34
|
+
SEARCH_BODY_2 = '{"number_of_page_results": 1, "status_code": 1, "error": "OK", "results": [{"publisher": {"api_detail_url": "http://comicvine.gamespot.com/api/publisher/517/", "id": 517, "name": "Mirage"}, "start_year": null, "description": "", "deck": "Mirage volume starring Fugitoid and Gizmo", "last_issue": null, "date_last_updated": "2010-04-28 14:24:46", "first_issue": null, "api_detail_url": "http://comicvine.gamespot.com/api/volume/4050-32839/", "count_of_issues": 2, "id": 32839, "date_added": "2010-04-28 14:22:46", "aliases": "", "site_detail_url": "http://comicvine.gamespot.com/gizmo-and-the-fugitoid/49-32839/", "resource_type": "volume", "name": "Gizmo and the Fugitoid"}], "limit": 1, "offset": 1, "number_of_total_results": 2}'
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comic_vine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Sharp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '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
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Simple api interface to Comic Vine. Allows for searches and returning
|
@@ -103,7 +103,8 @@ files:
|
|
103
103
|
- spec/comic_vine_spec.rb
|
104
104
|
- spec/spec_helper.rb
|
105
105
|
homepage: https://github.com/Jakanapes/ComicVine
|
106
|
-
licenses:
|
106
|
+
licenses:
|
107
|
+
- MIT
|
107
108
|
metadata: {}
|
108
109
|
post_install_message:
|
109
110
|
rdoc_options: []
|
@@ -111,20 +112,21 @@ require_paths:
|
|
111
112
|
- lib
|
112
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - '>='
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
119
|
requirements:
|
119
|
-
- -
|
120
|
+
- - '>='
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
124
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.5.2
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: Interface to ComicVine API
|
128
129
|
test_files:
|
129
130
|
- spec/comic_vine_spec.rb
|
130
131
|
- spec/spec_helper.rb
|
132
|
+
has_rdoc:
|