4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/tvdbjson/requestable.rb', line 4
def send_authenticated_request(hash, authentication)
options = {}
options[:uri] = build_uri(hash[:uri],hash[:params])
options[:body] = hash[:body]
options[:header] = { "Accept-Language" => "en", "Authorization" => "Bearer #{authentication.token}" }
request = Request.new(options)
response = if hash[:method] == "GET"
request.get
elsif hash[:method] == "POST"
request.post
end
if hash[:after_action]
eval(hash[:after_action])
else
response
end
end
|