Class: Seahorse::ApiTranslator::Operation

Inherits:
Object
  • Object
show all
Includes:
Inflector
Defined in:
lib/seahorse/api_translator/operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inflector

#inflect

Constructor Details

#initialize(rules, options = {}) ⇒ Operation

Returns a new instance of Operation.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/seahorse/api_translator/operation.rb', line 25

def initialize rules, options = {}
  @options = options

  @method_name = rules['name'].sub(/\d{4}_\d{2}_\d{2}$/, '')
  @method_name = inflect(@method_name, @options[:inflect_method_names])

  @rules = rules

  if @rules['http']
    @rules['http'].delete('response_code')
  end

  translate_input
  translate_output

  if @options[:documentation]
    @rules['errors'] = @rules['errors'].map {|e| e['shape_name'] }
  else
    @rules.delete('errors')
    @rules.delete('documentation')
    @rules.delete('documentation_url')
    @rules.delete('response_code')
  end
end

Instance Attribute Details

#method_nameString (readonly)

Returns:

  • (String)


51
52
53
# File 'lib/seahorse/api_translator/operation.rb', line 51

def method_name
  @method_name
end

#rulesHash (readonly)

Returns:

  • (Hash)


54
55
56
# File 'lib/seahorse/api_translator/operation.rb', line 54

def rules
  @rules
end