Class: Excon::Addressable::Middleware

Inherits:
Middleware::Base
  • Object
show all
Defined in:
lib/excon/addressable.rb

Overview

Middleware

Parses a Templated URI string and merges it with the provided variables.

Instance Method Summary collapse

Instance Method Details

#request_call(datum) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/excon/addressable.rb', line 17

def request_call(datum)
  url = ::Addressable::URI.new(datum)

  if (template = ::Addressable::Template.new(url)) && template.variables.any?
    uri = template.expand(datum[:expand].to_h)
    datum.merge!(uri.to_hash)
  end

  super
end