Class: Locomotive::Steam::ExternalAPIService

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/locomotive/steam/services/external_api_service.rb

Instance Method Summary collapse

Instance Method Details

#consume(url, options = {}, with_status = false) ⇒ Object

Available option keys:

  • method

  • data

  • format

  • username / password (basic auth)

  • headers

  • header_auth

  • with_user_agent



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/locomotive/steam/services/external_api_service.rb', line 24

def consume(url, options = {}, with_status = false)
  base_uri, path = extract_base_uri_and_path(url)

  method = (options[:method] || 'GET').to_s.downcase

  _options = build_httpparty_options(options, method)
  _options[:base_uri] = base_uri

  if with_status
    verbose_perform_request_to(method, path, _options)
  else
    perform_request_to(method, path, _options)
  end
end