marvelite 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -4
- data/lib/marvelite/api/client.rb +20 -0
- data/lib/marvelite/api/router.rb +4 -0
- data/lib/marvelite/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78f3523b35c99204782fcc7de772ecb0d3118ee7
|
4
|
+
data.tar.gz: 5aa161a8dd19701b436ab98d1a20f4fd600487e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddba4b3509793d06748f2a46dc48b896cfd41c2bfaa7e94e8e754050fa9f7a8a57b584b3169faafc7bc295b21f45060a0244291a619d99e138c004d3ae3f2bb3
|
7
|
+
data.tar.gz: 12bfc57f6b8ba408aad7b18b10f364ef415f6294e81f9b973561ad541a738cf12f65a68207a0d524c46ec209fc66f96d0d18588ae0371087c3ba284469fb9771
|
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
Simple wrapper to communicate with the Marvel Comics API.
|
4
4
|
|
5
|
+
|
6
|
+
> **Important:** This is a work in progress. There's only two endpoints to connect to. I am working into incorporating all of Marvel Comics API endpoints.
|
7
|
+
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
@@ -39,7 +42,10 @@ client = Marvelite::API::Client.new(:public_key => 'abcd1234', :private_key => '
|
|
39
42
|
| ------ | ----------- |
|
40
43
|
| [#characters](#characters) | Fetches a list of comic characters. |
|
41
44
|
| [#character](#character) | Fetches a single character resource. |
|
42
|
-
|
45
|
+
| [#character_comics](#character_comics) | Fetches a list of comics containing a specific character. |
|
46
|
+
| [#character_events](#character_events) | Fetches a list of events in which a specific character appears. |
|
47
|
+
| [#character_series](#character_series) | Fetches a list of comic series in which a specific character appears. |
|
48
|
+
| [#character_stories](#character_stories) | Fetches a list of comic stories featuring a specific character. |
|
43
49
|
|
44
50
|
#### characters
|
45
51
|
Fetches a list of comic characters. Can receive optional params.
|
@@ -54,13 +60,68 @@ See the [Marvel Comics Interactive API Tester](http://developer.marvel.com/docs#
|
|
54
60
|
|
55
61
|
#### character
|
56
62
|
|
57
|
-
Fetches a single character resource. Accepts an integer or string value.
|
63
|
+
Fetches a single character resource. Accepts an integer or string value as character id.
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
client.character(1009610)
|
67
|
+
client.character('Spider-Man')
|
68
|
+
```
|
69
|
+
|
70
|
+
#### character_comics
|
71
|
+
|
72
|
+
Fetches a list of comics containing a specific character. Requires a character id value (integer). Accepts optional params.
|
58
73
|
|
59
74
|
```ruby
|
60
|
-
client.
|
61
|
-
client.
|
75
|
+
client.character_comics(1009610)
|
76
|
+
client.character_comics(
|
77
|
+
1009610,
|
78
|
+
{ :format => 'graphic novel', :limit => 10, :orderBy => 'title' }
|
79
|
+
)
|
62
80
|
```
|
63
81
|
|
82
|
+
See the [Marvel Comics Interactive API Tester](http://developer.marvel.com/docs#!/public/getComicsCharacterCollection_get_2) for a complete list of params that you can pass to the `#character_comics` method.
|
83
|
+
|
84
|
+
#### character_events
|
85
|
+
|
86
|
+
Fetches a list of events in which a specific character appears. Requires a character id value (integer). Accepts optional params.
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
client.character_events(1009610)
|
90
|
+
client.character_events(
|
91
|
+
1009610,
|
92
|
+
{ :limit => 10, :orderBy => 'name' }
|
93
|
+
)
|
94
|
+
```
|
95
|
+
|
96
|
+
See the [Marvel Comics Interactive API Tester](http://developer.marvel.com/docs#!/public/getCharacterEventsCollection_get_3) for a complete list of params that you can pass to the `#character_events` method.
|
97
|
+
|
98
|
+
|
99
|
+
#### character_series
|
100
|
+
|
101
|
+
Fetches a list of comic series in which a specific character appears. Requires a character id value (integer). Accepts optional params.
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
client.character_series(1009610)
|
105
|
+
client.character_series(
|
106
|
+
1009610,
|
107
|
+
{ :seriesType => 'ongoing', :limit => 10, :orderBy => 'title' }
|
108
|
+
)
|
109
|
+
```
|
110
|
+
|
111
|
+
See the [Marvel Comics Interactive API Tester](http://developer.marvel.com/docs#!/public/getCharacterSeriesCollection_get_4) for a complete list of params that you can pass to the `#character_series` method.
|
112
|
+
|
113
|
+
|
114
|
+
#### character_stories
|
115
|
+
|
116
|
+
Fetches a list of comic stories featuring a specific character. Requires a character id value (integer). Accepts optional params.
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
client.character_stories(1009610)
|
120
|
+
client.character_stories(1009610, { :limit => 10, :offset => 20 })
|
121
|
+
```
|
122
|
+
|
123
|
+
See the [Marvel Comics Interactive API Tester](http://developer.marvel.com/docs#!/public/getCharacterStoryCollection_get_5) for a complete list of params that you can pass to the `#character_stories` method.
|
124
|
+
|
64
125
|
## Responses
|
65
126
|
|
66
127
|
All requests to the API, return a `Marvelite::API::Response` object, that is nothing more than the raw API response enhanced with Hashie methods.
|
data/lib/marvelite/api/client.rb
CHANGED
@@ -32,6 +32,26 @@ module Marvelite
|
|
32
32
|
Response.new(response)
|
33
33
|
end
|
34
34
|
|
35
|
+
def character_comics(id, query_params = {})
|
36
|
+
response = self.class.get("/#{api_version}/#{router.character_comics_path(id)}", :query => params(query_params))
|
37
|
+
Response.new(response)
|
38
|
+
end
|
39
|
+
|
40
|
+
def character_events(id, query_params = {})
|
41
|
+
response = self.class.get("/#{api_version}/#{router.character_events_path(id)}", :query => params(query_params))
|
42
|
+
Response.new(response)
|
43
|
+
end
|
44
|
+
|
45
|
+
def character_series(id, query_params = {})
|
46
|
+
response = self.class.get("/#{api_version}/#{router.character_series_path(id)}", :query => params(query_params))
|
47
|
+
Response.new(response)
|
48
|
+
end
|
49
|
+
|
50
|
+
def character_stories(id, query_params = {})
|
51
|
+
response = self.class.get("/#{api_version}/#{router.character_stories_path(id)}", :query => params(query_params))
|
52
|
+
Response.new(response)
|
53
|
+
end
|
54
|
+
|
35
55
|
private
|
36
56
|
def params(additional_params = {})
|
37
57
|
base_hash = { :apikey => public_key, :ts => ts, :hash => request_hash }
|
data/lib/marvelite/api/router.rb
CHANGED
data/lib/marvelite/version.rb
CHANGED