Class: NodeHeartbeat::UploadIP
- Defined in:
- lib/node_heartbeat/upload_ip.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#ip ⇒ Object
Returns the value of attribute ip.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ip:, bucket:) ⇒ UploadIP
constructor
A new instance of UploadIP.
Methods inherited from Base
Constructor Details
#initialize(ip:, bucket:) ⇒ UploadIP
Returns a new instance of UploadIP.
8 9 10 11 |
# File 'lib/node_heartbeat/upload_ip.rb', line 8 def initialize(ip:, bucket:) self.ip = ip self.bucket = bucket end |
Instance Attribute Details
#bucket ⇒ Object
Returns the value of attribute bucket.
6 7 8 |
# File 'lib/node_heartbeat/upload_ip.rb', line 6 def bucket @bucket end |
#ip ⇒ Object
Returns the value of attribute ip.
6 7 8 |
# File 'lib/node_heartbeat/upload_ip.rb', line 6 def ip @ip end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/node_heartbeat/upload_ip.rb', line 13 def call puts "Uploading ip #{self.ip} to bucket #{self.bucket}" storage = Fog::Storage.new provider: 'AWS', use_iam_profile: true bucket = storage.directories.get(self.bucket) bucket.files.create( key: self.ip ) end |