Module: Cts::Mpx::Services::Ingest
- Defined in:
- lib/cts/mpx/services/ingest.rb
Overview
Collection of methods to interact with the ingest services
Class Method Summary collapse
-
.[](key = nil) ⇒ Service[], Service
Addressable method, indexed by ingest service title.
-
.post(user: nil, account: nil, service: nil, endpoint: nil, headers: {}, payload: nil, extra_path: nil) ⇒ Response
Procedural method to interact with an ingest service via POST.
-
.services ⇒ Services[]
Ingest service list.
Class Method Details
.[](key = nil) ⇒ Service[], Service
Addressable method, indexed by ingest service title
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cts/mpx/services/ingest.rb', line 14 def [](key = nil) return services unless key Driver::Exceptions.raise_unless_argument_error?(key, String) service = services.find { |e| e.name == key } Driver::Exceptions.raise_unless_argument_error?(service, Driver::Service) service end |
.post(user: nil, account: nil, service: nil, endpoint: nil, headers: {}, payload: nil, extra_path: nil) ⇒ Response
Procedural method to interact with an ingest service via POST
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cts/mpx/services/ingest.rb', line 45 def post(user: nil, account: nil, service: nil, endpoint: nil, headers: {}, payload: nil, extra_path: nil) Driver::Helpers.required_arguments ['user', 'service', 'endpoint'], binding Driver::Helpers.raise_if_not_a_hash [headers] user.token! Registry.fetch_and_store_domain(user, account) unless self[service].url? host = Driver::Assemblers.host user: user, service: service path = Driver::Assemblers.path service: service, endpoint: endpoint, extra_path: extra_path request = Driver::Request.create(method: :post, url: [host, path].join, payload: payload, headers: headers) request.call end |