Class: Rappfirst::Server
- Inherits:
-
Object
- Object
- Rappfirst::Server
- Includes:
- HTTParty
- Defined in:
- lib/rappfirst/server.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(id, api_options = nil) ⇒ Server
constructor
A new instance of Server.
- #outages(refresh = false) ⇒ Object
- #polled_data(refresh = false) ⇒ Object
- #polled_data=(new_polled_data_config) ⇒ Object
- #tags(refresh = false) ⇒ Object
- #writeable?(name) ⇒ Boolean
Constructor Details
#initialize(id, api_options = nil) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rappfirst/server.rb', line 12 def initialize(id, =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 end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/rappfirst/server.rb', line 6 def id @id end |
Instance Method Details
#delete ⇒ Object
50 51 52 |
# File 'lib/rappfirst/server.rb', line 50 def delete delete_self end |
#outages(refresh = false) ⇒ Object
42 43 44 |
# File 'lib/rappfirst/server.rb', line 42 def outages(refresh=false) refresh ? @outage_data = get_outage_data : @outage_data ||= get_outage_data end |
#polled_data(refresh = false) ⇒ Object
34 35 36 |
# File 'lib/rappfirst/server.rb', line 34 def polled_data(refresh=false) refresh ? @polled_data = get_polled_data : @polled_data ||= get_polled_data end |
#polled_data=(new_polled_data_config) ⇒ Object
38 39 40 |
# File 'lib/rappfirst/server.rb', line 38 def polled_data=(new_polled_data_config) #set_polled_data(new_polled_data_config) end |
#tags(refresh = false) ⇒ Object
46 47 48 |
# File 'lib/rappfirst/server.rb', line 46 def (refresh=false) refresh ? = : ||= end |
#writeable?(name) ⇒ Boolean
8 9 10 |
# File 'lib/rappfirst/server.rb', line 8 def writeable?(name) return ['description', 'nickname'].include?(name) end |