Class: Rappfirst::Alert
- Inherits:
-
Object
- Object
- Rappfirst::Alert
- Includes:
- HTTParty
- Defined in:
- lib/rappfirst/alert.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(id, api_options = nil, json_data = nil) ⇒ Alert
constructor
A new instance of Alert.
- #sync ⇒ Object
- #writeable?(name) ⇒ Boolean
- #writeable_attributes ⇒ Object
Constructor Details
#initialize(id, api_options = nil, json_data = nil) ⇒ Alert
Returns a new instance of Alert.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rappfirst/alert.rb', line 20 def initialize(id, =nil, json_data=nil) if && .keys.include?(:basic_auth) username = [:basic_auth][:username] api_key = [:basic_auth][:password] else username = get_config('username') api_key = get_config('password') end if && .keys.include?(:basic_uri) base_uri = [:base_uri] else base_uri = 'https://wwws.appfirst.com/api' end self.class.basic_auth username, api_key self.class.base_uri base_uri self.id = id set_attributes(json_data=json_data) end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/rappfirst/alert.rb', line 9 def id @id end |
Instance Method Details
#delete ⇒ Object
42 43 44 |
# File 'lib/rappfirst/alert.rb', line 42 def delete delete_self end |
#sync ⇒ Object
46 47 48 |
# File 'lib/rappfirst/alert.rb', line 46 def sync sync_self end |
#writeable?(name) ⇒ Boolean
16 17 18 |
# File 'lib/rappfirst/alert.rb', line 16 def writeable?(name) return writeable_attributes.include?(name) end |
#writeable_attributes ⇒ Object
11 12 13 14 |
# File 'lib/rappfirst/alert.rb', line 11 def writeable_attributes # Strip out attributes that are hard to serialize for now, because their API is weird ['name', 'active', 'direction', 'interval', 'time_above_threshold', 'threshold'] end |