Class: Dryer::Clients::Create

Inherits:
Services::SimpleService
  • Object
show all
Defined in:
lib/dryer/clients/create.rb

Instance Method Summary collapse

Constructor Details

#initialize(*api_desc) ⇒ Create

Returns a new instance of Create.



7
8
9
10
11
12
13
# File 'lib/dryer/clients/create.rb', line 7

def initialize(*api_desc)
  if api_desc.is_a?(Array) && api_desc[0].is_a?(Array)
    @api_desc = api_desc[0]
  else
    @api_desc = api_desc || []
  end
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
# File 'lib/dryer/clients/create.rb', line 15

def call
  validate_api_description.then do |errors|
    if errors.empty?
      GeneratedClients::Create.call(api_desc)
    else
      raise errors
    end
  end
end