class Tvdbjson::Request

Constants

BASE_URI

Attributes

authentication[RW]
body[RW]
headers[RW]
url[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/tvdbjson/request.rb, line 7
def initialize(options = {})
  @url = "#{BASE_URI}#{options[:uri]}"
  @body = options[:body] unless !options[:body]
  @headers = {
    'Accept' => 'application/json'
  }.merge(options[:header])
end

Public Instance Methods

get() click to toggle source
# File lib/tvdbjson/request.rb, line 15
def get
  HTTParty.get(@url, :headers => @headers)
end
post() click to toggle source
# File lib/tvdbjson/request.rb, line 19
def post
  HTTParty.post(@url, :headers => @headers, :body => @body.to_json)
end