Class: FHTTPClient::Service

Inherits:
FService::Base
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/f_http_client/service.rb

Overview

Allow defining keyword args for a class

Examples:

class User::Create < FHTTPClient::Service
  option :name
  option :age
  option :email, default: -> { '[email protected]' }

  def run
    Success(:created, data: "Hello #{name}! Your email is: #{email}")
  end
end

User.(name: 'Matheus', age: 22)
=> #<FService::Result::Success:0x0000557fae615ea8 @handled=false, @matching_types=[], @types=[:created], @value="Hello Bruno! Your email is: [email protected]">

Direct Known Subclasses

Base, Log, Processor::Exception, Processor::Response, Store