class Diesel::RequestContext
Attributes
attributes[R]
endpoint[R]
group[R]
options[R]
Public Class Methods
new(options, group, endpoint, attributes)
click to toggle source
# File lib/diesel/request_context.rb, line 10 def initialize(options, group, endpoint, attributes) @options, @group, @endpoint, @attributes = options, group, endpoint, attributes end
Public Instance Methods
authenticator()
click to toggle source
# File lib/diesel/request_context.rb, line 32 def authenticator group.authenticator end
endpoint_url()
click to toggle source
# File lib/diesel/request_context.rb, line 36 def endpoint_url endpoint.url end
get_attribute(name)
click to toggle source
# File lib/diesel/request_context.rb, line 44 def get_attribute(name) name = name.to_sym unless attributes.has_key?(name) name = underscore(name).to_sym end attributes[name] end
logger()
click to toggle source
# File lib/diesel/request_context.rb, line 40 def logger group.logger end
perform()
click to toggle source
# File lib/diesel/request_context.rb, line 14 def perform if endpoint.url.base_host endpoint.url.subdomain = options[:subdomain] end env = { method: endpoint.request_method, url: endpoint.url, params: {}, request_headers: {}, logger: logger, context: self } endpoint.middleware_stack.call(env) perform_request(env) end
Protected Instance Methods
perform_request(env)
click to toggle source
# File lib/diesel/request_context.rb, line 53 def perform_request(env) HTTParty.send(env[:method], env[:url].to_s, headers: env[:request_headers], query: env[:params], body: env[:body]) end