marvelite 0.0.4 → 0.0.5

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.
@@ -0,0 +1,159 @@
1
+ require 'spec_helper'
2
+
3
+ describe Marvelite::API::Client do
4
+ context "Events Endpoints" do
5
+ let(:client) { marvelite_test_client }
6
+
7
+ describe '#events' do
8
+ before do
9
+ stub_get('events?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/events.json')
10
+ end
11
+
12
+ it 'returns a Marvelite::API::Response object' do
13
+ expect(client.events).to be_a(Marvelite::API::Response)
14
+ end
15
+
16
+ it 'Response object is populated with JSON from the events endpoint' do
17
+ expect(client.events["status"]).to eq("Ok")
18
+ expect(client.events[:data][:results].size).to eq(20)
19
+ end
20
+ end
21
+
22
+ describe '#event' do
23
+ before do
24
+ stub_get('events/40128?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event.json')
25
+ stub_get('events?name=Acts%20of%20Vengeance!&apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event.json')
26
+ end
27
+ it 'returns a Marvelite::API::Response object' do
28
+ expect(client.event(40128)).to be_a(Marvelite::API::Response)
29
+ end
30
+
31
+ it 'Response object is populated with JSON from the event endpoint' do
32
+ expect(client.event(40128)[:data][:results][0][:title]).to eq('Acts of Vengeance!')
33
+ end
34
+
35
+ it 'accepts an Integer as event id' do
36
+ expect(client.event(40128)[:data][:results][0][:title]).to eq('Acts of Vengeance!')
37
+ end
38
+
39
+ it 'accepts a String as event name' do
40
+ expect(client.event('Acts of Vengeance!')[:data][:results][0][:title]).to eq('Acts of Vengeance!')
41
+ end
42
+ end
43
+
44
+ describe '#event_characters' do
45
+ before do
46
+ stub_get('events/116/characters?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event_characters.json')
47
+ end
48
+
49
+ it 'returns a Marvelite::API::Response object' do
50
+ expect(client.event_characters(116)).to be_a(Marvelite::API::Response)
51
+ end
52
+
53
+ it 'Response object is populated with JSON from the events endpoint' do
54
+ expect(client.event_characters(116)["status"]).to eq("Ok")
55
+ expect(client.event_characters(116)[:data][:results].size).to eq(20)
56
+ end
57
+
58
+ it 'accepts an Integer as event id' do
59
+ expect(client.event_characters(116)[:data][:results][0][:name]).to eq('Alpha Flight')
60
+ end
61
+
62
+ it 'accepts a String as event id' do
63
+ expect(client.event_characters('Acts of Vengeance!')[:data][:results][0][:name]).to eq('Alpha Flight')
64
+ end
65
+ end
66
+
67
+ describe '#event_comics' do
68
+ before do
69
+ stub_get('events/116/comics?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event_comics.json')
70
+ end
71
+
72
+ it 'returns a Marvelite::API::Response object' do
73
+ expect(client.event_comics(116)).to be_a(Marvelite::API::Response)
74
+ end
75
+
76
+ it 'Response object is populated with JSON from the events endpoint' do
77
+ expect(client.event_comics(116)["status"]).to eq("Ok")
78
+ expect(client.event_comics(116)[:data][:results].size).to eq(20)
79
+ end
80
+
81
+ it 'accepts an Integer as event id' do
82
+ expect(client.event_comics(116)[:data][:results][0][:title]).to eq('Avengers West Coast: Darker than Scarlet (Trade Paperback)')
83
+ end
84
+
85
+ it 'accepts a String as event id' do
86
+ expect(client.event_comics('Acts of Vengeance!')[:data][:results][0][:title]).to eq('Avengers West Coast: Darker than Scarlet (Trade Paperback)')
87
+ end
88
+ end
89
+
90
+ describe '#event_creators' do
91
+ before do
92
+ stub_get('events/116/creators?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event_creators.json')
93
+ end
94
+
95
+ it 'returns a Marvelite::API::Response object' do
96
+ expect(client.event_creators(116)).to be_a(Marvelite::API::Response)
97
+ end
98
+
99
+ it 'Response object is populated with JSON from the events endpoint' do
100
+ expect(client.event_creators(116)["status"]).to eq("Ok")
101
+ expect(client.event_creators(116)[:data][:results].size).to eq(20)
102
+ end
103
+
104
+ it 'accepts an Integer as event id' do
105
+ expect(client.event_creators(116)[:data][:results][0][:fullName]).to eq('Jeff Albrecht')
106
+ end
107
+
108
+ it 'accepts a String as event id' do
109
+ expect(client.event_creators('Acts of Vengeance!')[:data][:results][0][:fullName]).to eq('Jeff Albrecht')
110
+ end
111
+ end
112
+
113
+ describe '#event_series' do
114
+ before do
115
+ stub_get('events/116/series?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event_stories.json')
116
+ end
117
+
118
+ it 'returns a Marvelite::API::Response object' do
119
+ expect(client.event_series(116)).to be_a(Marvelite::API::Response)
120
+ end
121
+
122
+ it 'Response object is populated with JSON from the events endpoint' do
123
+ expect(client.event_series(116)["status"]).to eq("Ok")
124
+ expect(client.event_series(116)[:data][:results].size).to eq(20)
125
+ end
126
+
127
+ it 'accepts an Integer as event id' do
128
+ expect(client.event_series(116)[:data][:results][0][:title]).to eq('Cover #12960')
129
+ end
130
+
131
+ it 'accepts a String as event id' do
132
+ expect(client.event_series('Acts of Vengeance!')[:data][:results][0][:title]).to eq('Cover #12960')
133
+ end
134
+ end
135
+
136
+ describe '#event_stories' do
137
+ before do
138
+ stub_get('events/116/stories?apikey=123456&ts=1&hash=d4f1bab013916a533ef31e3ad5fb0887', 'events/event_stories.json')
139
+ end
140
+
141
+ it 'returns a Marvelite::API::Response object' do
142
+ expect(client.event_stories(116)).to be_a(Marvelite::API::Response)
143
+ end
144
+
145
+ it 'Response object is populated with JSON from the events endpoint' do
146
+ expect(client.event_stories(116)["status"]).to eq("Ok")
147
+ expect(client.event_stories(116)[:data][:results].size).to eq(20)
148
+ end
149
+
150
+ it 'accepts an Integer as event id' do
151
+ expect(client.event_stories(116)[:data][:results][0][:title]).to eq('Cover #12960')
152
+ end
153
+
154
+ it 'accepts a String as event id' do
155
+ expect(client.event_stories('Acts of Vengeance!')[:data][:results][0][:title]).to eq('Cover #12960')
156
+ end
157
+ end
158
+ end
159
+ end
@@ -17,8 +17,8 @@ describe Marvelite::API::Client do
17
17
 
18
18
  describe '#api_version' do
19
19
  it 'receives an :api_version optional param' do
20
- client = Marvelite::API::Client.new(:public_key => '1234', :private_key => 'abcd', :api_version => 'v2')
21
- expect(client.api_version).to eq('v2')
20
+ client = Marvelite::API::Client.new(:public_key => '1234', :private_key => 'abcd', :api_version => 'v1')
21
+ expect(client.api_version).to eq('v1')
22
22
  end
23
23
 
24
24
  it 'defaults to v1' do
@@ -1,5 +1,30 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Marvelite::API::Router do
4
- it 'stores Marvel Comics API endpoints'
4
+ context 'initialization' do
5
+ it 'accepts an :api_version as param' do
6
+ router = Marvelite::API::Router.new(:api_version => 'v1')
7
+ expect(router.api_version).to eq('v1')
8
+ end
9
+
10
+ it ':api_version defaults to v1' do
11
+ router = Marvelite::API::Router.new
12
+ expect(router.api_version).to eq('v1')
13
+ end
14
+
15
+ it 'loads a YAML config file matching the :api_version attribute'
16
+
17
+ it 'calls #add_route for each route defined in YAML routes file'
18
+
19
+ it 'calls #map_routes'
20
+ end
21
+
22
+ describe '#add_route' do
23
+ it 'adds a new route to the routes variable'
24
+ end
25
+
26
+ describe '#map_routes' do
27
+ it 'adds all routes as methods to the router'
28
+ end
29
+
5
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marvelite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Antillon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-05 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -132,6 +132,8 @@ files:
132
132
  - lib/marvelite/api/character_methods.rb
133
133
  - lib/marvelite/api/client.rb
134
134
  - lib/marvelite/api/comic_methods.rb
135
+ - lib/marvelite/api/config/v1.yml
136
+ - lib/marvelite/api/event_methods.rb
135
137
  - lib/marvelite/api/response.rb
136
138
  - lib/marvelite/api/router.rb
137
139
  - lib/marvelite/version.rb
@@ -148,8 +150,16 @@ files:
148
150
  - spec/fixtures/comics/comic_events.json
149
151
  - spec/fixtures/comics/comic_stories.json
150
152
  - spec/fixtures/comics/comics.json
153
+ - spec/fixtures/events/event.json
154
+ - spec/fixtures/events/event_characters.json
155
+ - spec/fixtures/events/event_comics.json
156
+ - spec/fixtures/events/event_creators.json
157
+ - spec/fixtures/events/event_series.json
158
+ - spec/fixtures/events/event_stories.json
159
+ - spec/fixtures/events/events.json
151
160
  - spec/marvelite/api/client_characters_endpoints_spec.rb
152
161
  - spec/marvelite/api/client_comics_endpoints_spec.rb
162
+ - spec/marvelite/api/client_events_endpoints_spec.rb
153
163
  - spec/marvelite/api/client_spec.rb
154
164
  - spec/marvelite/api/router_spec.rb
155
165
  - spec/spec_helper.rb
@@ -195,8 +205,16 @@ test_files:
195
205
  - spec/fixtures/comics/comic_events.json
196
206
  - spec/fixtures/comics/comic_stories.json
197
207
  - spec/fixtures/comics/comics.json
208
+ - spec/fixtures/events/event.json
209
+ - spec/fixtures/events/event_characters.json
210
+ - spec/fixtures/events/event_comics.json
211
+ - spec/fixtures/events/event_creators.json
212
+ - spec/fixtures/events/event_series.json
213
+ - spec/fixtures/events/event_stories.json
214
+ - spec/fixtures/events/events.json
198
215
  - spec/marvelite/api/client_characters_endpoints_spec.rb
199
216
  - spec/marvelite/api/client_comics_endpoints_spec.rb
217
+ - spec/marvelite/api/client_events_endpoints_spec.rb
200
218
  - spec/marvelite/api/client_spec.rb
201
219
  - spec/marvelite/api/router_spec.rb
202
220
  - spec/spec_helper.rb