ultron 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 +4 -4
- data/.gitignore +3 -1
- data/.rspec +1 -1
- data/.travis.yml +7 -0
- data/{LICENSE.txt → LICENSE.md} +2 -2
- data/README.md +19 -21
- data/Rakefile +1 -1
- data/config/params.yaml +0 -0
- data/config/ultron.yaml +2 -0
- data/examples/links.rb +0 -0
- data/lib/ultron.rb +29 -4
- data/lib/ultron/api/character.rb +19 -0
- data/lib/ultron/api/characters.rb +14 -0
- data/lib/ultron/api/comic.rb +15 -0
- data/lib/ultron/api/comics.rb +14 -0
- data/lib/ultron/api/creator.rb +19 -0
- data/lib/ultron/api/creators.rb +14 -0
- data/lib/ultron/api/entities.rb +45 -0
- data/lib/ultron/api/entity.rb +51 -0
- data/lib/ultron/api/event.rb +15 -0
- data/lib/ultron/api/events.rb +14 -0
- data/lib/ultron/api/series.rb +23 -0
- data/lib/ultron/api/serieses.rb +16 -0
- data/lib/ultron/api/stories.rb +14 -0
- data/lib/ultron/api/story.rb +15 -0
- data/lib/ultron/config.rb +35 -0
- data/lib/ultron/connection.rb +41 -0
- data/lib/ultron/helpers.rb +25 -0
- data/lib/ultron/version.rb +1 -1
- data/spec/cassettes/Ultron_API_Character/should_have_a_series_set.yml +88 -0
- data/spec/cassettes/Ultron_API_Character/should_have_an_events_set.yml +32 -0
- data/spec/cassettes/Ultron_API_Character/should_have_the_correct_name.yml +88 -0
- data/spec/cassettes/Ultron_API_Character/should_have_the_correct_sets/events.yml +32 -0
- data/spec/cassettes/Ultron_API_Character/should_not_have_any_events.yml +32 -0
- data/spec/cassettes/Ultron_API_CharacterSet/should_have_the_correct_first_character.yml +1616 -0
- data/spec/cassettes/Ultron_API_Characters/characters_filtered_by_comic/should_have_the_correct_first_character.yml +1616 -0
- data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_comic.yml +1862 -0
- data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_event.yml +3876 -0
- data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_series.yml +743 -0
- data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_story.yml +345 -0
- data/spec/cassettes/Ultron_API_Characters/get_a_character_by_name/should_have_the_correct_id.yml +114 -0
- data/spec/cassettes/Ultron_API_Characters/get_a_character_by_name/should_have_the_correct_name.yml +114 -0
- data/spec/cassettes/Ultron_API_Characters/get_a_character_with_a_space_in_their_name/should_have_the_correct_id.yml +99 -0
- data/spec/cassettes/Ultron_API_Characters/get_a_character_with_a_space_in_their_name/should_have_the_correct_name.yml +99 -0
- data/spec/cassettes/Ultron_API_Characters/get_the_first_character_off_the_list/should_have_the_correct_id.yml +644 -0
- data/spec/cassettes/Ultron_API_Characters/get_the_first_character_off_the_list/should_have_the_correct_name.yml +644 -0
- data/spec/cassettes/Ultron_API_Characters/get_the_first_character_off_the_list/should_have_the_correct_resourceURI.yml +644 -0
- data/spec/cassettes/Ultron_API_Characters/parameterize_the_request/should_let_us_set_multiple_parameters.yml +1595 -0
- data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_comic.yml +2737 -0
- data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_event.yml +7345 -0
- data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_series.yml +743 -0
- data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_story.yml +231 -0
- data/spec/cassettes/Ultron_API_Characters/should_have_genarate_a_list_of_characters_filtered_by_comic.yml +1616 -0
- data/spec/cassettes/Ultron_API_Characters/should_have_the_correct_first_character.yml +1616 -0
- data/spec/cassettes/Ultron_API_Characters/should_not_generate_a_list_of_characters_filtered_by_creator.yml +31 -0
- data/spec/cassettes/Ultron_API_Characters/should_not_generate_lists_of_characters/filtered_by_creator.yml +31 -0
- data/spec/cassettes/Ultron_API_Comic/should_have_a_list_of_characters.yml +46 -0
- data/spec/cassettes/Ultron_API_Comic/should_have_openstruct_method-style_attribute_accessors.yml +46 -0
- data/spec/cassettes/Ultron_API_Comic/should_have_the_correct_title.yml +46 -0
- data/spec/cassettes/Ultron_API_Comic/should_have_the_correct_year.yml +46 -0
- data/spec/cassettes/Ultron_API_ComicSet/should_have_the_correct_first_comic.yml +2013 -0
- data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_character.yml +2059 -0
- data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_creator.yml +2177 -0
- data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_event.yml +1701 -0
- data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_series.yml +123 -0
- data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_stories.yml +499 -0
- data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_story.yml +577 -0
- data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_id.yml +1039 -0
- data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_name.yml +946 -0
- data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_resourceURI.yml +1039 -0
- data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_title.yml +1039 -0
- data/spec/cassettes/Ultron_API_Comics/parameterize_the_request/should_let_us_set_a_dateRange.yml +1613 -0
- data/spec/cassettes/Ultron_API_Comics/parameterize_the_request/should_let_us_set_a_limit.yml +96 -0
- data/spec/cassettes/Ultron_API_Comics/should_generate_a_list_of_comics_filtered_by_character.yml +3955 -0
- data/spec/cassettes/Ultron_API_Comics/should_have_the_correct_first_comic.yml +2012 -0
- data/spec/cassettes/Ultron_API_ComicsSet/should_have_the_correct_first_comic.yml +2013 -0
- data/spec/cassettes/Ultron_API_Creator/it_should_have_the_correct_sets/comics.yml +2029 -0
- data/spec/cassettes/Ultron_API_Creator/should_have_a_comics_set.yml +2022 -0
- data/spec/cassettes/Ultron_API_Creator/should_have_the_correct_comic.yml +2029 -0
- data/spec/cassettes/Ultron_API_Creator/should_have_the_correct_name.yml +243 -0
- data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_comic.yml +1205 -0
- data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_event.yml +2778 -0
- data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_series.yml +4555 -0
- data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_story.yml +1253 -0
- data/spec/cassettes/Ultron_API_Creators/get_a_creator_by_name/should_return_the_correct_creator.yml +30 -0
- data/spec/cassettes/Ultron_API_Creators/get_the_fourth_creator_off_the_list/should_have_the_right_name.yml +1205 -0
- data/spec/cassettes/Ultron_API_Creators/get_the_second_creator_off_the_list/should_have_the_right_name.yml +384 -0
- data/spec/cassettes/Ultron_API_Creators/should_have_the_correct_first_comic.yml +32 -0
- data/spec/cassettes/Ultron_API_Creators/should_not_generate_a_list_of_creators_filtered_by_character.yml +31 -0
- data/spec/cassettes/Ultron_API_Creators/should_not_generate_lists_of_creators/filtered_by_character.yml +31 -0
- data/spec/cassettes/Ultron_API_Event/should_have_a_list_of_characters.yml +195 -0
- data/spec/cassettes/Ultron_API_Event/should_have_the_correct_first_character.yml +195 -0
- data/spec/cassettes/Ultron_API_Event/should_have_the_correct_title.yml +108 -0
- data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_character.yml +5161 -0
- data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_comic.yml +363 -0
- data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_creator.yml +9257 -0
- data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_series.yml +240 -0
- data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_story.yml +375 -0
- data/spec/cassettes/Ultron_API_Events/get_the_second_event_off_the_list/should_have_the_right_name.yml +4762 -0
- data/spec/cassettes/Ultron_API_Series/should_have_the_correct_sets/not_series.yml +40 -0
- data/spec/cassettes/Ultron_API_Series/should_have_the_correct_title.yml +40 -0
- data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_character.yml +3618 -0
- data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_comic.yml +31 -0
- data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_creator.yml +1104 -0
- data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_event.yml +591 -0
- data/spec/cassettes/Ultron_API_Serieses/get_the_third_event_off_the_list/should_have_the_right_name.yml +1780 -0
- data/spec/cassettes/Ultron_API_Serieses/should_not_generate_lists_of_series/filtered_by_comic.yml +31 -0
- data/spec/cassettes/Ultron_API_Serieses/should_not_generate_lists_of_series/filtered_by_story.yml +31 -0
- data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_character.yml +342 -0
- data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_comic.yml +110 -0
- data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_creator.yml +1041 -0
- data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_event.yml +846 -0
- data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_series.yml +143 -0
- data/spec/cassettes/Ultron_API_Stories/get_the_fourth_story_off_the_list/should_have_the_right_name.yml +686 -0
- data/spec/cassettes/Ultron_API_Stories/get_the_second_story_off_the_list/should_have_the_right_name.yml +686 -0
- data/spec/cassettes/Ultron_API_Story/should_have_the_correct_title.yml +40 -0
- data/spec/cassettes/Ultron_Connection/should_get_a_200.yml +559 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/vcr_setup.rb +17 -0
- data/spec/ultron/api/character_spec.rb +50 -0
- data/spec/ultron/api/comic_spec.rb +55 -0
- data/spec/ultron/api/creator_spec.rb +50 -0
- data/spec/ultron/api/event_spec.rb +50 -0
- data/spec/ultron/api/filtered_sets/characters_filtered_spec.rb +53 -0
- data/spec/ultron/api/filtered_sets/comics_filtered_spec.rb +51 -0
- data/spec/ultron/api/filtered_sets/creators_filtered_spec.rb +51 -0
- data/spec/ultron/api/filtered_sets/events_filtered_spec.rb +51 -0
- data/spec/ultron/api/filtered_sets/series_filtered_spec.rb +50 -0
- data/spec/ultron/api/filtered_sets/stories_filtered_spec.rb +52 -0
- data/spec/ultron/api/series_spec.rb +46 -0
- data/spec/ultron/api/sets/characters_spec.rb +71 -0
- data/spec/ultron/api/sets/comics_spec.rb +46 -0
- data/spec/ultron/api/sets/creators_spec.rb +29 -0
- data/spec/ultron/api/sets/events_spec.rb +26 -0
- data/spec/ultron/api/sets/serieses_spec.rb +26 -0
- data/spec/ultron/api/sets/stories_spec.rb +26 -0
- data/spec/ultron/api/story_spec.rb +46 -0
- data/spec/ultron/auth_spec.rb +13 -0
- data/spec/ultron/config_spec.rb +16 -0
- data/spec/ultron/connection_spec.rb +33 -0
- data/spec/ultron/helpers_spec.rb +11 -0
- data/ultron.gemspec +16 -11
- metadata +346 -50
- data/lib/ultron/characters.rb +0 -9
- data/spec/ultron/characters_spec.rb +0 -12
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Serieses do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'generate filtered lists of serieses' do
|
11
|
+
it 'by character', :vcr do
|
12
|
+
set = Serieses.new 'characters/1009368/series'
|
13
|
+
series = set[-1]
|
14
|
+
series.class.should == Series
|
15
|
+
series['id'].should == 9086
|
16
|
+
series.title.should == 'Avengers Academy (2010 - 2012)'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'by creator', :vcr do
|
20
|
+
series = Serieses.new('creators/196/series')[0]
|
21
|
+
series['id'].should == 2114
|
22
|
+
series['title'].should == 'All-Winners Comics (1941 - 1947)'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'by event', :vcr do
|
26
|
+
set = Serieses.new 'events/279/series'
|
27
|
+
series = set[-1]
|
28
|
+
series.id.should == 9808
|
29
|
+
series.title.should == 'X-Men: Second Coming - Revelations: Blind Science (2010)'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'should not generate lists of series' do
|
34
|
+
it 'filtered by comic', :vcr do
|
35
|
+
set = Serieses.new 'comics/5678/series'
|
36
|
+
set.any?.should == false
|
37
|
+
end
|
38
|
+
it 'filtered by story', :vcr do
|
39
|
+
set = Serieses.new 'stories/8765/series'
|
40
|
+
set.any?.should == false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
after :each do
|
46
|
+
Timecop.return
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Stories do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'generate filtered lists of stories' do
|
11
|
+
it 'by character', :vcr do
|
12
|
+
set = Stories.new 'characters/1009367/stories'
|
13
|
+
story = set[0]
|
14
|
+
story.class.should == Story
|
15
|
+
story['id'].should == 5872
|
16
|
+
story['title'].should == '1 of 7 - 7XLS'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'by comic', :vcr do
|
20
|
+
story = Stories.new('comics/41540/stories')[0]
|
21
|
+
story['id'].should == 93966
|
22
|
+
story['title'].should == 'Cover #93966'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'by creator', :vcr do
|
26
|
+
set = Stories.new 'creators/457/stories'
|
27
|
+
story = set[-1]
|
28
|
+
story.id.should == 851
|
29
|
+
story['title'].should == '1 of - Old Soldiers'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'by event', :vcr do
|
33
|
+
set = Stories.new 'events/303/stories'
|
34
|
+
story = set[0]
|
35
|
+
story['id'].should == 80882
|
36
|
+
story['title'].should == 'X-Men Legacy (2008) #247'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'by series', :vcr do
|
40
|
+
set = Stories.new 'series/9981/stories'
|
41
|
+
story = set[-1]
|
42
|
+
story.id.should == 74319
|
43
|
+
story['title'].should == 'Interior #74319'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
after :each do
|
48
|
+
Timecop.return
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Series do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@series = Ultron::API::Series.new 15280
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'should have the correct sets' do
|
12
|
+
it 'characters', :vcr do
|
13
|
+
@series.characters.class.should == Characters
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'creators', :vcr do
|
17
|
+
@series.creators.class.should == Creators
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'events', :vcr do
|
21
|
+
@series.events.class.should == Events
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'not comics', :vcr do
|
25
|
+
@series.comics.class.should == NilClass
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'not series', :vcr do
|
29
|
+
@series.serieses.class.should == NilClass
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'not stories', :vcr do
|
33
|
+
@series.stories.class.should == NilClass
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the correct title', :vcr do
|
38
|
+
@series.title.should == 'Amazing Fantasy 15: Spider-Man! (2011 - 2012)'
|
39
|
+
end
|
40
|
+
|
41
|
+
after :each do
|
42
|
+
Timecop.return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Characters do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@characters = Ultron::API::Characters.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Timecop.return
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'get the first character off the list' do
|
16
|
+
before :each do
|
17
|
+
@character = @characters[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the correct id', :vcr do
|
21
|
+
@character['id'].should == 1009521
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have the correct name', :vcr do
|
25
|
+
@character['name'].strip.should == 'Hank Pym'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the correct resourceURI', :vcr do
|
29
|
+
@character['resourceURI'].should == 'http://gateway.marvel.com/v1/public/characters/1009521'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'get a character by name' do
|
34
|
+
before :each do
|
35
|
+
@character = @characters.by_name('Hulk')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should have the correct name', :vcr do
|
39
|
+
@character['name'].should == 'Hulk'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should have the correct id', :vcr do
|
43
|
+
@character['id'].should == 1009351
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'get a character with a space in their name' do
|
48
|
+
before :each do
|
49
|
+
@character = @characters.by_name('Doctor Doom')
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should have the correct name', :vcr do
|
53
|
+
@character['name'].should == 'Doctor Doom'
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should have the correct id', :vcr do
|
57
|
+
@character['id'].should == 1009281
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'parameterize the request', :vcr do
|
62
|
+
it 'should let us set multiple parameters', :vcr do
|
63
|
+
@characters.add_params limit: 10
|
64
|
+
@characters.add_params offset: 400
|
65
|
+
@characters.length.should == 10
|
66
|
+
@characters[0].name.should == 'Galactus'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Comics do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@comics = Ultron::API::Comics.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Timecop.return
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'get the first comic off the list' do
|
16
|
+
before :each do
|
17
|
+
@comic = @comics[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the correct id', :vcr do
|
21
|
+
@comic['id'].should == 41530
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have the correct title', :vcr do
|
25
|
+
@comic['title'].strip.should == 'Ant-Man: So (Trade Paperback)'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the correct resourceURI', :vcr do
|
29
|
+
@comic['resourceURI'].should == 'http://gateway.marvel.com/v1/public/comics/41530'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'parameterize the request', :vcr do
|
34
|
+
it 'should let us set a limit', :vcr do
|
35
|
+
@comics.add_params limit: 1
|
36
|
+
@comics.length.should == 1
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should let us set a dateRange', :vcr do
|
40
|
+
@comics.add_params dateRange: '1980-01-01,1990-01-01'
|
41
|
+
@comics[0].title.should == 'Wolverine (1988) #20'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Creators do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@creators = Ultron::API::Creators.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Timecop.return
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'get the second creator off the list' do
|
16
|
+
before :each do
|
17
|
+
@creators.add_params offset: 600
|
18
|
+
@creator = @creators[1]
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have the right name', :vcr do
|
22
|
+
@creator.fullName.should == 'Nicholas Bertozzi'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Events do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@events = Ultron::API::Events.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Timecop.return
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'get the second event off the list' do
|
16
|
+
before :each do
|
17
|
+
@event = @events[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the right name', :vcr do
|
21
|
+
@event.title.should == 'Age of Apocalypse'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Serieses do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@serieses = Ultron::API::Serieses.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Timecop.return
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'get the third event off the list' do
|
16
|
+
before :each do
|
17
|
+
@series = @serieses[2]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the right name', :vcr do
|
21
|
+
@series.title.should == '1602 (2003 - 2004)'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Stories do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@stories = Ultron::API::Stories.new
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Timecop.return
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'get the second story off the list' do
|
16
|
+
before :each do
|
17
|
+
@story = @stories[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the right name', :vcr do
|
21
|
+
@story.title.should match /Investigating the murder of a teenage girl, Cage suddenly learns/
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
module API
|
5
|
+
describe Story do
|
6
|
+
before :each do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
@story = Ultron::API::Story.new 15820
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'should have the correct sets' do
|
12
|
+
it 'characters', :vcr do
|
13
|
+
@story.characters.class.should == Characters
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'comics', :vcr do
|
17
|
+
@story.comics.class.should == Comics
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'creators', :vcr do
|
21
|
+
@story.creators.class.should == Creators
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'events', :vcr do
|
25
|
+
@story.events.class.should == Events
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'series', :vcr do
|
29
|
+
@story.serieses.class.should == Serieses
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'not stories', :vcr do
|
33
|
+
@story.stories.class.should == NilClass
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the correct title', :vcr do
|
38
|
+
@story.title.should == 'Cover #15820'
|
39
|
+
end
|
40
|
+
|
41
|
+
after :each do
|
42
|
+
Timecop.return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
describe Ultron do
|
5
|
+
context 'auth' do
|
6
|
+
it 'should return the correct string' do
|
7
|
+
Timecop.freeze '2014-02-08T21:20:00+00:00'
|
8
|
+
Ultron.auth('public', 'private').should == 'ts=1391894400&apikey=private&hash=7b0ecfd5af9875bc436cfd5ecc58ef3d'
|
9
|
+
Timecop.return
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ultron
|
4
|
+
describe Config do
|
5
|
+
before :each do
|
6
|
+
@conf = Ultron::Config.instance.config
|
7
|
+
end
|
8
|
+
it 'should have a host name' do
|
9
|
+
@conf['host'].should == 'http://gateway.marvel.com'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have a url path' do
|
13
|
+
@conf['path'].should == '/v1/public/'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|