Class: Authograph::Adapters::Faraday

Inherits:
Base
  • Object
show all
Defined in:
lib/authograph/adapters/faraday.rb

Instance Method Summary collapse

Constructor Details

#initialize(_request) ⇒ Faraday

Returns a new instance of Faraday.



3
4
5
# File 'lib/authograph/adapters/faraday.rb', line 3

def initialize(_request)
  @request = _request
end

Instance Method Details

#bodyObject



29
30
31
# File 'lib/authograph/adapters/faraday.rb', line 29

def body
  @request.body
end

#content_typeObject



25
26
27
# File 'lib/authograph/adapters/faraday.rb', line 25

def content_type
  @request.headers['Content-Type'] || 'application/x-www-form-urlencoded'
end

#get_header(_header) ⇒ Object



7
8
9
# File 'lib/authograph/adapters/faraday.rb', line 7

def get_header(_header)
  @request.headers[_header]
end

#methodObject



15
16
17
# File 'lib/authograph/adapters/faraday.rb', line 15

def method
  @request.http_method.to_s.upcase
end

#pathObject



19
20
21
22
23
# File 'lib/authograph/adapters/faraday.rb', line 19

def path
  uri = URI(@request.path)
  uri.query = ::Faraday::Utils.build_query(@request.params) unless @request.params.empty?
  uri.request_uri
end

#set_header(_header, _value) ⇒ Object



11
12
13
# File 'lib/authograph/adapters/faraday.rb', line 11

def set_header(_header, _value)
  @request.headers[_header] = _value
end