Class: Attached::Storage::Google
- Defined in:
- lib/attached/storage/google.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
Attributes inherited from Fog
Instance Method Summary collapse
-
#host ⇒ Object
Access the host (e.g. attached.commondatastorage.googleapis.com/) for a storage service.
-
#initialize(credentials) ⇒ Google
constructor
Create a new interface supporting save and destroy operations.
Methods inherited from Fog
Methods inherited from Base
#destroy, #options, #parse, #retrieve, #save
Constructor Details
#initialize(credentials) ⇒ Google
17 18 19 20 21 22 23 24 25 |
# File 'lib/attached/storage/google.rb', line 17 def initialize(credentials) super credentials = parse(credentials) @bucket = credentials[:bucket] || credentials['bucket'] @access_key_id = credentials[:access_key_id] || credentials['access_key_id'] @secret_access_key = credentials[:secret_access_key] || credentials['secret_access_key'] raise "'bucket' must be specified if using 'google' for storage" unless @bucket end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
8 9 10 |
# File 'lib/attached/storage/google.rb', line 8 def access_key_id @access_key_id end |
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
7 8 9 |
# File 'lib/attached/storage/google.rb', line 7 def bucket @bucket end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
9 10 11 |
# File 'lib/attached/storage/google.rb', line 9 def secret_access_key @secret_access_key end |
Instance Method Details
#host ⇒ Object
Access the host (e.g. attached.commondatastorage.googleapis.com/) for a storage service.
Usage:
storage.host
32 33 34 |
# File 'lib/attached/storage/google.rb', line 32 def host() "https://#{self.bucket}.commondatastorage.googleapis.com/" end |