Class: DistritoTracking::Client
- Inherits:
-
Object
- Object
- DistritoTracking::Client
- Defined in:
- lib/distrito_tracking/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #publish(data) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 |
# File 'lib/distrito_tracking/client.rb', line 10 def initialize @client = Aws::SNS::Client.new( region: configuration.region, access_key_id: configuration.access_key_id, secret_access_key: configuration.secret_access_key ) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/distrito_tracking/client.rb', line 8 def client @client end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
8 9 10 |
# File 'lib/distrito_tracking/client.rb', line 8 def configuration @configuration end |
Instance Method Details
#inspect ⇒ Object
31 32 33 |
# File 'lib/distrito_tracking/client.rb', line 31 def inspect "#<DistritoTracking::Client>" end |
#publish(data) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/distrito_tracking/client.rb', line 18 def publish(data) return false if data.empty? client.publish({ topic_arn: configuration.topic_arn, message: JSON.generate(data) }) end |