class Ticketmaster::Request

Attributes

client[RW]
method[RW]
params[RW]
path[RW]

Public Class Methods

new(path, params, client) click to toggle source
# File lib/ticketmaster/request.rb, line 11
def initialize(path, params, client)
  self.path   = path
  self.params = params
  self.client = client
end

Public Instance Methods

get() click to toggle source
# File lib/ticketmaster/request.rb, line 17
def get
  conn = Faraday.new(:url => 'https://app.ticketmaster.com')
  response = conn.get path, formatted_params
  JSON.parse(response.body)
end

Private Instance Methods

formatted_params() click to toggle source
# File lib/ticketmaster/request.rb, line 25
def formatted_params
  params.delete_if {|key, value| !PERMITTED_PARAMS.include? key }
  params[:apikey] ||= client.apikey
  params[:format]   = 'json'
  params
end