Class: Backup::Connection::Everbox

Inherits:
Object
  • Object
show all
Defined in:
lib/backup/connection/everbox.rb

Defined Under Namespace

Classes: Session

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, secret) ⇒ Everbox

Returns a new instance of Everbox.



196
197
198
199
# File 'lib/backup/connection/everbox.rb', line 196

def initialize(token, secret)
  @token = token
  @secret = secret
end

Instance Attribute Details

#secretObject

Returns the value of attribute secret.



194
195
196
# File 'lib/backup/connection/everbox.rb', line 194

def secret
  @secret
end

#tokenObject

Returns the value of attribute token.



194
195
196
# File 'lib/backup/connection/everbox.rb', line 194

def token
  @token
end

Instance Method Details

#connectObject



220
221
222
# File 'lib/backup/connection/everbox.rb', line 220

def connect
  session
end

#pathObject



224
225
226
# File 'lib/backup/connection/everbox.rb', line 224

def path
  @path || "backups"
end

#sessionObject



206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/backup/connection/everbox.rb', line 206

def session
  opts = {}
  opts[:api_key] = token unless token.nil?
  opts[:secret_access_key] = secret unless secret.nil?
  @session ||= Session.new(opts)
  unless @session.authorized?
    @session.authorizing_token = token
    @session.authorizing_secret = secret
    @session.authorize!
  end

  @session
end

#static_initialize(procedure) ⇒ Object



201
202
203
204
# File 'lib/backup/connection/everbox.rb', line 201

def static_initialize(procedure)
  self.procedure = procedure
  load_storage_configuration_attributes(true)
end

#storeObject



228
229
230
231
# File 'lib/backup/connection/everbox.rb', line 228

def store
  path_to_file = File.join(tmp_path, final_file)
  session.upload(path_to_file, path, :mode => :dropbox)
end