marvel_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +96 -0
- data/LICENSE.txt +20 -0
- data/README.md +18 -0
- data/Rakefile +44 -0
- data/VERSION +1 -0
- data/lib/marvel.rb +21 -0
- data/lib/marvel/client.rb +260 -0
- data/lib/marvel/configuration.rb +16 -0
- data/marvel.gemspec +75 -0
- data/spec/marvel_spec.rb +9 -0
- data/spec/spec_helper.rb +16 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 801d0a15013b70d2e18b60096b3e36ad23c9e03b
|
4
|
+
data.tar.gz: 17e4e98b52d1c5becc864c5cdcdad8ded8e3c6b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24a7e773de7547de23c32c2e6184ba459a983103deb2875e9d1406cfa70479b07d822bd042815bc486d33b30037042ffd93da0ae215fb2e61f26da2cb4bc036e
|
7
|
+
data.tar.gz: 092a34d931bba733da902c8aaaade669cb7a1eee297eea1ff5215f3c616ac9f3f3d5c189e73898eae60443cb2bf09772012cd5b9009c2dd8d7f0687ac7b74827
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# To make HTTP requests
|
4
|
+
gem 'faraday'
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'pry'
|
8
|
+
gem 'rspec'
|
9
|
+
gem 'shoulda', '>= 0'
|
10
|
+
gem 'rdoc', '~> 3.12'
|
11
|
+
gem 'bundler', '~> 1.0'
|
12
|
+
gem 'jeweler', '~> 1.8.7'
|
13
|
+
gem 'simplecov'
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.0.2)
|
5
|
+
i18n (~> 0.6, >= 0.6.4)
|
6
|
+
minitest (~> 4.2)
|
7
|
+
multi_json (~> 1.3)
|
8
|
+
thread_safe (~> 0.1)
|
9
|
+
tzinfo (~> 0.3.37)
|
10
|
+
addressable (2.3.5)
|
11
|
+
atomic (1.1.14)
|
12
|
+
builder (3.2.2)
|
13
|
+
coderay (1.1.0)
|
14
|
+
diff-lcs (1.2.5)
|
15
|
+
docile (1.1.2)
|
16
|
+
faraday (0.8.9)
|
17
|
+
multipart-post (~> 1.2.0)
|
18
|
+
git (1.2.6)
|
19
|
+
github_api (0.10.1)
|
20
|
+
addressable
|
21
|
+
faraday (~> 0.8.1)
|
22
|
+
hashie (>= 1.2)
|
23
|
+
multi_json (~> 1.4)
|
24
|
+
nokogiri (~> 1.5.2)
|
25
|
+
oauth2
|
26
|
+
hashie (2.0.5)
|
27
|
+
highline (1.6.20)
|
28
|
+
i18n (0.6.9)
|
29
|
+
jeweler (1.8.8)
|
30
|
+
builder
|
31
|
+
bundler (~> 1.0)
|
32
|
+
git (>= 1.2.5)
|
33
|
+
github_api (= 0.10.1)
|
34
|
+
highline (>= 1.6.15)
|
35
|
+
nokogiri (= 1.5.10)
|
36
|
+
rake
|
37
|
+
rdoc
|
38
|
+
json (1.8.1)
|
39
|
+
jwt (0.1.11)
|
40
|
+
multi_json (>= 1.5)
|
41
|
+
method_source (0.8.2)
|
42
|
+
minitest (4.7.5)
|
43
|
+
multi_json (1.8.4)
|
44
|
+
multi_xml (0.5.5)
|
45
|
+
multipart-post (1.2.0)
|
46
|
+
nokogiri (1.5.10)
|
47
|
+
oauth2 (0.9.3)
|
48
|
+
faraday (>= 0.8, < 0.10)
|
49
|
+
jwt (~> 0.1.8)
|
50
|
+
multi_json (~> 1.3)
|
51
|
+
multi_xml (~> 0.5)
|
52
|
+
rack (~> 1.2)
|
53
|
+
pry (0.9.12.6)
|
54
|
+
coderay (~> 1.0)
|
55
|
+
method_source (~> 0.8)
|
56
|
+
slop (~> 3.4)
|
57
|
+
rack (1.5.2)
|
58
|
+
rake (10.1.1)
|
59
|
+
rdoc (3.12.2)
|
60
|
+
json (~> 1.4)
|
61
|
+
rspec (2.14.1)
|
62
|
+
rspec-core (~> 2.14.0)
|
63
|
+
rspec-expectations (~> 2.14.0)
|
64
|
+
rspec-mocks (~> 2.14.0)
|
65
|
+
rspec-core (2.14.7)
|
66
|
+
rspec-expectations (2.14.5)
|
67
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
68
|
+
rspec-mocks (2.14.5)
|
69
|
+
shoulda (3.5.0)
|
70
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
71
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
72
|
+
shoulda-context (1.1.6)
|
73
|
+
shoulda-matchers (2.5.0)
|
74
|
+
activesupport (>= 3.0.0)
|
75
|
+
simplecov (0.8.2)
|
76
|
+
docile (~> 1.1.0)
|
77
|
+
multi_json
|
78
|
+
simplecov-html (~> 0.8.0)
|
79
|
+
simplecov-html (0.8.0)
|
80
|
+
slop (3.4.7)
|
81
|
+
thread_safe (0.1.3)
|
82
|
+
atomic
|
83
|
+
tzinfo (0.3.38)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
bundler (~> 1.0)
|
90
|
+
faraday
|
91
|
+
jeweler (~> 1.8.7)
|
92
|
+
pry
|
93
|
+
rdoc (~> 3.12)
|
94
|
+
rspec
|
95
|
+
shoulda
|
96
|
+
simplecov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Rahul Horé
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Marvel
|
2
|
+
|
3
|
+
Ruby bindings for the [Marvel API](http://developer.marvel.com/).
|
4
|
+
|
5
|
+
## Contributing to marvel
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
## Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2014 Rahul Horé. See LICENSE.txt for
|
18
|
+
further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "marvel_api"
|
18
|
+
gem.homepage = "http://github.com/O-I/marvel"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Ruby bindings for the Marvel API}
|
21
|
+
gem.description = %Q{Marvel is a Ruby gem that lets you explore the Marvel Universe like never before.}
|
22
|
+
gem.email = "hore.rahul@gmail.com"
|
23
|
+
gem.authors = ["Rahul Horé"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
require 'rdoc/task'
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
+
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = "marvel #{version}"
|
42
|
+
rdoc.rdoc_files.include('README*')
|
43
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/marvel.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'marvel/client'
|
2
|
+
|
3
|
+
module Marvel
|
4
|
+
class << self
|
5
|
+
# Alias for Marvel::Client.new
|
6
|
+
# @return [Marvel::Client]
|
7
|
+
def new
|
8
|
+
@client ||= Marvel::Client.new
|
9
|
+
end
|
10
|
+
|
11
|
+
# Delegate to Marvel::Client
|
12
|
+
def method_missing(method, *args, &block)
|
13
|
+
return super unless new.respond_to?(method)
|
14
|
+
new.send(method, *args, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def respond_to?(method, include_private = false)
|
18
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'time'
|
3
|
+
require 'faraday'
|
4
|
+
require 'digest/md5'
|
5
|
+
require_relative 'configuration'
|
6
|
+
|
7
|
+
module Marvel
|
8
|
+
class Client
|
9
|
+
include Marvel::Configuration
|
10
|
+
|
11
|
+
BASE_URL = 'https://gateway.marvel.com/v1/public/'
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
reset
|
15
|
+
end
|
16
|
+
|
17
|
+
# Requests on the server side must be of the form
|
18
|
+
# http://gateway.marvel.com/v1/comics/?ts=1&apikey=1234&hash=ffd275c5130566a2916217b101f26150
|
19
|
+
# where ts is a timestamp
|
20
|
+
# where apikey is your public API key
|
21
|
+
# where hash is the MD5 hash of the concatenation of
|
22
|
+
# ts, your private API key, and your public API key
|
23
|
+
|
24
|
+
# TODO; MODULARIZE THIS!!!
|
25
|
+
# TODO; Refactor — tons of duplication
|
26
|
+
|
27
|
+
# Characters:
|
28
|
+
|
29
|
+
# fetches lists of characters
|
30
|
+
def get_characters
|
31
|
+
# v1/public/characters
|
32
|
+
end
|
33
|
+
|
34
|
+
# fetches a single character by id
|
35
|
+
def get_character(id)
|
36
|
+
# v1/public/characters/{characterId}
|
37
|
+
Faraday.get("#{BASE_URL}characters/#{id}#{auth}").body
|
38
|
+
end
|
39
|
+
|
40
|
+
# fetches lists of comics filtered by a character id
|
41
|
+
def get_comics_by_character_id(id)
|
42
|
+
# v1/public/characters/{characterId}/comics
|
43
|
+
Faraday.get("#{BASE_URL}characters/#{id}/comics#{auth}").body
|
44
|
+
end
|
45
|
+
|
46
|
+
# fetches lists of events filtered by a character id
|
47
|
+
def get_events_by_character_id(id)
|
48
|
+
# v1/public/characters/{characterId}/events
|
49
|
+
Faraday.get("#{BASE_URL}characters/#{id}/events#{auth}").body
|
50
|
+
end
|
51
|
+
|
52
|
+
# fetches lists of stories filtered by a character id
|
53
|
+
def get_stories_by_character_id(id)
|
54
|
+
# v1/public/characters/{characterId}/stories
|
55
|
+
Faraday.get("#{BASE_URL}characters/#{id}/stories#{auth}").body
|
56
|
+
end
|
57
|
+
|
58
|
+
# Comics:
|
59
|
+
|
60
|
+
# fetches lists of comics
|
61
|
+
def get_comics
|
62
|
+
# v1/public/comics
|
63
|
+
end
|
64
|
+
|
65
|
+
# fetches a single comic by id
|
66
|
+
def get_comic(id)
|
67
|
+
# v1/public/comics/{comicId}
|
68
|
+
Faraday.get("#{BASE_URL}comics/#{id}#{auth}").body
|
69
|
+
end
|
70
|
+
|
71
|
+
# fetches lists of characters filtered by a comic id
|
72
|
+
def get_characters_by_comic_id(id)
|
73
|
+
# v1/public/comics/{comicId}/characters
|
74
|
+
Faraday.get("#{BASE_URL}comics/#{id}/characters#{auth}").body
|
75
|
+
end
|
76
|
+
|
77
|
+
# fetches lists of creators filtered by a comic id
|
78
|
+
def get_creators_by_comic_id(id)
|
79
|
+
# v1/public/comics/{comicId}/creators
|
80
|
+
Faraday.get("#{BASE_URL}comics/#{id}/creators#{auth}").body
|
81
|
+
end
|
82
|
+
|
83
|
+
# fetches lists of events filtered by a comic id
|
84
|
+
def get_events_by_comic_id(id)
|
85
|
+
# v1/public/comics/{comicId}/events
|
86
|
+
Faraday.get("#{BASE_URL}comics/#{id}/events#{auth}").body
|
87
|
+
end
|
88
|
+
|
89
|
+
# fetches lists of stories filtered by a comic id
|
90
|
+
def get_stories_by_comic_id(id)
|
91
|
+
# v1/public/comics/{comicId}/stories
|
92
|
+
Faraday.get("#{BASE_URL}comics/#{id}/stories#{auth}").body
|
93
|
+
end
|
94
|
+
|
95
|
+
# Creators:
|
96
|
+
|
97
|
+
# fetches lists of creators
|
98
|
+
def get_creators
|
99
|
+
# v1/public/creators
|
100
|
+
end
|
101
|
+
|
102
|
+
# fetches a single creator by id
|
103
|
+
def get_creator(id)
|
104
|
+
# v1/public/creators/{creatorId}
|
105
|
+
Faraday.get("#{BASE_URL}creators/#{id}#{auth}").body
|
106
|
+
end
|
107
|
+
|
108
|
+
# fetches lists of comics filtered by a creator id
|
109
|
+
def get_comics_by_creator_id(id)
|
110
|
+
# v1/public/creators/{creatorId}/comics
|
111
|
+
Faraday.get("#{BASE_URL}creators/#{id}/comics#{auth}").body
|
112
|
+
end
|
113
|
+
|
114
|
+
# fetches lists of events filtered by a creator id
|
115
|
+
def get_events_by_creator_id(id)
|
116
|
+
# v1/public/creators/{creatorId}/events
|
117
|
+
Faraday.get("#{BASE_URL}creators/#{id}/events#{auth}").body
|
118
|
+
end
|
119
|
+
|
120
|
+
# fetches lists of stories filtered by a creator id
|
121
|
+
def get_stories_by_creator_id(id)
|
122
|
+
# v1/public/creators/{creatorId}/stories
|
123
|
+
Faraday.get("#{BASE_URL}creators/#{id}/stories#{auth}").body
|
124
|
+
end
|
125
|
+
|
126
|
+
# Events:
|
127
|
+
|
128
|
+
# fetches lists of events
|
129
|
+
def get_events
|
130
|
+
# v1/public/events
|
131
|
+
end
|
132
|
+
|
133
|
+
# fetches a single event by id
|
134
|
+
def get_event(id)
|
135
|
+
# v1/public/events/{eventId}
|
136
|
+
Faraday.get("#{BASE_URL}events/#{id}#{auth}").body
|
137
|
+
end
|
138
|
+
|
139
|
+
# fetches lists of characters filtered by an event id
|
140
|
+
def get_characters_by_event_id(id)
|
141
|
+
# v1/public/events/{eventId}/characters
|
142
|
+
Faraday.get("#{BASE_URL}events/#{id}/characters#{auth}").body
|
143
|
+
end
|
144
|
+
|
145
|
+
# fetches lists of comics filtered by an event id
|
146
|
+
def get_comics_by_event_id(id)
|
147
|
+
# v1/public/events/{eventId}/comics
|
148
|
+
Faraday.get("#{BASE_URL}events/#{id}/comics#{auth}").body
|
149
|
+
end
|
150
|
+
|
151
|
+
# fetches lists of creators filtered by an event id
|
152
|
+
def get_creators_by_event_id(id)
|
153
|
+
# v1/public/events/{eventId}/creators
|
154
|
+
Faraday.get("#{BASE_URL}events/#{id}/creators#{auth}").body
|
155
|
+
end
|
156
|
+
|
157
|
+
# fetches lists of stories filtered by an event id
|
158
|
+
def get_stories_by_event_id(id)
|
159
|
+
# v1/public/events/{eventId}/stories
|
160
|
+
Faraday.get("#{BASE_URL}events/#{id}/stories#{auth}").body
|
161
|
+
end
|
162
|
+
|
163
|
+
|
164
|
+
# Series:
|
165
|
+
|
166
|
+
# fetches lists of series
|
167
|
+
def get_series
|
168
|
+
# v1/public/series
|
169
|
+
end
|
170
|
+
|
171
|
+
# fetches a single comic series by id
|
172
|
+
def get_series_by_id(id)
|
173
|
+
# v1/public/series/{seriesId}
|
174
|
+
Faraday.get("#{BASE_URL}series/#{id}#{auth}").body
|
175
|
+
end
|
176
|
+
|
177
|
+
# fetches lists of characters filtered by a series id
|
178
|
+
def get_characters_by_series_id(id)
|
179
|
+
# v1/public/series/{seriesId}/characters
|
180
|
+
Faraday.get("#{BASE_URL}series/#{id}/characters#{auth}").body
|
181
|
+
end
|
182
|
+
|
183
|
+
# fetches lists of comics filtered by a series id
|
184
|
+
def get_comics_by_series_id(id)
|
185
|
+
# v1/public/series/{seriesId}/comics
|
186
|
+
Faraday.get("#{BASE_URL}series/#{id}/comics#{auth}").body
|
187
|
+
end
|
188
|
+
|
189
|
+
# fetches lists of creators filtered by a series id
|
190
|
+
def get_creators_by_series_id(id)
|
191
|
+
# v1/public/series/{seriesId}/creators
|
192
|
+
Faraday.get("#{BASE_URL}series/#{id}/creators#{auth}").body
|
193
|
+
end
|
194
|
+
|
195
|
+
# fetches lists of events filtered by a series id
|
196
|
+
def get_events_by_series_id(id)
|
197
|
+
# v1/public/series/{seriesId}/events
|
198
|
+
Faraday.get("#{BASE_URL}series/#{id}/events#{auth}").body
|
199
|
+
end
|
200
|
+
|
201
|
+
# fetches lists of stories filtered by a series id
|
202
|
+
def get_stories_by_series_id(id)
|
203
|
+
# v1/public/series/{seriesId}/stories
|
204
|
+
Faraday.get("#{BASE_URL}series/#{id}/stories#{auth}").body
|
205
|
+
end
|
206
|
+
|
207
|
+
# Stories:
|
208
|
+
|
209
|
+
# fetches lists of stories
|
210
|
+
def get_stories
|
211
|
+
# v1/public/stories
|
212
|
+
end
|
213
|
+
|
214
|
+
# fetches a single comic story by id
|
215
|
+
def get_story(id)
|
216
|
+
# v1/public/stories/{storyId}
|
217
|
+
Faraday.get("#{BASE_URL}stories/#{id}#{auth}").body
|
218
|
+
end
|
219
|
+
|
220
|
+
# fetches lists of characters filtered by a story id
|
221
|
+
def get_characters_by_story_id(id)
|
222
|
+
# v1/public/stories/{storyId}/characters
|
223
|
+
Faraday.get("#{BASE_URL}stories/#{id}/characters#{auth}").body
|
224
|
+
end
|
225
|
+
|
226
|
+
# fetches lists of comics filtered by a story id
|
227
|
+
def get_comics_by_story_id(id)
|
228
|
+
# v1/public/stories/{storyId}/comics
|
229
|
+
Faraday.get("#{BASE_URL}stories/#{id}/comics#{auth}").body
|
230
|
+
end
|
231
|
+
|
232
|
+
# fetches lists of creators filtered by a story id
|
233
|
+
def get_creators_by_story_id(id)
|
234
|
+
# v1/public/stories/{storyId}/creators
|
235
|
+
Faraday.get("#{BASE_URL}stories/#{id}/creators#{auth}").body
|
236
|
+
end
|
237
|
+
|
238
|
+
# fetches lists of events filtered by a story id
|
239
|
+
def get_events_by_story_id(id)
|
240
|
+
# v1/public/stories/{storyId}/events
|
241
|
+
Faraday.get("#{BASE_URL}stories/#{id}/events#{auth}").body
|
242
|
+
end
|
243
|
+
|
244
|
+
private
|
245
|
+
|
246
|
+
def auth
|
247
|
+
ts = timestamp
|
248
|
+
hsh = hash(ts)
|
249
|
+
"?ts=#{ts}&apikey=#{api_key}&hash=#{hsh}"
|
250
|
+
end
|
251
|
+
|
252
|
+
def hash(ts)
|
253
|
+
Digest::MD5.hexdigest(ts + private_key + api_key)
|
254
|
+
end
|
255
|
+
|
256
|
+
def timestamp
|
257
|
+
Time.now.to_s
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
data/marvel.gemspec
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: Marvel 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "Marvel"
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Rahul Hor\u{e9}"]
|
13
|
+
s.date = "2014-02-05"
|
14
|
+
s.description = "Marvel is a Ruby gem that lets you explore the Marvel Universe like never before."
|
15
|
+
s.email = "hore.rahul@gmail.com"
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/marvel.rb",
|
30
|
+
"lib/marvel/client.rb",
|
31
|
+
"lib/marvel/configuration.rb",
|
32
|
+
"marvel.gemspec",
|
33
|
+
"spec/marvel_spec.rb",
|
34
|
+
"spec/spec_helper.rb"
|
35
|
+
]
|
36
|
+
s.homepage = "http://github.com/O-I/marvel"
|
37
|
+
s.licenses = ["MIT"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = "2.1.9"
|
40
|
+
s.summary = "Ruby bindings for the Marvel API"
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 4
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<faraday>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
51
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
52
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
|
53
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<faraday>, [">= 0"])
|
56
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
57
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
58
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
|
62
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<faraday>, [">= 0"])
|
66
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
67
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
68
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
|
72
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
data/spec/marvel_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'marvel'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
Marvel.configure do |config|
|
15
|
+
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: marvel_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rahul Horé
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: shoulda
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdoc
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.12'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.12'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: jeweler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.8.7
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.8.7
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Marvel is a Ruby gem that lets you explore the Marvel Universe like never
|
126
|
+
before.
|
127
|
+
email: hore.rahul@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files:
|
131
|
+
- LICENSE.txt
|
132
|
+
- README.md
|
133
|
+
files:
|
134
|
+
- .document
|
135
|
+
- .rspec
|
136
|
+
- Gemfile
|
137
|
+
- Gemfile.lock
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- VERSION
|
142
|
+
- lib/marvel.rb
|
143
|
+
- lib/marvel/client.rb
|
144
|
+
- lib/marvel/configuration.rb
|
145
|
+
- marvel.gemspec
|
146
|
+
- spec/marvel_spec.rb
|
147
|
+
- spec/spec_helper.rb
|
148
|
+
homepage: http://github.com/O-I/marvel
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.1.9
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: Ruby bindings for the Marvel API
|
172
|
+
test_files: []
|