Module: DeviceCloud::Configuration
- Included in:
- DeviceCloud
- Defined in:
- lib/device_cloud/configuration.rb
Instance Attribute Summary collapse
-
#alert_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::AlertNotification objects Proc will be called with the alert notification object.
-
#data_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::DataNotification objects Proc will be called with the data notification object.
-
#empty_alert_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::AlertNotification objects that do not contain file data (data too large - over 120KB) Proc will be called with the alert notification object.
-
#empty_data_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::DataNotification objects that do not contain file data (data too large - over 120KB) Proc will be called with the data notification object.
-
#empty_event_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::EventNotification objects that do not contain file data (data too large - over 120KB) Proc will be called with the event notification object.
-
#event_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::EventNotification objects Proc will be called with the event notification object.
-
#logger ⇒ Object
DeviceCloud logger.
-
#password ⇒ Object
DeviceCloud password.
-
#username ⇒ Object
DeviceCloud username.
Instance Method Summary collapse
- #config ⇒ Object
-
#configure {|_self| ... } ⇒ Object
Yield self to be able to configure ActivityFeed with block-style configuration.
-
#host ⇒ Object
DeviceCloud url.
-
#root_url ⇒ Object
DeviceCloud url.
Instance Attribute Details
#alert_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::AlertNotification objects Proc will be called with the alert notification object
29 30 31 |
# File 'lib/device_cloud/configuration.rb', line 29 def alert_notification_handler @alert_notification_handler end |
#data_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::DataNotification objects Proc will be called with the data notification object
40 41 42 |
# File 'lib/device_cloud/configuration.rb', line 40 def data_notification_handler @data_notification_handler end |
#empty_alert_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::AlertNotification objects that do not contain file data (data too large - over 120KB) Proc will be called with the alert notification object
35 36 37 |
# File 'lib/device_cloud/configuration.rb', line 35 def empty_alert_notification_handler @empty_alert_notification_handler end |
#empty_data_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::DataNotification objects that do not contain file data (data too large - over 120KB) Proc will be called with the data notification object
46 47 48 |
# File 'lib/device_cloud/configuration.rb', line 46 def empty_data_notification_handler @empty_data_notification_handler end |
#empty_event_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::EventNotification objects that do not contain file data (data too large - over 120KB) Proc will be called with the event notification object
24 25 26 |
# File 'lib/device_cloud/configuration.rb', line 24 def empty_event_notification_handler @empty_event_notification_handler end |
#event_notification_handler ⇒ Object
Proc that will be called for handling DeviceCloud::PushNotification::EventNotification objects Proc will be called with the event notification object
18 19 20 |
# File 'lib/device_cloud/configuration.rb', line 18 def event_notification_handler @event_notification_handler end |
#logger ⇒ Object
DeviceCloud logger
110 111 112 |
# File 'lib/device_cloud/configuration.rb', line 110 def logger @logger ||= Logger.new(STDOUT) end |
#password ⇒ Object
DeviceCloud password
102 103 104 105 |
# File 'lib/device_cloud/configuration.rb', line 102 def password raise 'DeviceCloud password is blank' if @password.nil? || @password == '' @password end |
#username ⇒ Object
DeviceCloud username
94 95 96 97 |
# File 'lib/device_cloud/configuration.rb', line 94 def username raise 'DeviceCloud username is blank' if @username.nil? || @password == '' @username end |
Instance Method Details
#config ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/device_cloud/configuration.rb', line 61 def config { username: username, password: password, root_url: root_url, host: host, alert_notification_handler: @alert_notification_handler, empty_alert_notification_handler: @empty_alert_notification_handler, data_notification_handler: @data_notification_handler, empty_data_notification_handler: @empty_data_notification_handler, event_notification_handler: @event_notification_handler, empty_event_notification_handler: @empty_event_notification_handler, logger: logger }.freeze end |
#configure {|_self| ... } ⇒ Object
Yield self to be able to configure ActivityFeed with block-style configuration.
Example:
DeviceCloud.configure do |configuration|
configuration.root_url = 'https://example.com'
end
56 57 58 59 |
# File 'lib/device_cloud/configuration.rb', line 56 def configure yield self config end |
#host ⇒ Object
DeviceCloud url
87 88 89 |
# File 'lib/device_cloud/configuration.rb', line 87 def host 'my.idigi.com' end |
#root_url ⇒ Object
DeviceCloud url
80 81 82 |
# File 'lib/device_cloud/configuration.rb', line 80 def root_url 'https://my.idigi.com' end |