Class: Mushy::Get

Inherits:
Flux
  • Object
show all
Defined in:
lib/mushy/fluxs/get.rb

Instance Attribute Summary

Attributes inherited from Flux

#config, #id, #masher, #parent_fluxs, #subscribed_to, #type

Instance Method Summary collapse

Methods inherited from Flux

#convert_this_to_an_array, #convert_to_symbolized_hash, #execute, #execute_single_event, #group_these_results, #guard, inherited, #initialize, #join_these_results, #limit_these_results, #merge_these_results, #model_these_results, #outgoing_split_these_results, #shape_these, #sort_these_results, #standardize_these

Constructor Details

This class inherits a constructor from Mushy::Flux

Instance Method Details

#process(event, config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mushy/fluxs/get.rb', line 7

def process event, config

  faraday = Faraday.new do |connection|
    connection.adapter Faraday.default_adapter
  end

  headers = config[:headers] || {}
  data = {}
  url = config[:url]

  response = faraday.get config[:url], data, headers

  {
    status: response.status,
    url: url,
    reason_phrase: response.reason_phrase,
    headers: response.headers,
    body: response.body,
  }
end