module TmdbRexx::Request

Public Instance Methods

delete(path, options = {}) click to toggle source
# File lib/tmdb_rexx/request.rb, line 15
def delete(path, options = {})
  request(:delete, path, options)
end
get(path, options = {}) click to toggle source
# File lib/tmdb_rexx/request.rb, line 3
def get(path, options = {})
  request(:get, path, options)
end
last_response() click to toggle source
# File lib/tmdb_rexx/request.rb, line 19
def last_response
  @last_response if defined? @last_response
end
post(path, options = {}) click to toggle source
# File lib/tmdb_rexx/request.rb, line 7
def post(path, options = {})
  request(:post, path, options)
end
put(path, options = {}) click to toggle source
# File lib/tmdb_rexx/request.rb, line 11
def put(path, options = {})
  request(:put, path, options)
end

Private Instance Methods

request(method, path, options = {}) click to toggle source
# File lib/tmdb_rexx/request.rb, line 24
def request(method, path, options = {})
  url = options.delete(:api_endpoint) || api_endpoint

  connection_options = {
    :url => url
  }

  @last_response = response = connection(connection_options).send(method) do |request|
    request.url(path, options)
    request.params['api_key'] = @api_key
  end

  response.body
end