Class: OracleCloud::Shapes

Inherits:
Object
  • Object
show all
Defined in:
lib/oraclecloud/shapes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Shapes

Returns a new instance of Shapes.



22
23
24
# File 'lib/oraclecloud/shapes.rb', line 22

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



20
21
22
# File 'lib/oraclecloud/shapes.rb', line 20

def client
  @client
end

Instance Method Details

#allObject



26
27
28
29
30
# File 'lib/oraclecloud/shapes.rb', line 26

def all
  client.http_get(:single, '/shape/')['result'].each_with_object([]) do |shape, memo|
    memo << OracleCloud::Shape.new(shape)
  end
end

#exist?(shape_name) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/oraclecloud/shapes.rb', line 32

def exist?(shape_name)
  all.any? { |x| x.name == shape_name }
end