Class: Songkick::Transport::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/songkick/transport/base.rb

Direct Known Subclasses

Curb, HttParty::Adapter, RackTest

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#user_agentObject

Returns the value of attribute user_agent.



5
6
7
# File 'lib/songkick/transport/base.rb', line 5

def user_agent
  @user_agent
end

#user_error_codesObject

Returns the value of attribute user_error_codes.



5
6
7
# File 'lib/songkick/transport/base.rb', line 5

def user_error_codes
  @user_error_codes
end

Instance Method Details

#do_verb(verb, path, params = {}, head = {}, timeout = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/songkick/transport/base.rb', line 15

def do_verb(verb, path, params = {}, head = {}, timeout = nil)
  req = Request.new(endpoint, verb, path, params, headers.merge(head), timeout)
  Reporting.log_request(req)

  begin
    req.response = execute_request(req)
  rescue => error
    req.error = error
    Reporting.record(req)
    raise error
  end

  Reporting.log_response(req)
  Reporting.record(req)
  req.response
end

#with_headers(headers = {}) ⇒ Object



32
33
34
# File 'lib/songkick/transport/base.rb', line 32

def with_headers(headers = {})
  HeaderDecorator.new(self, headers)
end

#with_timeout(timeout = DEFAULT_TIMEOUT) ⇒ Object



36
37
38
# File 'lib/songkick/transport/base.rb', line 36

def with_timeout(timeout = DEFAULT_TIMEOUT)
  TimeoutDecorator.new(self, timeout)
end