Class: Composable::Client::Base

Inherits:
Object
  • Object
show all
Includes:
Callbacks, HTTPVerbMethods, Core::AttributeDSL
Defined in:
lib/composable/client/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.inherited(subclass) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/composable/client/base.rb', line 11

def inherited(subclass)
  super
  subclass.prepend(Core::Command)
  subclass.attribute :endpoint, type: :string, default: -> { raise "endpoint is required" }
  subclass.attribute :payload, default: {}
  subclass.attribute :headers, default: {}
  subclass.attribute :basic_auth, default: {}
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
# File 'lib/composable/client/base.rb', line 21

def call
  return unless valid?

  run_callbacks :request do
    request
  end
end