Class: Files::Export

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Export.



7
8
9
10
# File 'lib/files.com/models/export.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/export.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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



106
107
108
# File 'lib/files.com/models/export.rb', line 106

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

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

Parameters:

user_id - int64 - User ID.  Provide a value of `0` to operate the current session's user.
export_type (required) - string - Export Report Type


129
130
131
132
133
134
135
136
# File 'lib/files.com/models/export.rb', line 129

def self.create(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: export_type must be an String") if params[:export_type] and !params[:export_type].is_a?(String)
  raise MissingParameterError.new("Parameter missing: export_type") unless params[:export_type]

  response, options = Api.send_request("/exports", :post, params, options)
  Export.new(response.data, 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.
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `export_status` and `export_type`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `export_status` and `export_type`.
filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `export_type`.


143
144
145
146
147
148
149
150
151
# File 'lib/files.com/models/export.rb', line 143

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)
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash)

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

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

Parameters:

id (required) - int64 - Export ID.


112
113
114
115
116
117
118
119
120
# File 'lib/files.com/models/export.rb', line 112

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("/exports/#{params[:id]}", :get, params, options)
  Export.new(response.data, options)
end

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



122
123
124
# File 'lib/files.com/models/export.rb', line 122

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).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `export_status` and `export_type`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `export_status` and `export_type`.
filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `export_type`.


93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/files.com/models/export.rb', line 93

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)
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash)

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

Instance Method Details

#download_uriObject

string - Link to download Export file.



49
50
51
# File 'lib/files.com/models/export.rb', line 49

def download_uri
  @attributes[:download_uri]
end

#download_uri=(value) ⇒ Object



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

def download_uri=(value)
  @attributes[:download_uri] = value
end

#export_rowsObject

int64 - Number of rows exported



40
41
42
# File 'lib/files.com/models/export.rb', line 40

def export_rows
  @attributes[:export_rows]
end

#export_rows=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/export.rb', line 44

def export_rows=(value)
  @attributes[:export_rows] = value
end

#export_statusObject

string - Status of the Export



22
23
24
# File 'lib/files.com/models/export.rb', line 22

def export_status
  @attributes[:export_status]
end

#export_status=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/export.rb', line 26

def export_status=(value)
  @attributes[:export_status] = value
end

#export_typeObject

string - Type of data being exported



31
32
33
# File 'lib/files.com/models/export.rb', line 31

def export_type
  @attributes[:export_type]
end

#export_type=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/export.rb', line 35

def export_type=(value)
  @attributes[:export_type] = value
end

#idObject

int64 - ID for this Export



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/export.rb', line 17

def id=(value)
  @attributes[:id] = value
end

#messageObject

string - Export message



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

def message
  @attributes[:message]
end

#message=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/export.rb', line 62

def message=(value)
  @attributes[:message] = value
end

#saveObject



75
76
77
78
79
80
81
82
83
84
# File 'lib/files.com/models/export.rb', line 75

def save
  if @attributes[:id]
    raise NotImplementedError.new("The Export object doesn't support updates.")
  else
    new_obj = Export.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#user_idObject

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



67
68
69
# File 'lib/files.com/models/export.rb', line 67

def user_id
  @attributes[:user_id]
end

#user_id=(value) ⇒ Object



71
72
73
# File 'lib/files.com/models/export.rb', line 71

def user_id=(value)
  @attributes[:user_id] = value
end