Class: CapComputeEngine::Instance
- Inherits:
-
Object
- Object
- CapComputeEngine::Instance
- Defined in:
- lib/cap_compute_engine/instance.rb
Instance Method Summary collapse
- #external_ip ⇒ Object
- #has_tag?(tag_name) ⇒ Boolean
-
#initialize(hash) ⇒ Instance
constructor
A new instance of Instance.
- #tags ⇒ Object
Constructor Details
#initialize(hash) ⇒ Instance
Returns a new instance of Instance.
3 4 5 |
# File 'lib/cap_compute_engine/instance.rb', line 3 def initialize(hash) @hash = hash.with_indifferent_access end |
Instance Method Details
#external_ip ⇒ Object
11 12 13 |
# File 'lib/cap_compute_engine/instance.rb', line 11 def external_ip @hash[:networkInterfaces].first[:accessConfigs].first[:natIP] end |
#has_tag?(tag_name) ⇒ Boolean
15 16 17 |
# File 'lib/cap_compute_engine/instance.rb', line 15 def has_tag?(tag_name) .include?(tag_name) end |
#tags ⇒ Object
7 8 9 |
# File 'lib/cap_compute_engine/instance.rb', line 7 def @hash[:tags][:items] || [] end |