Class: Uptrends::ProbeGroup
- Inherits:
-
Object
- Object
- Uptrends::ProbeGroup
- Defined in:
- lib/uptrends/probe_group.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#isall ⇒ Object
readonly
Returns the value of attribute isall.
-
#isclientprobegroup ⇒ Object
readonly
Returns the value of attribute isclientprobegroup.
-
#name ⇒ Object
Returns the value of attribute name.
-
#original_hash ⇒ Object
readonly
Returns the value of attribute original_hash.
-
#original_keys ⇒ Object
readonly
Returns the value of attribute original_keys.
Instance Method Summary collapse
- #gen_request_body ⇒ Object
-
#initialize(probe_group_hash = {}) ⇒ ProbeGroup
constructor
A new instance of ProbeGroup.
- #to_s ⇒ Object
Constructor Details
#initialize(probe_group_hash = {}) ⇒ ProbeGroup
Returns a new instance of ProbeGroup.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/uptrends/probe_group.rb', line 10 def initialize(probe_group_hash = {}) @original_hash = probe_group_hash @original_keys = probe_group_hash.keys @attributes = probe_group_hash.keys.map{|x| x.downcase.to_sym } @guid = probe_group_hash["Guid"] ? probe_group_hash["Guid"] : nil @name = probe_group_hash["Name"] @isall = probe_group_hash["IsAll"] @isclientprobegroup = probe_group_hash["IsClientProbeGroup"] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/uptrends/probe_group.rb', line 5 def attributes @attributes end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
7 8 9 |
# File 'lib/uptrends/probe_group.rb', line 7 def guid @guid end |
#isall ⇒ Object (readonly)
Returns the value of attribute isall.
7 8 9 |
# File 'lib/uptrends/probe_group.rb', line 7 def isall @isall end |
#isclientprobegroup ⇒ Object (readonly)
Returns the value of attribute isclientprobegroup.
7 8 9 |
# File 'lib/uptrends/probe_group.rb', line 7 def isclientprobegroup @isclientprobegroup end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/uptrends/probe_group.rb', line 8 def name @name end |
#original_hash ⇒ Object (readonly)
Returns the value of attribute original_hash.
5 6 7 |
# File 'lib/uptrends/probe_group.rb', line 5 def original_hash @original_hash end |
#original_keys ⇒ Object (readonly)
Returns the value of attribute original_keys.
5 6 7 |
# File 'lib/uptrends/probe_group.rb', line 5 def original_keys @original_keys end |
Instance Method Details
#gen_request_body ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/uptrends/probe_group.rb', line 21 def gen_request_body new_hash = original_keys.inject({}) do |memo,key| if key == 'Guid' memo else memo[key] = self.send(key.downcase.to_sym) memo end end request_body = JSON.dump(new_hash) end |
#to_s ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/uptrends/probe_group.rb', line 34 def to_s string = [] original_keys.each do |key| string << "#{key}: #{self.send(key.downcase.to_sym)}" end "#{string.join("\n")}" end |