Class: Serverspec::Type::ApiBase
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::ApiBase
show all
- Defined in:
- lib/serverspec_extra_types/types/api_base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(name = nil, options = {}) ⇒ ApiBase
Returns a new instance of ApiBase.
10
11
12
13
14
|
# File 'lib/serverspec_extra_types/types/api_base.rb', line 10
def initialize(name = nil, options = {})
super(name, options)
@insecure = options[:insecure]
@redirects = options[:follow_redirects]
end
|
Instance Method Details
#[](key) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/serverspec_extra_types/types/api_base.rb', line 16
def [](key)
value = inspection
key.split('.').each do |k|
is_index = k.start_with?('[') && k.end_with?(']')
value = value[is_index ? k[1..-2].to_i : k]
end
value
end
|
#inspection ⇒ Object
29
30
31
|
# File 'lib/serverspec_extra_types/types/api_base.rb', line 29
def inspection
@inspection ||= ::MultiJson.load(get_inspection.stdout)
end
|
#url ⇒ Object
25
26
27
|
# File 'lib/serverspec_extra_types/types/api_base.rb', line 25
def url
@url_base
end
|