class Marvel::Api
Constants
- DEFAULT_SERVER
- VERSION
Attributes
http_service[RW]
options[R]
private_key[R]
public_key[R]
Public Class Methods
new(public_key, private_key, options = {})
click to toggle source
# File lib/marvel/api.rb, line 21 def initialize(public_key, private_key, options = {}) @public_key = public_key @private_key = private_key @options = options end
Public Instance Methods
api_call(path, args, options = {})
click to toggle source
# File lib/marvel/api.rb, line 27 def api_call(path, args, options = {}) request = Request.new( path: path, args: args.merge(apikey: public_key, ts: ts, hash: request_hash), options: options ) self.class.http_service.make_request(request) end
comics(args = {})
click to toggle source
# File lib/marvel/api.rb, line 36 def comics(args = {}) api_call('comics', args) end
Private Instance Methods
request_hash()
click to toggle source
# File lib/marvel/api.rb, line 46 def request_hash Digest::MD5.hexdigest("#{ts}#{private_key}#{public_key}") end
ts()
click to toggle source
# File lib/marvel/api.rb, line 42 def ts Time.now.utc.to_i end