Class: Hawkular::Client
- Inherits:
-
Object
- Object
- Hawkular::Client
- Defined in:
- lib/hawkular/hawkular_client.rb
Instance Attribute Summary collapse
-
#alerts ⇒ Object
readonly
Returns the value of attribute alerts.
-
#inventory ⇒ Object
readonly
Returns the value of attribute inventory.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#operations(open_new = false) ⇒ Object
readonly
adds a way to explicitly open the new web socket connection (the default is to recycle it).
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Client
constructor
A new instance of Client.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Client
Returns a new instance of Client
12 13 14 15 16 17 |
# File 'lib/hawkular/hawkular_client.rb', line 12 def initialize(hash) hash[:credentials] ||= {} hash[:options] ||= {} fail 'no parameter ":entrypoint" given' if hash[:entrypoint].nil? @state = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hawkular/hawkular_client.rb', line 19 def method_missing(name, *args, &block) delegate_client = case name when /^inventory_/ then inventory when /^metrics_/ then metrics when /^alerts_/ then alerts when /^operations_/ then operations when /^tokens_/ then tokens else fail "unknown method prefix `#{name}`, allowed prefixes:"\ '`inventory_`, `metrics_`,`alerts_`,`operations_`, `tokens_`' end method = name.to_s.sub(/^[^_]+_/, '') delegate_client.__send__(method, *args, &block) end |
Instance Attribute Details
#alerts ⇒ Object (readonly)
Returns the value of attribute alerts
10 11 12 |
# File 'lib/hawkular/hawkular_client.rb', line 10 def alerts @alerts end |
#inventory ⇒ Object (readonly)
Returns the value of attribute inventory
10 11 12 |
# File 'lib/hawkular/hawkular_client.rb', line 10 def inventory @inventory end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics
10 11 12 |
# File 'lib/hawkular/hawkular_client.rb', line 10 def metrics @metrics end |
#operations(open_new = false) ⇒ Object (readonly)
adds a way to explicitly open the new web socket connection (the default is to recycle it)
54 55 56 |
# File 'lib/hawkular/hawkular_client.rb', line 54 def operations @operations end |
#state ⇒ Object (readonly)
Returns the value of attribute state
10 11 12 |
# File 'lib/hawkular/hawkular_client.rb', line 10 def state @state end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens
10 11 12 |
# File 'lib/hawkular/hawkular_client.rb', line 10 def tokens @tokens end |