Class: Dryer::Clients::GeneratedClients::Create

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_desc) ⇒ Create

Returns a new instance of Create.



7
8
9
# File 'lib/dryer/clients/generated_clients/create.rb', line 7

def initialize(api_desc)
  @api_desc = api_desc
end

Instance Attribute Details

#api_descObject (readonly)

Returns the value of attribute api_desc.



24
25
26
# File 'lib/dryer/clients/generated_clients/create.rb', line 24

def api_desc
  @api_desc
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dryer/clients/generated_clients/create.rb', line 11

def call
  api_desc.inject(Class.new(GeneratedClient)) do |client, resource|
    resource_object = Resources::Create.call(resource)
    client.send(
      :define_method,
      ApiDescriptions::Resources::GenerateName.call(resource)
    ) do
      resource_object.new(self.base_url)
    end
    client
  end
end