Class: Seahorse::Model::Shapes::Shape
- Inherits:
-
Object
- Object
- Seahorse::Model::Shapes::Shape
- Defined in:
- lib/seahorse/model/shapes.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
- #definition ⇒ Hash readonly
- #documentation ⇒ String? readonly
-
#location ⇒ String
readonly
Returns one of ‘body’, ‘uri’, ‘headers’, ‘status_code’.
-
#location_name ⇒ String?
readonly
Typically only set for shapes that are structure members.
- #name ⇒ String readonly
- #shape_map ⇒ ShapeMap readonly
-
#type ⇒ String
readonly
The type name for this shape.
Class Method Summary collapse
-
.new(definition = {}, options = {}) ⇒ Shape
Constructs and returns a new shape object.
Instance Method Summary collapse
-
#initialize(definition, options = {}) ⇒ Shape
constructor
A new instance of Shape.
- #inspect ⇒ String private
- #metadata(key) ⇒ Object?
- #with(options) ⇒ Object private
Constructor Details
#initialize(definition, options = {}) ⇒ Shape
Returns a new instance of Shape.
64 65 66 67 68 69 70 71 72 |
# File 'lib/seahorse/model/shapes.rb', line 64 def initialize(definition, = {}) definition['type'] ||= self.class.type @name = definition['shape'] @definition = definition @type = definition['type'] @location = definition['location'] || 'body' @location_name = definition['locationName'] @shape_map = [:shape_map] || ShapeMap.new end |
Class Attribute Details
Instance Attribute Details
#definition ⇒ Hash (readonly)
78 79 80 |
# File 'lib/seahorse/model/shapes.rb', line 78 def definition @definition end |
#documentation ⇒ String? (readonly)
97 98 99 |
# File 'lib/seahorse/model/shapes.rb', line 97 def documentation @documentation end |
#location ⇒ String (readonly)
Returns one of ‘body’, ‘uri’, ‘headers’, ‘status_code’
84 85 86 |
# File 'lib/seahorse/model/shapes.rb', line 84 def location @location end |
#location_name ⇒ String? (readonly)
Returns Typically only set for shapes that are structure members. Serialized names are typically set on the shape references, not on the shape definition.
89 90 91 |
# File 'lib/seahorse/model/shapes.rb', line 89 def location_name @location_name end |
#name ⇒ String (readonly)
75 76 77 |
# File 'lib/seahorse/model/shapes.rb', line 75 def name @name end |
#shape_map ⇒ ShapeMap (readonly)
94 95 96 |
# File 'lib/seahorse/model/shapes.rb', line 94 def shape_map @shape_map end |
#type ⇒ String (readonly)
Returns The type name for this shape.
81 82 83 |
# File 'lib/seahorse/model/shapes.rb', line 81 def type @type end |
Class Method Details
.new(definition = {}, options = {}) ⇒ Shape
Constructs and returns a new shape object. You must specify the shape type using the “type” option or you must construct the shape using the appropriate subclass of ‘Shape`.
170 171 172 173 174 175 176 |
# File 'lib/seahorse/model/shapes.rb', line 170 def new(definition = {}, = {}) if self == Shape from_type(definition, ) else super(apply_type(definition), ) end end |
Instance Method Details
#inspect ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
109 110 111 |
# File 'lib/seahorse/model/shapes.rb', line 109 def inspect "#<#{self.class.name}>" end |
#metadata(key) ⇒ Object?
103 104 105 |
# File 'lib/seahorse/model/shapes.rb', line 103 def (key) @definition[key.to_s] end |
#with(options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
114 115 116 |
# File 'lib/seahorse/model/shapes.rb', line 114 def with() self.class.new(@definition.merge(), shape_map: shape_map) end |