Class: Files::FileMigration

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/file_migration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ FileMigration

Returns a new instance of FileMigration.



7
8
9
10
# File 'lib/files.com/models/file_migration.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/file_migration.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/file_migration.rb', line 5

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



76
77
78
# File 'lib/files.com/models/file_migration.rb', line 76

def self.all(params = {}, options = {})
  list(params, options)
end

.create_export(params = {}, options = {}) ⇒ Object

Parameters:

user_id - int64 - User ID.  Provide a value of `0` to operate the current session's user.


98
99
100
101
102
103
# File 'lib/files.com/models/file_migration.rb', line 98

def self.create_export(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)

  response, options = Api.send_request("/file_migrations/create_export", :post, params, options)
  Export.new(response.data, options)
end

.find(id, params = {}, options = {}) ⇒ Object

Parameters:

id (required) - int64 - File Migration ID.


82
83
84
85
86
87
88
89
90
# File 'lib/files.com/models/file_migration.rb', line 82

def self.find(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/file_migrations/#{params[:id]}", :get, params, options)
  FileMigration.new(response.data, options)
end

.get(id, params = {}, options = {}) ⇒ Object



92
93
94
# File 'lib/files.com/models/file_migration.rb', line 92

def self.get(id, params = {}, options = {})
  find(id, params, options)
end

.list(params = {}, options = {}) ⇒ Object

Parameters:

user_id - int64 - User ID.  Provide a value of `0` to operate the current session's user.
cursor - string - Used for pagination.  When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`.  Send one of those cursor value here to resume an existing list from the next available record.  Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page.  (Max: 10000, 1,000 or less is recommended).


66
67
68
69
70
71
72
73
74
# File 'lib/files.com/models/file_migration.rb', line 66

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)

  List.new(FileMigration, params) do
    Api.send_request("/file_migrations", :get, params, options)
  end
end

Instance Method Details

#dest_pathObject

string - Destination path



23
24
25
# File 'lib/files.com/models/file_migration.rb', line 23

def dest_path
  @attributes[:dest_path]
end

#failure_messageObject

string - Reason for the failure, if applicable.



28
29
30
# File 'lib/files.com/models/file_migration.rb', line 28

def failure_message
  @attributes[:failure_message]
end

#files_movedObject

int64 - Number of files processed



33
34
35
# File 'lib/files.com/models/file_migration.rb', line 33

def files_moved
  @attributes[:files_moved]
end

#files_totalObject

int64



38
39
40
# File 'lib/files.com/models/file_migration.rb', line 38

def files_total
  @attributes[:files_total]
end

#idObject

int64 - File migration ID



13
14
15
# File 'lib/files.com/models/file_migration.rb', line 13

def id
  @attributes[:id]
end

#log_urlObject

string - Link to download the log file for this migration.



58
59
60
# File 'lib/files.com/models/file_migration.rb', line 58

def log_url
  @attributes[:log_url]
end

#operationObject

string - The type of operation



43
44
45
# File 'lib/files.com/models/file_migration.rb', line 43

def operation
  @attributes[:operation]
end

#pathObject

string - Source path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.



18
19
20
# File 'lib/files.com/models/file_migration.rb', line 18

def path
  @attributes[:path]
end

#regionObject

string - Region



48
49
50
# File 'lib/files.com/models/file_migration.rb', line 48

def region
  @attributes[:region]
end

#statusObject

string - Status



53
54
55
# File 'lib/files.com/models/file_migration.rb', line 53

def status
  @attributes[:status]
end