Class: Seahorse::ApiTranslator::Shape
- Inherits:
-
Object
- Object
- Seahorse::ApiTranslator::Shape
- Includes:
- Inflector
- Defined in:
- lib/seahorse/api_translator/shape.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(rules, options = {}) ⇒ Shape
constructor
A new instance of Shape.
- #rules ⇒ Object
- #xmlname ⇒ Object
Methods included from Inflector
Constructor Details
#initialize(rules, options = {}) ⇒ Shape
Returns a new instance of Shape.
24 25 26 27 28 29 30 31 32 |
# File 'lib/seahorse/api_translator/shape.rb', line 24 def initialize rules, = {} @options = @rules = {} @rules['name'] = ['name'] if .key?('name') set_type(rules.delete('type')) rules.each_pair do |method,arg| send("set_#{method}", *[arg]) end end |
Instance Method Details
#rules ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/seahorse/api_translator/shape.rb', line 34 def rules if @rules['type'] != 'blob' @rules elsif @rules['payload'] or @rules['streaming'] @rules.merge('type' => 'binary') else @rules.merge('type' => 'base64') end end |
#xmlname ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/seahorse/api_translator/shape.rb', line 44 def xmlname if @rules['flattened'] (@rules['members'] || {})['name'] || @xmlname else @xmlname end end |