Class: Files::Preview
- Inherits:
-
Object
- Object
- Files::Preview
- Defined in:
- lib/files.com/models/preview.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create_export(params = {}, options = {}) ⇒ Object
Parameters: ids (required) - string - Preview IDs.
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - Preview ID bundle_registration_code - string - Bundle registration cookie code size - string - Preview Size.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
Instance Method Summary collapse
-
#download_uri ⇒ Object
string - Link to download preview.
-
#id ⇒ Object
int64 - Preview ID.
-
#initialize(attributes = {}, options = {}) ⇒ Preview
constructor
A new instance of Preview.
-
#size ⇒ Object
string - Preview size.
-
#status ⇒ Object
string - Preview status.
-
#type ⇒ Object
string - Preview type.
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Preview
Returns a new instance of Preview.
7 8 9 10 |
# File 'lib/files.com/models/preview.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/preview.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/preview.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
56 57 58 |
# File 'lib/files.com/models/preview.rb', line 56 def self.all(params = {}, = {}) list(params, ) end |
.create_export(params = {}, options = {}) ⇒ Object
Parameters:
ids (required) - string - Preview IDs. Comma delimited.
bundle_registration_code - string - Bundle registration cookie code
size - string - Preview Size
84 85 86 87 88 89 90 91 92 |
# File 'lib/files.com/models/preview.rb', line 84 def self.create_export(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: ids must be an String") if params[:ids] and !params[:ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: bundle_registration_code must be an String") if params[:bundle_registration_code] and !params[:bundle_registration_code].is_a?(String) raise InvalidParameterError.new("Bad parameter: size must be an String") if params[:size] and !params[:size].is_a?(String) raise MissingParameterError.new("Parameter missing: ids") unless params[:ids] response, = Api.send_request("/previews/create_export", :post, params, ) Export.new(response.data, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - Preview ID
bundle_registration_code - string - Bundle registration cookie code
size - string - Preview Size
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/files.com/models/preview.rb', line 64 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: bundle_registration_code must be an String") if params[:bundle_registration_code] and !params[:bundle_registration_code].is_a?(String) raise InvalidParameterError.new("Bad parameter: size must be an String") if params[:size] and !params[:size].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/previews/#{params[:id]}", :get, params, ) Preview.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
76 77 78 |
# File 'lib/files.com/models/preview.rb', line 76 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
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).
ids (required) - string - Preview IDs. Comma delimited.
bundle_registration_code - string - Bundle registration cookie code
size - string - Preview Size
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/files.com/models/preview.rb', line 43 def self.list(params = {}, = {}) 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: ids must be an String") if params[:ids] and !params[:ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: bundle_registration_code must be an String") if params[:bundle_registration_code] and !params[:bundle_registration_code].is_a?(String) raise InvalidParameterError.new("Bad parameter: size must be an String") if params[:size] and !params[:size].is_a?(String) raise MissingParameterError.new("Parameter missing: ids") unless params[:ids] List.new(Preview, params) do Api.send_request("/previews", :get, params, ) end end |
Instance Method Details
#download_uri ⇒ Object
string - Link to download preview
23 24 25 |
# File 'lib/files.com/models/preview.rb', line 23 def download_uri @attributes[:download_uri] end |
#id ⇒ Object
int64 - Preview ID
13 14 15 |
# File 'lib/files.com/models/preview.rb', line 13 def id @attributes[:id] end |
#size ⇒ Object
string - Preview size
33 34 35 |
# File 'lib/files.com/models/preview.rb', line 33 def size @attributes[:size] end |
#status ⇒ Object
string - Preview status. Can be invalid, not_generated, generating, complete, or file_too_large
18 19 20 |
# File 'lib/files.com/models/preview.rb', line 18 def status @attributes[:status] end |
#type ⇒ Object
string - Preview type. Can be image, pdf, pdf_native, video, audio, or text
28 29 30 |
# File 'lib/files.com/models/preview.rb', line 28 def type @attributes[:type] end |