marver 0.0.0 → 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 +4 -4
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +13 -0
- data/LICENSE +20 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/lib/marver.rb +35 -21
- data/lib/marver/builders/common_entities_builder.rb +46 -0
- data/lib/marver/builders/core_entities_builder.rb +34 -0
- data/lib/marver/client.rb +13 -0
- data/lib/marver/credentials.rb +23 -0
- data/lib/marver/data_container.rb +18 -0
- data/lib/marver/entities/common/image.rb +9 -0
- data/lib/marver/entities/common/key_date.rb +10 -0
- data/lib/marver/entities/common/price.rb +10 -0
- data/lib/marver/entities/common/text_object.rb +11 -0
- data/lib/marver/entities/common/url.rb +10 -0
- data/lib/marver/entities/core/character.rb +35 -0
- data/lib/marver/entities/core/comic.rb +46 -0
- data/lib/marver/entities/core/creator.rb +36 -0
- data/lib/marver/entities/core/event.rb +35 -0
- data/lib/marver/entities/core/serie.rb +37 -0
- data/lib/marver/entities/core/story.rb +36 -0
- data/lib/marver/entities/summaries/character_summary.rb +22 -0
- data/lib/marver/entities/summaries/comic_summary.rb +20 -0
- data/lib/marver/entities/summaries/creator_summary.rb +12 -0
- data/lib/marver/entities/summaries/event_summary.rb +14 -0
- data/lib/marver/entities/summaries/serie_summary.rb +13 -0
- data/lib/marver/entities/summaries/story_summary.rb +14 -0
- data/lib/marver/finders/character_finder.rb +24 -0
- data/lib/marver/helpers/string_helper.rb +36 -0
- data/lib/marver/rest/client.rb +22 -0
- data/lib/marver/rest/error.rb +13 -0
- data/lib/marver/rest/response.rb +18 -0
- data/lib/marver/version.rb +3 -0
- data/marver.gemspec +23 -0
- data/spec/fixtures/character.json +398 -0
- data/spec/fixtures/comic.json +243 -0
- data/spec/fixtures/creator.json +345 -0
- data/spec/fixtures/event.json +104 -0
- data/spec/fixtures/raw_json.json +398 -0
- data/spec/fixtures/serie.json +102 -0
- data/spec/fixtures/story.json +94 -0
- data/spec/marver/client_spec.rb +12 -0
- data/spec/marver/credentials_spec.rb +19 -0
- data/spec/marver/data_container_spec.rb +23 -0
- data/spec/marver/entities/core/character_spec.rb +76 -0
- data/spec/marver/entities/core/comic_spec.rb +150 -0
- data/spec/marver/entities/core/creator_spec.rb +83 -0
- data/spec/marver/entities/core/event_spec.rb +106 -0
- data/spec/marver/entities/core/serie_spec.rb +106 -0
- data/spec/marver/entities/core/story_spec.rb +70 -0
- data/spec/marver/entities/image_spec.rb +9 -0
- data/spec/marver/entities/key_date_spec.rb +17 -0
- data/spec/marver/entities/price_spec.rb +13 -0
- data/spec/marver/entities/summaries/character_summary_spec.rb +65 -0
- data/spec/marver/entities/summaries/comic_summary_spec.rb +64 -0
- data/spec/marver/entities/summaries/creator_summary_spec.rb +23 -0
- data/spec/marver/entities/summaries/event_summary_spec.rb +30 -0
- data/spec/marver/entities/summaries/serie_summary_spec.rb +26 -0
- data/spec/marver/entities/summaries/story_summary_spec.rb +30 -0
- data/spec/marver/entities/text_object_spec.rb +20 -0
- data/spec/marver/entities/url_spec.rb +16 -0
- data/spec/marver/finders/character_finder_spec.rb +27 -0
- data/spec/marver/rest/client_spec.rb +10 -0
- data/spec/marver/rest/error_spec.rb +14 -0
- data/spec/marver/rest/response_spec.rb +22 -0
- data/spec/spec_helper.rb +17 -0
- metadata +137 -8
@@ -0,0 +1,102 @@
|
|
1
|
+
{
|
2
|
+
"code": 200,
|
3
|
+
"status": "Ok",
|
4
|
+
"copyright": "© 2014 MARVEL",
|
5
|
+
"attributionText": "Data provided by Marvel. © 2014 MARVEL",
|
6
|
+
"attributionHTML": "<a href=\"http://marvel.com\">Data provided by Marvel. © 2014 MARVEL</a>",
|
7
|
+
"etag": "35cdca2e00cecb0c9f613382c0d92155d6c971d3",
|
8
|
+
"data": {
|
9
|
+
"offset": 0,
|
10
|
+
"limit": 20,
|
11
|
+
"total": 1,
|
12
|
+
"count": 1,
|
13
|
+
"results": [
|
14
|
+
{
|
15
|
+
"id": 2002,
|
16
|
+
"title": "Daredevil (1963 - 1998)",
|
17
|
+
"description": "Join the Man Without Fear as he stands up for justice! Blind lawyer Matt Murdock protects the streets of Hell's Kitchen by night against dangerous foes like Bullseye and the Kingpin! Includes the classic stories by icon Frank Miller that changed comics forever.",
|
18
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/series/2002",
|
19
|
+
"urls": [
|
20
|
+
{
|
21
|
+
"type": "detail",
|
22
|
+
"url": "http://marvel.com/comics/series/2002/daredevil_1963_-_1998?utm_campaign=apiRef&utm_source=f302f582215c3deedff86e8015f853c7"
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"startYear": 1963,
|
26
|
+
"endYear": 1998,
|
27
|
+
"rating": "",
|
28
|
+
"type": "ongoing",
|
29
|
+
"modified": "2014-03-19T14:31:12-0400",
|
30
|
+
"thumbnail": {
|
31
|
+
"path": "http://i.annihil.us/u/prod/marvel/i/mg/1/00/5130f628766d9",
|
32
|
+
"extension": "jpg"
|
33
|
+
},
|
34
|
+
"creators": {
|
35
|
+
"available": 279,
|
36
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/series/2002/creators",
|
37
|
+
"items": [
|
38
|
+
{
|
39
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/creators/87",
|
40
|
+
"name": "Mark Bagley",
|
41
|
+
"role": "penciller (cover)"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"returned": 20
|
45
|
+
},
|
46
|
+
"characters": {
|
47
|
+
"available": 57,
|
48
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/series/2002/characters",
|
49
|
+
"items": [
|
50
|
+
{
|
51
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/characters/1009175",
|
52
|
+
"name": "Beast"
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"returned": 20
|
56
|
+
},
|
57
|
+
"stories": {
|
58
|
+
"available": 819,
|
59
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/series/2002/stories",
|
60
|
+
"items": [
|
61
|
+
{
|
62
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/stories/15722",
|
63
|
+
"name": "Life Be Not Proud!",
|
64
|
+
"type": "interiorStory"
|
65
|
+
}
|
66
|
+
],
|
67
|
+
"returned": 20
|
68
|
+
},
|
69
|
+
"comics": {
|
70
|
+
"available": 381,
|
71
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/series/2002/comics",
|
72
|
+
"items": [
|
73
|
+
{
|
74
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/comics/8072",
|
75
|
+
"name": "Daredevil (1963)"
|
76
|
+
}
|
77
|
+
],
|
78
|
+
"returned": 20
|
79
|
+
},
|
80
|
+
"events": {
|
81
|
+
"available": 6,
|
82
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/series/2002/events",
|
83
|
+
"items": [
|
84
|
+
{
|
85
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/events/116",
|
86
|
+
"name": "Acts of Vengeance!"
|
87
|
+
}
|
88
|
+
],
|
89
|
+
"returned": 6
|
90
|
+
},
|
91
|
+
"next": {
|
92
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/series/449",
|
93
|
+
"name": "Daredevil (1998 - 2011)"
|
94
|
+
},
|
95
|
+
"previous": {
|
96
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/series/449",
|
97
|
+
"name": "Daredevil (1998 - 2011)"
|
98
|
+
}
|
99
|
+
}
|
100
|
+
]
|
101
|
+
}
|
102
|
+
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
{
|
2
|
+
"code": 200,
|
3
|
+
"status": "Ok",
|
4
|
+
"etag": "889444dc620e1a126b7da5ed58120347d0eb32b0",
|
5
|
+
"data": {
|
6
|
+
"offset": 0,
|
7
|
+
"limit": 20,
|
8
|
+
"total": 1,
|
9
|
+
"count": 1,
|
10
|
+
"results": [
|
11
|
+
{
|
12
|
+
"id": 892,
|
13
|
+
"title": "Cover #892",
|
14
|
+
"description": "",
|
15
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/stories/892",
|
16
|
+
"type": "cover",
|
17
|
+
"modified": "1969-12-31T19:00:00-0500",
|
18
|
+
"thumbnail": null,
|
19
|
+
"creators": {
|
20
|
+
"available": 1,
|
21
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/stories/892/creators",
|
22
|
+
"items": [
|
23
|
+
{
|
24
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/creators/374",
|
25
|
+
"name": "Steve Epting",
|
26
|
+
"role": "penciller (cover)"
|
27
|
+
}
|
28
|
+
],
|
29
|
+
"returned": 1
|
30
|
+
},
|
31
|
+
"characters": {
|
32
|
+
"available": 4,
|
33
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/stories/892/characters",
|
34
|
+
"items": [
|
35
|
+
{
|
36
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/characters/1009165",
|
37
|
+
"name": "Avengers"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/characters/1009220",
|
41
|
+
"name": "Captain America"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/characters/1009368",
|
45
|
+
"name": "Iron Man"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/characters/1009664",
|
49
|
+
"name": "Thor"
|
50
|
+
}
|
51
|
+
],
|
52
|
+
"returned": 4
|
53
|
+
},
|
54
|
+
"series": {
|
55
|
+
"available": 1,
|
56
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/stories/892/series",
|
57
|
+
"items": [
|
58
|
+
{
|
59
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/series/581",
|
60
|
+
"name": "Thor (1998 - 2004)"
|
61
|
+
}
|
62
|
+
],
|
63
|
+
"returned": 1
|
64
|
+
},
|
65
|
+
"comics": {
|
66
|
+
"available": 1,
|
67
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/stories/892/comics",
|
68
|
+
"items": [
|
69
|
+
{
|
70
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/comics/715",
|
71
|
+
"name": "Thor (1998) #81"
|
72
|
+
}
|
73
|
+
],
|
74
|
+
"returned": 1
|
75
|
+
},
|
76
|
+
"events": {
|
77
|
+
"available": 1,
|
78
|
+
"collectionURI": "http://gateway.marvel.com/v1/public/stories/892/events",
|
79
|
+
"items": [
|
80
|
+
{
|
81
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/events/234",
|
82
|
+
"name": "Avengers Disassembled"
|
83
|
+
}
|
84
|
+
],
|
85
|
+
"returned": 1
|
86
|
+
},
|
87
|
+
"originalIssue": {
|
88
|
+
"resourceURI": "http://gateway.marvel.com/v1/public/comics/715",
|
89
|
+
"name": "Thor (1998) #81"
|
90
|
+
}
|
91
|
+
}
|
92
|
+
]
|
93
|
+
}
|
94
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/marver/rest/client.rb'
|
3
|
+
require './lib/marver.rb'
|
4
|
+
|
5
|
+
describe Marver::Client do
|
6
|
+
let(:client) { Marver::Client.new("private_key", "public_key") }
|
7
|
+
|
8
|
+
it 'has a character finder' do
|
9
|
+
expect(client.characters.class).to eq Marver::CharacterFinder
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require './lib/marver.rb'
|
2
|
+
|
3
|
+
describe Marver::Credentials do
|
4
|
+
let(:credentials) { Marver::Credentials.new("priv_key", "pub_key") }
|
5
|
+
|
6
|
+
it "has a API private key" do
|
7
|
+
expect(credentials.public_key).to eq "pub_key"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "has a API public key" do
|
11
|
+
expect(credentials.private_key).to eq "priv_key"
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'has a timestamp' do
|
15
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
16
|
+
expect(credentials.timestamp).to eq "1"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require './lib/marver.rb'
|
2
|
+
|
3
|
+
describe Marver::DataContainer do
|
4
|
+
let(:response) { Marver::REST::Response.new("{ \"code\": 200, \"status\": \"Ok\", \"etag\": \"ec5ab621cf3760eb6f2df2e6270ccb56c6debfb7\", \"data\": { \"offset\": 0, \"limit\": 20, \"total\": 1, \"count\": 1, \"results\": [1]}}") }
|
5
|
+
|
6
|
+
let(:data_container) { Marver::DataContainer.new(response) }
|
7
|
+
|
8
|
+
it '#offset' do
|
9
|
+
expect(data_container.offset).to eq 0
|
10
|
+
end
|
11
|
+
|
12
|
+
it '#limit' do
|
13
|
+
expect(data_container.limit).to eq 20
|
14
|
+
end
|
15
|
+
|
16
|
+
it '#total' do
|
17
|
+
expect(data_container.total).to eq 1
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#results' do
|
21
|
+
expect(data_container.results.class).to eq Fixnum
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Marver::Character do
|
4
|
+
|
5
|
+
describe 'Attributes' do
|
6
|
+
let(:json) { fixture('character.json').read }
|
7
|
+
let(:response) { Marver::REST::Response.new(json) }
|
8
|
+
let(:credentials) { Marver::Credentials.new('pub_key', 'priv_key') }
|
9
|
+
let(:data_container) { Marver::DataContainer.new(response) }
|
10
|
+
let(:character) { Marver::Character.new(data_container.results, credentials) }
|
11
|
+
|
12
|
+
it '#id - The unique ID of the character resource' do
|
13
|
+
expect(character.id).to eq 1009220
|
14
|
+
end
|
15
|
+
|
16
|
+
it '#name - The name of the character.' do
|
17
|
+
expect(character.name).to eq "Captain America"
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#description - A short bio or description of the character.' do
|
21
|
+
expect(character.description).to eq "Vowing to serve his country any way he could, young Steve Rogers took the super soldier serum to become America's one-man army. Fighting for the red, white and blue for over 60 years, Captain America is the living, breathing symbol of freedom and liberty."
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#resourceURI - The canonical URL identifier for this resource.' do
|
25
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
26
|
+
expect(character.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009220?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
27
|
+
end
|
28
|
+
|
29
|
+
it '#urls - A set of public web site URLs for the resource.' do
|
30
|
+
expect(character.urls.class).to eq Array
|
31
|
+
expect(character.urls.first.type).to eq "detail"
|
32
|
+
expect(character.urls.first.url).to eq "http://marvel.com/comics/characters/1009220/captain_america?utm_campaign=apiRef&utm_source=f302f582215c3deedff86e8015f853c7"
|
33
|
+
end
|
34
|
+
|
35
|
+
it '#thumbnail - The representative image for this character.' do
|
36
|
+
expect(character.thumbnail.full_path).to eq "http://i.annihil.us/u/prod/marvel/i/mg/2/c0/5261a81d0154e.jpg"
|
37
|
+
expect(character.thumbnail.class).to eq Marver::Image
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'summary objects' do
|
41
|
+
before :each do
|
42
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
43
|
+
end
|
44
|
+
|
45
|
+
it '#comics - A resource list containing comics which feature this character.' do
|
46
|
+
expect(character.comics.class).to eq Array
|
47
|
+
expect(character.comics.first.class).to eq Marver::ComicSummary
|
48
|
+
expect(character.comics.first.name).to eq "Age of Apocalypse (2011) #2 (Avengers Art Appreciation Variant)"
|
49
|
+
expect(character.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/42539?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
50
|
+
end
|
51
|
+
|
52
|
+
it '#stories - A resource list of stories in which this character appears.' do
|
53
|
+
expect(character.stories.class).to eq Array
|
54
|
+
expect(character.stories.first.class).to eq Marver::StorySummary
|
55
|
+
expect(character.stories.first.name).to eq "Cover #892"
|
56
|
+
expect(character.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/892?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
57
|
+
expect(character.stories.first.type).to eq "cover"
|
58
|
+
end
|
59
|
+
|
60
|
+
it '#events - A resource list of events in which this character appears.' do
|
61
|
+
expect(character.events.class).to eq Array
|
62
|
+
expect(character.events.first.class).to eq Marver::EventSummary
|
63
|
+
expect(character.events.first.name).to eq "Acts of Vengeance!"
|
64
|
+
expect(character.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/116?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
65
|
+
end
|
66
|
+
|
67
|
+
it '#series - A resource list of series in which this character appears.' do
|
68
|
+
expect(character.series.class).to eq Array
|
69
|
+
expect(character.series.first.class).to eq Marver::SerieSummary
|
70
|
+
expect(character.series.first.name).to eq "Age of Apocalypse (2011 - Present)"
|
71
|
+
expect(character.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/15331?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Marver::Comic do
|
4
|
+
let(:json) { JSON.parse(fixture('comic.json').read)['data']['results'].first }
|
5
|
+
let(:credentials) { Marver::Credentials.new("pub_key", "priv_key") }
|
6
|
+
let(:comic) { Marver::Comic.new(json, credentials) }
|
7
|
+
|
8
|
+
it '#id - The unique ID of the comic resource' do
|
9
|
+
expect(comic.id).to eq 38524
|
10
|
+
end
|
11
|
+
|
12
|
+
it '#title - The title of the comic.' do
|
13
|
+
expect(comic.title).to eq "Age of X: Universe (2011) #1"
|
14
|
+
end
|
15
|
+
|
16
|
+
it '#resource_uri - The canonical URL identifier for this resource.' do
|
17
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
18
|
+
expect(comic.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/38524?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
19
|
+
end
|
20
|
+
|
21
|
+
it '#digital_id - The ID of the digital comic representation of this comic. Will be 0 if the comic is not available digitally.' do
|
22
|
+
expect(comic.digital_id).to eq 20260
|
23
|
+
end
|
24
|
+
|
25
|
+
it '#issue_number - The number of the issue in the series (will generally be 0 for collection formats).' do
|
26
|
+
expect(comic.issue_number).to eq 1
|
27
|
+
end
|
28
|
+
|
29
|
+
it '#variant_description - If the issue is a variant (e.g. an alternate cover, second printing, or director\'s cut), a text description of the variant.' do
|
30
|
+
expect(comic.variant_description).to eq ""
|
31
|
+
end
|
32
|
+
|
33
|
+
it '#description - The preferred description of the comic.' do
|
34
|
+
expect(comic.description).to eq "In an age without the X-Men, mutants are hated and hunted. The surviving mutants create a last bastion for their dying race: Fortress X. With this AGE OF X, humanity vows to see mutants destroyed and a team of champions find themselves united. \n"
|
35
|
+
end
|
36
|
+
|
37
|
+
it '#isbn - The ISBN for the comic (generally only populated for collection formats).' do
|
38
|
+
expect(comic.isbn).to eq ""
|
39
|
+
end
|
40
|
+
|
41
|
+
it '#upc - The UPC barcode number for the comic (generally only populated for periodical formats).' do
|
42
|
+
expect(comic.upc).to eq "5960607573-00111"
|
43
|
+
end
|
44
|
+
|
45
|
+
it '#diamond_code - The Diamond code for the comic.' do
|
46
|
+
expect(comic.diamond_code).to eq "JAN110795"
|
47
|
+
end
|
48
|
+
|
49
|
+
it '#ean - The EAN barcode for the comic.' do
|
50
|
+
expect(comic.ean).to eq ""
|
51
|
+
end
|
52
|
+
it '#issn - The ISSN barcode for the comic.' do
|
53
|
+
expect(comic.issn).to eq ""
|
54
|
+
end
|
55
|
+
|
56
|
+
it '#format - The publication format of the comic e.g. comic, hardcover, trade paperback.' do
|
57
|
+
expect(comic.format).to eq "Comic"
|
58
|
+
end
|
59
|
+
|
60
|
+
it '#page_count - The number of story pages in the comic.' do
|
61
|
+
expect(comic.page_count).to eq 40
|
62
|
+
end
|
63
|
+
|
64
|
+
it '#thumbnails - The representative image for this comic.' do
|
65
|
+
expect(comic.thumbnail.class).to eq Marver::Image
|
66
|
+
expect(comic.thumbnail.full_path).to eq "http://i.annihil.us/u/prod/marvel/i/mg/7/70/4f57719ff38c5.jpg"
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#dates - A list of key dates for this comic.' do
|
70
|
+
it 'is an array of KeyDate objects' do
|
71
|
+
expect(comic.dates.class).to eq Array
|
72
|
+
expect(comic.dates.first.class).to eq Marver::KeyDate
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
it '#text_objects - A set of descriptive text blurbs for the comic.' do
|
77
|
+
expect(comic.text_objects.class).to eq Array
|
78
|
+
expect(comic.text_objects.first.class).to eq Marver::TextObject
|
79
|
+
expect(comic.text_objects.first.type).to eq "issue_solicit_text"
|
80
|
+
expect(comic.text_objects.first.language).to eq "en-us"
|
81
|
+
expect(comic.text_objects.first.text).to eq "And there came an Age Of X, an age unlike any other, where there were no X-Men…mutants were hated and feared. In that age, the remaining mutants created a stronghold, a last bastion for their dying race: Fortress X. And in that Age Of X, when humanity vowed to see Fortress X destroyed, a team of heroes and heroines found themselves united against this terrible mutant threat. This is their epoch!"
|
82
|
+
end
|
83
|
+
|
84
|
+
it '#urls - A set of public web site URLs for the resource.' do
|
85
|
+
expect(comic.urls.class).to eq Array
|
86
|
+
expect(comic.urls.first.class).to eq Marver::Url
|
87
|
+
expect(comic.urls.first.type).to eq "detail"
|
88
|
+
expect(comic.urls.first.url).to eq "http://marvel.com/comics/issue/38524/age_of_x_universe_2011_1?utm_campaign=apiRef&utm_source=f302f582215c3deedff86e8015f853c7"
|
89
|
+
end
|
90
|
+
|
91
|
+
it '#series - A summary representation of the series to which this comic belongs.' do
|
92
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
93
|
+
expect(comic.series.class).to eq Array
|
94
|
+
expect(comic.series.first.class).to eq Marver::SerieSummary
|
95
|
+
expect(comic.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/13896?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
96
|
+
expect(comic.series.first.name).to eq "Age of X: Universe (2011)"
|
97
|
+
end
|
98
|
+
|
99
|
+
it '#images - A list of promotional images associated with this comic.' do
|
100
|
+
expect(comic.images.class).to eq Array
|
101
|
+
expect(comic.images.first.full_path).to eq "http://i.annihil.us/u/prod/marvel/i/mg/7/70/4f57719ff38c5.jpg"
|
102
|
+
expect(comic.images.last.full_path).to eq "http://i.annihil.us/u/prod/marvel/i/mg/b/b0/4d6d3430cd3bb.jpg"
|
103
|
+
end
|
104
|
+
|
105
|
+
it '#prices - A list of prices for this comic.' do
|
106
|
+
expect(comic.prices.class).to eq Array
|
107
|
+
expect(comic.prices.first.class).to eq Marver::Price
|
108
|
+
expect(comic.prices.first.type).to eq "printPrice"
|
109
|
+
expect(comic.prices.first.price).to eq 3.99
|
110
|
+
end
|
111
|
+
|
112
|
+
it '#characters - A resource list containing the characters which appear in this comic.' do
|
113
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
114
|
+
expect(comic.characters.class).to eq Array
|
115
|
+
expect(comic.characters.first.class).to eq Marver::CharacterSummary
|
116
|
+
expect(comic.characters.first.name).to eq "Captain America"
|
117
|
+
expect(comic.characters.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009220?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
118
|
+
end
|
119
|
+
|
120
|
+
it '#variants - A list of variant issues for this comic (includes the "original" issue if the current issue is a variant).'
|
121
|
+
it '#collections - A list of collections which include this comic (will generally be empty if the comic\'s format is a collection).'
|
122
|
+
it '#collected_issues - A list of issues collected in this comic (will generally be empty for periodical formats such as "comic" or "magazine").'
|
123
|
+
|
124
|
+
it '#creators - A resource list containing the creators associated with this comic.' do
|
125
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
126
|
+
expect(comic.creators.class).to eq Array
|
127
|
+
expect(comic.creators.first.class).to eq Marver::CreatorSummary
|
128
|
+
expect(comic.creators.first.name).to eq "Simone Bianchi"
|
129
|
+
expect(comic.creators.first.role).to eq "penciller (cover)"
|
130
|
+
expect(comic.creators.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/creators/648?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
131
|
+
end
|
132
|
+
|
133
|
+
it '#stories - A resource list containing the stories which appear in this comic.' do
|
134
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
135
|
+
expect(comic.stories.class).to eq Array
|
136
|
+
expect(comic.stories.first.class).to eq Marver::StorySummary
|
137
|
+
expect(comic.stories.first.name).to eq "Age of X: Avengers (2011) #1"
|
138
|
+
expect(comic.stories.first.type).to eq "cover"
|
139
|
+
expect(comic.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/90010?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
140
|
+
end
|
141
|
+
|
142
|
+
it '#events - A resource list containing the events in which this comic appears.' do
|
143
|
+
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
144
|
+
expect(comic.events.class).to eq Array
|
145
|
+
expect(comic.events.first.class).to eq Marver::EventSummary
|
146
|
+
expect(comic.events.first.name).to eq "Age of X"
|
147
|
+
expect(comic.events.first.type).to eq nil
|
148
|
+
expect(comic.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/303?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
149
|
+
end
|
150
|
+
end
|