marvelite 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79f53a7757f023b10894b8e6ed848fb12391cd92
4
- data.tar.gz: b040915a1836fc80ab2264f1e0a7d382e4b83285
3
+ metadata.gz: 78f3523b35c99204782fcc7de772ecb0d3118ee7
4
+ data.tar.gz: 5aa161a8dd19701b436ab98d1a20f4fd600487e0
5
5
  SHA512:
6
- metadata.gz: 3ad69674271a377ca1e63f9cd4ccba4f8dfcbad3c3c354a2487392cf2841fc2bce905f0c90b66a0250e2014cec5fcf42908c2dda2d537b2bdcb7db58855dc2a4
7
- data.tar.gz: 78a1f01d3a93eb825cd0977e193f063883b94d2201878dae979c9e905fae3ac5eba577b54719ddbd5705b5d26a19cd3004c2256d124518ff10f81ea6d40c5a53
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.character(1009368)
61
- client.character('Iron Man')
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.
@@ -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 }
@@ -17,6 +17,10 @@ module Marvelite
17
17
  "public/characters/#{id}/events"
18
18
  end
19
19
 
20
+ def character_series_path(id)
21
+ "public/characters/#{id}/series"
22
+ end
23
+
20
24
  def character_stories_path(id)
21
25
  "public/characters/#{id}/stories"
22
26
  end
@@ -1,3 +1,3 @@
1
1
  module Marvelite
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marvelite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Antillon