Class: ComicVine::Api

Inherits:
Object
  • Object
show all
Includes:
ApiMethods
Defined in:
lib/comic_vine/api.rb,
lib/comic_vine/api/request.rb,
lib/comic_vine/api/version.rb,
lib/comic_vine/api/response.rb,
lib/comic_vine/api/api_methods.rb,
lib/comic_vine/api/http_service.rb

Defined Under Namespace

Modules: ApiMethods, HTTPService Classes: Request, Response

Constant Summary collapse

DEFAULT_SERVER =
'https://comicvine.gamespot.com'.freeze
VERSION =
'0.1.1'.freeze

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ApiMethods

#initial_define_api_methods, #redefine_api_methods, #search, #types

Constructor Details

#initialize(api_key, options = {}) ⇒ Api

Returns a new instance of Api.



23
24
25
26
27
28
# File 'lib/comic_vine/api.rb', line 23

def initialize(api_key, options = {})
  @api_key = api_key
  @options = options

  initial_define_api_methods
end

Class Attribute Details

.http_serviceObject

Returns the value of attribute http_service.



14
15
16
# File 'lib/comic_vine/api.rb', line 14

def http_service
  @http_service
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



21
22
23
# File 'lib/comic_vine/api.rb', line 21

def api_key
  @api_key
end

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/comic_vine/api.rb', line 21

def options
  @options
end

Instance Method Details

#api_call(path, args, options = {}) ⇒ Object



30
31
32
33
34
35
# File 'lib/comic_vine/api.rb', line 30

def api_call(path, args, options = {})
  request = Request.new(
    path: path, args: args.merge(api_key: api_key), options: options
  )
  self.class.http_service.make_request(request)
end