Class: ComicVine::Api::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/comic_vine/api/request.rb

Constant Summary collapse

GET =
'get'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, args: {}, options: {}) ⇒ Request

Returns a new instance of Request.



8
9
10
11
12
# File 'lib/comic_vine/api/request.rb', line 8

def initialize(path:, args: {}, options: {})
  @raw_path = path
  @raw_args = args
  @raw_options = options
end

Instance Attribute Details

#raw_argsObject (readonly)

Returns the value of attribute raw_args.



4
5
6
# File 'lib/comic_vine/api/request.rb', line 4

def raw_args
  @raw_args
end

#raw_optionsObject (readonly)

Returns the value of attribute raw_options.



4
5
6
# File 'lib/comic_vine/api/request.rb', line 4

def raw_options
  @raw_options
end

#raw_pathObject (readonly)

Returns the value of attribute raw_path.



4
5
6
# File 'lib/comic_vine/api/request.rb', line 4

def raw_path
  @raw_path
end

Instance Method Details

#argsObject



22
23
24
25
26
# File 'lib/comic_vine/api/request.rb', line 22

def args
  {
    format: :json
  }.merge(raw_args)
end

#optionsObject



28
29
30
# File 'lib/comic_vine/api/request.rb', line 28

def options
  raw_options
end

#pathObject



18
19
20
# File 'lib/comic_vine/api/request.rb', line 18

def path
  "/api/#{raw_path}/"
end

#serverObject



32
33
34
# File 'lib/comic_vine/api/request.rb', line 32

def server
  ComicVine::Api::DEFAULT_SERVER
end

#verbObject



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

def verb
  GET
end