marver 0.0.2 → 0.0.4
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/.rspec +2 -0
- data/Gemfile +2 -11
- data/README.md +50 -13
- data/TODO +3 -0
- data/lib/marver.rb +50 -40
- data/lib/marver/api.rb +8 -0
- data/lib/marver/api/client.rb +28 -0
- data/lib/marver/api/credentials.rb +21 -0
- data/lib/marver/{rest → api}/error.rb +1 -1
- data/lib/marver/{rest → api}/response.rb +1 -2
- data/lib/marver/client.rb +2 -3
- data/lib/marver/configuration.rb +10 -0
- data/lib/marver/entities/character.rb +33 -0
- data/lib/marver/entities/{core/comic.rb → comic.rb} +10 -12
- data/lib/marver/entities/commonable.rb +37 -0
- data/lib/marver/entities/{core/creator.rb → creator.rb} +10 -13
- data/lib/marver/entities/event.rb +34 -0
- data/lib/marver/entities/{common/image.rb → image.rb} +0 -0
- data/lib/marver/entities/{common/key_date.rb → key_date.rb} +0 -0
- data/lib/marver/entities/{common/price.rb → price.rb} +0 -0
- data/lib/marver/entities/queryable.rb +12 -0
- data/lib/marver/entities/serie.rb +37 -0
- data/lib/marver/entities/story.rb +33 -0
- data/lib/marver/entities/summarizable.rb +54 -0
- data/lib/marver/entities/summary.rb +10 -0
- data/lib/marver/entities/summary/character.rb +23 -0
- data/lib/marver/entities/summary/comic.rb +21 -0
- data/lib/marver/entities/summary/creator.rb +19 -0
- data/lib/marver/entities/summary/event.rb +20 -0
- data/lib/marver/entities/summary/serie.rb +19 -0
- data/lib/marver/entities/summary/story.rb +20 -0
- data/lib/marver/entities/{common/text_object.rb → text_object.rb} +0 -0
- data/lib/marver/entities/{common/url.rb → url.rb} +0 -0
- data/lib/marver/finders/character_finder.rb +2 -15
- data/lib/marver/helpers/string_helper.rb +2 -2
- data/lib/marver/version.rb +1 -1
- data/marver.gemspec +4 -0
- data/spec/marver/{rest → api}/client_spec.rb +2 -3
- data/spec/marver/api/credentials_spec.rb +17 -0
- data/spec/marver/{rest → api}/error_spec.rb +3 -3
- data/spec/marver/api/response_spec.rb +25 -0
- data/spec/marver/client_spec.rb +9 -4
- data/spec/marver/configuration_spec.rb +18 -0
- data/spec/marver/data_container_spec.rb +1 -1
- data/spec/marver/entities/{core/character_spec.rb → character_spec.rb} +11 -16
- data/spec/marver/entities/{core/comic_spec.rb → comic_spec.rb} +12 -13
- data/spec/marver/entities/{core/creator_spec.rb → creator_spec.rb} +10 -12
- data/spec/marver/entities/{core/event_spec.rb → event_spec.rb} +17 -19
- data/spec/marver/entities/{core/serie_spec.rb → serie_spec.rb} +17 -25
- data/spec/marver/entities/{core/story_spec.rb → story_spec.rb} +10 -11
- data/spec/marver/entities/{summaries/character_summary_spec.rb → summary/character_spec.rb} +7 -10
- data/spec/marver/entities/{summaries/comic_summary_spec.rb → summary/comic_spec.rb} +7 -10
- data/spec/marver/entities/summary/creator_spec.rb +63 -0
- data/spec/marver/entities/summary/event_spec.rb +60 -0
- data/spec/marver/entities/summary/serie_spec.rb +57 -0
- data/spec/marver/entities/summary/story_spec.rb +61 -0
- data/spec/marver/finders/character_finder_spec.rb +1 -10
- data/spec/spec_helper.rb +20 -1
- metadata +121 -57
- data/lib/marver/builders/common_entities_builder.rb +0 -46
- data/lib/marver/builders/core_entities_builder.rb +0 -34
- data/lib/marver/credentials.rb +0 -23
- data/lib/marver/entities/core/character.rb +0 -35
- data/lib/marver/entities/core/event.rb +0 -35
- data/lib/marver/entities/core/serie.rb +0 -37
- data/lib/marver/entities/core/story.rb +0 -36
- data/lib/marver/entities/summaries/character_summary.rb +0 -22
- data/lib/marver/entities/summaries/comic_summary.rb +0 -20
- data/lib/marver/entities/summaries/creator_summary.rb +0 -12
- data/lib/marver/entities/summaries/event_summary.rb +0 -14
- data/lib/marver/entities/summaries/serie_summary.rb +0 -13
- data/lib/marver/entities/summaries/story_summary.rb +0 -14
- data/lib/marver/rest/client.rb +0 -22
- data/spec/marver/credentials_spec.rb +0 -19
- data/spec/marver/entities/summaries/creator_summary_spec.rb +0 -23
- data/spec/marver/entities/summaries/event_summary_spec.rb +0 -30
- data/spec/marver/entities/summaries/serie_summary_spec.rb +0 -26
- data/spec/marver/entities/summaries/story_summary_spec.rb +0 -30
- data/spec/marver/rest/response_spec.rb +0 -22
data/spec/marver/client_spec.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require './lib/marver/rest/client.rb'
|
3
|
-
require './lib/marver.rb'
|
4
2
|
|
5
3
|
describe Marver::Client do
|
6
|
-
|
4
|
+
before :each do
|
5
|
+
Marver.configure do |config|
|
6
|
+
config.public_key = 'pub-key'
|
7
|
+
config.private_key = 'priv-key'
|
8
|
+
end
|
9
|
+
|
10
|
+
@client = Marver::Client.new
|
11
|
+
end
|
7
12
|
|
8
13
|
it 'has a character finder' do
|
9
|
-
expect(client.characters.class).to eq Marver::CharacterFinder
|
14
|
+
expect(@client.characters.class).to eq Marver::CharacterFinder
|
10
15
|
end
|
11
16
|
|
12
17
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Marver::Configuration do
|
4
|
+
before :each do
|
5
|
+
Marver.configure do |config|
|
6
|
+
config.private_key = 'priv123'
|
7
|
+
config.public_key = 'pub123'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'has a private key' do
|
12
|
+
expect(Marver.configuration.private_key).to eq 'priv123'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has a public key' do
|
16
|
+
expect(Marver.configuration.public_key).to eq 'pub123'
|
17
|
+
end
|
18
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require './lib/marver.rb'
|
2
2
|
|
3
3
|
describe Marver::DataContainer do
|
4
|
-
let(:response) { Marver::
|
4
|
+
let(:response) { Marver::API::Response.new("{ \"code\": 200, \"status\": \"Ok\", \"etag\": \"ec5ab621cf3760eb6f2df2e6270ccb56c6debfb7\", \"data\": { \"offset\": 0, \"limit\": 20, \"total\": 1, \"count\": 1, \"results\": [1]}}") }
|
5
5
|
|
6
6
|
let(:data_container) { Marver::DataContainer.new(response) }
|
7
7
|
|
@@ -4,10 +4,9 @@ describe Marver::Character do
|
|
4
4
|
|
5
5
|
describe 'Attributes' do
|
6
6
|
let(:json) { fixture('character.json').read }
|
7
|
-
let(:response) { Marver::
|
8
|
-
let(:credentials) { Marver::Credentials.new('pub_key', 'priv_key') }
|
7
|
+
let(:response) { Marver::API::Response.new(json) }
|
9
8
|
let(:data_container) { Marver::DataContainer.new(response) }
|
10
|
-
let(:character) { Marver::Character.new(data_container.results
|
9
|
+
let(:character) { Marver::Character.new(data_container.results) }
|
11
10
|
|
12
11
|
it '#id - The unique ID of the character resource' do
|
13
12
|
expect(character.id).to eq 1009220
|
@@ -23,7 +22,7 @@ describe Marver::Character do
|
|
23
22
|
|
24
23
|
it '#resourceURI - The canonical URL identifier for this resource.' do
|
25
24
|
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
|
25
|
+
expect(character.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009220"
|
27
26
|
end
|
28
27
|
|
29
28
|
it '#urls - A set of public web site URLs for the resource.' do
|
@@ -38,37 +37,33 @@ describe Marver::Character do
|
|
38
37
|
end
|
39
38
|
|
40
39
|
context 'summary objects' do
|
41
|
-
before :each do
|
42
|
-
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
43
|
-
end
|
44
|
-
|
45
40
|
it '#comics - A resource list containing comics which feature this character.' do
|
46
41
|
expect(character.comics.class).to eq Array
|
47
|
-
expect(character.comics.first.class).to eq Marver::
|
42
|
+
expect(character.comics.first.class).to eq Marver::Summary::Comic
|
48
43
|
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
|
44
|
+
expect(character.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/42539"
|
50
45
|
end
|
51
46
|
|
52
47
|
it '#stories - A resource list of stories in which this character appears.' do
|
53
48
|
expect(character.stories.class).to eq Array
|
54
|
-
expect(character.stories.first.class).to eq Marver::
|
49
|
+
expect(character.stories.first.class).to eq Marver::Summary::Story
|
55
50
|
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
|
51
|
+
expect(character.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/892"
|
57
52
|
expect(character.stories.first.type).to eq "cover"
|
58
53
|
end
|
59
54
|
|
60
55
|
it '#events - A resource list of events in which this character appears.' do
|
61
56
|
expect(character.events.class).to eq Array
|
62
|
-
expect(character.events.first.class).to eq Marver::
|
57
|
+
expect(character.events.first.class).to eq Marver::Summary::Event
|
63
58
|
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
|
59
|
+
expect(character.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/116"
|
65
60
|
end
|
66
61
|
|
67
62
|
it '#series - A resource list of series in which this character appears.' do
|
68
63
|
expect(character.series.class).to eq Array
|
69
|
-
expect(character.series.first.class).to eq Marver::
|
64
|
+
expect(character.series.first.class).to eq Marver::Summary::Serie
|
70
65
|
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
|
66
|
+
expect(character.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/15331"
|
72
67
|
end
|
73
68
|
end
|
74
69
|
|
@@ -2,8 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Marver::Comic do
|
4
4
|
let(:json) { JSON.parse(fixture('comic.json').read)['data']['results'].first }
|
5
|
-
let(:
|
6
|
-
let(:comic) { Marver::Comic.new(json, credentials) }
|
5
|
+
let(:comic) { Marver::Comic.new(json) }
|
7
6
|
|
8
7
|
it '#id - The unique ID of the comic resource' do
|
9
8
|
expect(comic.id).to eq 38524
|
@@ -15,7 +14,7 @@ describe Marver::Comic do
|
|
15
14
|
|
16
15
|
it '#resource_uri - The canonical URL identifier for this resource.' do
|
17
16
|
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
|
17
|
+
expect(comic.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/38524"
|
19
18
|
end
|
20
19
|
|
21
20
|
it '#digital_id - The ID of the digital comic representation of this comic. Will be 0 if the comic is not available digitally.' do
|
@@ -91,8 +90,8 @@ describe Marver::Comic do
|
|
91
90
|
it '#series - A summary representation of the series to which this comic belongs.' do
|
92
91
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
93
92
|
expect(comic.series.class).to eq Array
|
94
|
-
expect(comic.series.first.class).to eq Marver::
|
95
|
-
expect(comic.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/13896
|
93
|
+
expect(comic.series.first.class).to eq Marver::Summary::Serie
|
94
|
+
expect(comic.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/13896"
|
96
95
|
expect(comic.series.first.name).to eq "Age of X: Universe (2011)"
|
97
96
|
end
|
98
97
|
|
@@ -112,9 +111,9 @@ describe Marver::Comic do
|
|
112
111
|
it '#characters - A resource list containing the characters which appear in this comic.' do
|
113
112
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
114
113
|
expect(comic.characters.class).to eq Array
|
115
|
-
expect(comic.characters.first.class).to eq Marver::
|
114
|
+
expect(comic.characters.first.class).to eq Marver::Summary::Character
|
116
115
|
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
|
116
|
+
expect(comic.characters.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009220"
|
118
117
|
end
|
119
118
|
|
120
119
|
it '#variants - A list of variant issues for this comic (includes the "original" issue if the current issue is a variant).'
|
@@ -124,27 +123,27 @@ describe Marver::Comic do
|
|
124
123
|
it '#creators - A resource list containing the creators associated with this comic.' do
|
125
124
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
126
125
|
expect(comic.creators.class).to eq Array
|
127
|
-
expect(comic.creators.first.class).to eq Marver::
|
126
|
+
expect(comic.creators.first.class).to eq Marver::Summary::Creator
|
128
127
|
expect(comic.creators.first.name).to eq "Simone Bianchi"
|
129
128
|
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
|
129
|
+
expect(comic.creators.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/creators/648"
|
131
130
|
end
|
132
131
|
|
133
132
|
it '#stories - A resource list containing the stories which appear in this comic.' do
|
134
133
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
135
134
|
expect(comic.stories.class).to eq Array
|
136
|
-
expect(comic.stories.first.class).to eq Marver::
|
135
|
+
expect(comic.stories.first.class).to eq Marver::Summary::Story
|
137
136
|
expect(comic.stories.first.name).to eq "Age of X: Avengers (2011) #1"
|
138
137
|
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
|
138
|
+
expect(comic.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/90010"
|
140
139
|
end
|
141
140
|
|
142
141
|
it '#events - A resource list containing the events in which this comic appears.' do
|
143
142
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
144
143
|
expect(comic.events.class).to eq Array
|
145
|
-
expect(comic.events.first.class).to eq Marver::
|
144
|
+
expect(comic.events.first.class).to eq Marver::Summary::Event
|
146
145
|
expect(comic.events.first.name).to eq "Age of X"
|
147
146
|
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
|
147
|
+
expect(comic.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/303"
|
149
148
|
end
|
150
149
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'json'
|
3
|
-
require './lib/marver.rb'
|
4
3
|
|
5
4
|
describe Marver::Creator do
|
6
5
|
|
7
6
|
let(:json) { fixture('creator.json').read }
|
8
|
-
let(:response) { Marver::
|
9
|
-
let(:credentials) { Marver::Credentials.new('pub_key', 'priv_key') }
|
7
|
+
let(:response) { Marver::API::Response.new(json) }
|
10
8
|
let(:data_container) { Marver::DataContainer.new(response) }
|
11
|
-
let(:creator) { Marver::Creator.new(data_container.results
|
9
|
+
let(:creator) { Marver::Creator.new(data_container.results) }
|
12
10
|
|
13
11
|
it '#id - The unique ID of the creator resource.' do
|
14
12
|
expect(creator.id).to eq 648
|
@@ -52,32 +50,32 @@ describe Marver::Creator do
|
|
52
50
|
it '#series - A resource list containing the series which feature work by this creator.' do
|
53
51
|
Time.stub_chain(:now, :to_i, :to_s).and_return '1'
|
54
52
|
expect(creator.series.class).to eq Array
|
55
|
-
expect(creator.series.first.class).to eq Marver::
|
53
|
+
expect(creator.series.first.class).to eq Marver::Summary::Serie
|
56
54
|
expect(creator.series.first.name).to eq "Age of X: Universe (2011)"
|
57
|
-
expect(creator.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/13896
|
55
|
+
expect(creator.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/13896"
|
58
56
|
end
|
59
57
|
|
60
58
|
it '#comics - A resource list containing the stories which feature work by this creator' do
|
61
59
|
Time.stub_chain(:now, :to_i, :to_s).and_return '1'
|
62
60
|
expect(creator.comics.class).to eq Array
|
63
|
-
expect(creator.comics.first.class).to eq Marver::
|
61
|
+
expect(creator.comics.first.class).to eq Marver::Summary::Comic
|
64
62
|
expect(creator.comics.first.name).to eq "Age of X: Universe (2011) #1"
|
65
|
-
expect(creator.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/38524
|
63
|
+
expect(creator.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/38524"
|
66
64
|
end
|
67
65
|
|
68
66
|
it '#stories - A resource list containing the comics which feature work by this creator.' do
|
69
67
|
Time.stub_chain(:now, :to_i, :to_s).and_return '1'
|
70
68
|
expect(creator.stories.class).to eq Array
|
71
|
-
expect(creator.stories.first.class).to eq Marver::
|
69
|
+
expect(creator.stories.first.class).to eq Marver::Summary::Story
|
72
70
|
expect(creator.stories.first.name).to eq "1 of 6 - Evolution"
|
73
|
-
expect(creator.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/2243
|
71
|
+
expect(creator.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/2243"
|
74
72
|
end
|
75
73
|
|
76
74
|
it '#events - A resource list containing the events which feature work by this creator.' do
|
77
75
|
Time.stub_chain(:now, :to_i, :to_s).and_return '1'
|
78
76
|
expect(creator.events.class).to eq Array
|
79
|
-
expect(creator.events.first.class).to eq Marver::
|
77
|
+
expect(creator.events.first.class).to eq Marver::Summary::Event
|
80
78
|
expect(creator.events.first.name).to eq "Age of X"
|
81
|
-
expect(creator.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/303
|
79
|
+
expect(creator.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/303"
|
82
80
|
end
|
83
81
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'json'
|
3
|
-
require './lib/marver.rb'
|
4
3
|
|
5
4
|
describe Marver::Event do
|
6
5
|
let(:json) { fixture('event.json').read }
|
7
|
-
let(:response) { Marver::
|
8
|
-
let(:credentials) { Marver::Credentials.new('pub_key', 'priv_key') }
|
6
|
+
let(:response) { Marver::API::Response.new(json) }
|
9
7
|
let(:data_container) { Marver::DataContainer.new(response) }
|
10
|
-
let(:event) { Marver::Event.new(data_container.results
|
8
|
+
let(:event) { Marver::Event.new(data_container.results) }
|
11
9
|
|
12
10
|
it "#title - The title of the event." do
|
13
11
|
expect(event.title).to eq "Fall of the Mutants"
|
@@ -15,7 +13,7 @@ describe Marver::Event do
|
|
15
13
|
|
16
14
|
it "#resourceURI - The canonical URL identifier for this resource." do
|
17
15
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
18
|
-
expect(event.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/248
|
16
|
+
expect(event.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/248"
|
19
17
|
end
|
20
18
|
|
21
19
|
it '#description - A description of the event.' do
|
@@ -51,56 +49,56 @@ describe Marver::Event do
|
|
51
49
|
it '#comics - A resource list containing the comics in this event.' do
|
52
50
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
53
51
|
expect(event.comics.class).to eq Array
|
54
|
-
expect(event.comics.first.class).to eq Marver::
|
52
|
+
expect(event.comics.first.class).to eq Marver::Summary::Comic
|
55
53
|
expect(event.comics.first.name).to eq "Captain America (1968) #339"
|
56
|
-
expect(event.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/7720
|
54
|
+
expect(event.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/7720"
|
57
55
|
end
|
58
56
|
|
59
57
|
it '#stories - A resource list containing the stories in this event.' do
|
60
58
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
61
59
|
expect(event.stories.class).to eq Array
|
62
|
-
expect(event.stories.first.class).to eq Marver::
|
60
|
+
expect(event.stories.first.class).to eq Marver::Summary::Story
|
63
61
|
expect(event.stories.first.name).to eq "Fall of the Mutants"
|
64
|
-
expect(event.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/22222
|
62
|
+
expect(event.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/22222"
|
65
63
|
expect(event.stories.first.type).to eq 'cover'
|
66
64
|
end
|
67
65
|
|
68
66
|
it '#series - A resource list containing the series in this event.' do
|
69
67
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
70
68
|
expect(event.series.class).to eq Array
|
71
|
-
expect(event.series.first.class).to eq Marver::
|
69
|
+
expect(event.series.first.class).to eq Marver::Summary::Serie
|
72
70
|
expect(event.series.first.name).to eq "Daredevil (1963 - 1998)"
|
73
|
-
expect(event.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/2002
|
71
|
+
expect(event.series.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/2002"
|
74
72
|
end
|
75
73
|
|
76
74
|
it '#characters - A resource list containing the characters which appear in this event.' do
|
77
75
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
78
76
|
expect(event.characters.class).to eq Array
|
79
|
-
expect(event.characters.first.class).to eq Marver::
|
77
|
+
expect(event.characters.first.class).to eq Marver::Summary::Character
|
80
78
|
expect(event.characters.first.name).to eq "Havok"
|
81
|
-
expect(event.characters.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009337
|
79
|
+
expect(event.characters.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009337"
|
82
80
|
end
|
83
81
|
|
84
82
|
it '#creators - A resource list containing creators whose work appears in this event.' do
|
85
83
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
86
84
|
expect(event.creators.class).to eq Array
|
87
|
-
expect(event.creators.first.class).to eq Marver::
|
85
|
+
expect(event.creators.first.class).to eq Marver::Summary::Creator
|
88
86
|
expect(event.creators.first.name).to eq "Mark Gruenwald"
|
89
87
|
expect(event.creators.first.role).to eq "writer"
|
90
|
-
expect(event.creators.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/creators/259
|
88
|
+
expect(event.creators.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/creators/259"
|
91
89
|
end
|
92
90
|
|
93
91
|
it '#next - A summary representation of the event which follows this event.' do
|
94
92
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
95
|
-
expect(event.next.class).to eq Marver::
|
96
|
-
expect(event.next.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/252
|
93
|
+
expect(event.next.class).to eq Marver::Summary::Event
|
94
|
+
expect(event.next.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/252"
|
97
95
|
expect(event.next.type).to eq nil
|
98
96
|
end
|
99
97
|
|
100
98
|
it '#previous - A summary representation of the event which preceded this event.' do
|
101
99
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
102
|
-
expect(event.previous.class).to eq Marver::
|
103
|
-
expect(event.previous.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/246
|
100
|
+
expect(event.previous.class).to eq Marver::Summary::Event
|
101
|
+
expect(event.previous.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/246"
|
104
102
|
expect(event.previous.type).to eq nil
|
105
103
|
end
|
106
104
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'json'
|
3
|
-
require './lib/marver.rb'
|
4
3
|
|
5
4
|
describe Marver::Serie do
|
6
5
|
|
7
6
|
let(:json) { fixture('serie.json').read }
|
8
|
-
let(:response) { Marver::
|
9
|
-
let(:credentials) { Marver::Credentials.new('pub_key', 'priv_key') }
|
7
|
+
let(:response) { Marver::API::Response.new(json) }
|
10
8
|
let(:data_container) { Marver::DataContainer.new(response) }
|
11
|
-
let(:serie) { Marver::Serie.new(data_container.results
|
9
|
+
let(:serie) { Marver::Serie.new(data_container.results) }
|
12
10
|
|
13
11
|
it '#id - The unique ID of the series resource.' do
|
14
12
|
expect(serie.id).to eq 2002
|
@@ -43,57 +41,50 @@ describe Marver::Serie do
|
|
43
41
|
end
|
44
42
|
|
45
43
|
it '#comics - A resource list containing comics in this series.' do
|
46
|
-
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
47
44
|
expect(serie.comics.class).to eq Array
|
48
|
-
expect(serie.comics.first.class).to eq Marver::
|
45
|
+
expect(serie.comics.first.class).to eq Marver::Summary::Comic
|
49
46
|
expect(serie.comics.first.name).to eq "Daredevil (1963)"
|
50
|
-
expect(serie.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/8072
|
47
|
+
expect(serie.comics.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/8072"
|
51
48
|
end
|
52
49
|
|
53
50
|
it '#stories - A resource list containing stories which occur in comics in this series.' do
|
54
|
-
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
55
51
|
expect(serie.stories.class).to eq Array
|
56
|
-
expect(serie.stories.first.class).to eq Marver::
|
52
|
+
expect(serie.stories.first.class).to eq Marver::Summary::Story
|
57
53
|
expect(serie.stories.first.name).to eq "Life Be Not Proud!"
|
58
|
-
expect(serie.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/15722
|
54
|
+
expect(serie.stories.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/15722"
|
59
55
|
expect(serie.stories.first.type).to eq "interiorStory"
|
60
56
|
end
|
61
57
|
|
62
58
|
it '#events - A resource list containing events which take place in comics in this series.' do
|
63
|
-
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
64
59
|
expect(serie.events.class).to eq Array
|
65
|
-
expect(serie.events.first.class).to eq Marver::
|
60
|
+
expect(serie.events.first.class).to eq Marver::Summary::Event
|
66
61
|
expect(serie.events.first.name).to eq "Acts of Vengeance!"
|
67
|
-
expect(serie.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/116
|
62
|
+
expect(serie.events.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/events/116"
|
68
63
|
end
|
69
64
|
|
70
65
|
it '#characters - A resource list containing characters which appear in comics in this series.' do
|
71
|
-
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
72
66
|
expect(serie.characters.class).to eq Array
|
73
|
-
expect(serie.characters.first.class).to eq Marver::
|
67
|
+
expect(serie.characters.first.class).to eq Marver::Summary::Character
|
74
68
|
expect(serie.characters.first.name).to eq "Beast"
|
75
|
-
expect(serie.characters.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009175
|
69
|
+
expect(serie.characters.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/characters/1009175"
|
76
70
|
end
|
77
71
|
|
78
72
|
it '#creators - A resource list of creators whose work appears in comics in this series.' do
|
79
|
-
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
80
73
|
expect(serie.creators.class).to eq Array
|
81
|
-
expect(serie.creators.first.class).to eq Marver::
|
74
|
+
expect(serie.creators.first.class).to eq Marver::Summary::Creator
|
82
75
|
expect(serie.creators.first.name).to eq "Mark Bagley"
|
83
|
-
expect(serie.creators.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/creators/87
|
76
|
+
expect(serie.creators.first.resource_uri).to eq "http://gateway.marvel.com/v1/public/creators/87"
|
84
77
|
expect(serie.creators.first.role).to eq "penciller (cover)"
|
85
78
|
end
|
86
79
|
|
87
80
|
it '#next - A summary representation of the series which follows this series.' do
|
88
|
-
|
89
|
-
expect(serie.next.
|
90
|
-
expect(serie.next.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/449?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
81
|
+
expect(serie.next.class).to eq Marver::Summary::Serie
|
82
|
+
expect(serie.next.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/449"
|
91
83
|
end
|
92
84
|
|
93
85
|
it '#previous - A summary representation of the series which preceded this series.' do
|
94
|
-
|
95
|
-
expect(serie.previous.
|
96
|
-
expect(serie.previous.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/449?ts=1&apikey=priv_key&hash=668dea517c974c12d8d0193cf2d8f7f7"
|
86
|
+
expect(serie.previous.class).to eq Marver::Summary::Serie
|
87
|
+
expect(serie.previous.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/449"
|
97
88
|
end
|
98
89
|
|
99
90
|
it "#title - Serie's title" do
|
@@ -103,4 +94,5 @@ describe Marver::Serie do
|
|
103
94
|
it "#resource_uri - Full cannonical URL of the entity" do
|
104
95
|
expect(serie.resource_uri).to eq "http://gateway.marvel.com/v1/public/series/2002"
|
105
96
|
end
|
97
|
+
|
106
98
|
end
|
@@ -3,10 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Marver::Story do
|
4
4
|
describe "Attributes" do
|
5
5
|
let(:json) { fixture('story.json').read }
|
6
|
-
let(:response) { Marver::
|
7
|
-
let(:credentials) { Marver::Credentials.new('pub_key', 'priv_key') }
|
6
|
+
let(:response) { Marver::API::Response.new(json) }
|
8
7
|
let(:data_container) { Marver::DataContainer.new(response) }
|
9
|
-
let(:story) { Marver::Story.new(data_container.results
|
8
|
+
let(:story) { Marver::Story.new(data_container.results) }
|
10
9
|
|
11
10
|
it "#title - The story title." do
|
12
11
|
expect(story.title).to eq "Cover #892"
|
@@ -18,7 +17,7 @@ describe Marver::Story do
|
|
18
17
|
|
19
18
|
it "#resource_uri - The canonical URL identifier for this resource." do
|
20
19
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
21
|
-
expect(story.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/892
|
20
|
+
expect(story.resource_uri).to eq "http://gateway.marvel.com/v1/public/stories/892"
|
22
21
|
end
|
23
22
|
|
24
23
|
it '#description - A short description of the story.' do
|
@@ -31,39 +30,39 @@ describe Marver::Story do
|
|
31
30
|
|
32
31
|
it '#comics - A resource list containing comics in which this story takes place.' do
|
33
32
|
expect(story.comics.class).to eq Array
|
34
|
-
expect(story.comics.first.class).to eq Marver::
|
33
|
+
expect(story.comics.first.class).to eq Marver::Summary::Comic
|
35
34
|
expect(story.comics.first.name).to eq "Thor (1998) #81"
|
36
35
|
end
|
37
36
|
|
38
37
|
it '#series - A resource list containing series in which this story appears.' do
|
39
38
|
expect(story.series.class).to eq Array
|
40
|
-
expect(story.series.first.class).to eq Marver::
|
39
|
+
expect(story.series.first.class).to eq Marver::Summary::Serie
|
41
40
|
expect(story.series.first.name).to eq "Thor (1998 - 2004)"
|
42
41
|
end
|
43
42
|
|
44
43
|
it '#events - A resource list of the events in which this story appears.' do
|
45
44
|
expect(story.events.class).to eq Array
|
46
|
-
expect(story.events.first.class).to eq Marver::
|
45
|
+
expect(story.events.first.class).to eq Marver::Summary::Event
|
47
46
|
expect(story.events.first.name).to eq "Avengers Disassembled"
|
48
47
|
end
|
49
48
|
|
50
49
|
it '#characters - A resource list of characters which appear in this story.' do
|
51
50
|
expect(story.characters.class).to eq Array
|
52
|
-
expect(story.characters.first.class).to eq Marver::
|
51
|
+
expect(story.characters.first.class).to eq Marver::Summary::Character
|
53
52
|
expect(story.characters.first.name).to eq "Avengers"
|
54
53
|
end
|
55
54
|
|
56
55
|
it '#creators - A resource list of creators who worked on this story.' do
|
57
56
|
expect(story.creators.class).to eq Array
|
58
|
-
expect(story.creators.first.class).to eq Marver::
|
57
|
+
expect(story.creators.first.class).to eq Marver::Summary::Creator
|
59
58
|
expect(story.creators.first.name).to eq "Steve Epting"
|
60
59
|
end
|
61
60
|
|
62
61
|
it '#original_issue - A summary representation of the issue in which this story was originally published.' do
|
63
62
|
Time.stub_chain(:now, :to_i, :to_s).and_return "1"
|
64
|
-
expect(story.original_issue.class).to eq Marver::
|
63
|
+
expect(story.original_issue.class).to eq Marver::Summary::Comic
|
65
64
|
expect(story.original_issue.name).to eq "Thor (1998) #81"
|
66
|
-
expect(story.original_issue.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/715
|
65
|
+
expect(story.original_issue.resource_uri).to eq "http://gateway.marvel.com/v1/public/comics/715"
|
67
66
|
end
|
68
67
|
|
69
68
|
end
|