froala-editor-sdk 3.2.5.pre.2 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6e6e428cea368631249fbade577b63f828f260f41d603d2d2c34461252ce767
4
- data.tar.gz: f59eb4d3630df913f488f6751ea1a70990a397eeffbc4d036930a9e4ef0d6a72
3
+ metadata.gz: 13b94a775c6d8e23e099260ebd9104cabbf2621b498d7b08d7cfb4636b449ee5
4
+ data.tar.gz: 94032571c0de0b7466b059f5edc2bdd4ba81521100f6efd2651e60815b3cb85e
5
5
  SHA512:
6
- metadata.gz: 8c46ce8df884a1c35c498505408def0d23437b60bf49b4e5c8c8bea06cf846b6752a0b6bba731282ed44a1b2547fa7660cb2891e06138dc5d629d18434c76a1c
7
- data.tar.gz: 786f5172a373582cbe2a20badf3c9f3fec8a761f14f4d912bebf80f115d91f6b8c7c13d677c37f0af1f4621ab8745ed199bcadeb7a9a60c84bb81f1eda9ab567
6
+ metadata.gz: 30426bd4f3bcc3d2cbc2a052caca7dcf5dcab896f7fa8b33cf1a80b169675b5545413688af3ba08acc019e760308982ea3e8e5e54e01c91c225d868b37df997c
7
+ data.tar.gz: 1822c18b99cd8570c2a06876f505bed4ddd0afa3a24e0a7feea100fe7f856251ccf9686a047a7d343285b380bef4a7b81c6b75ed6a89ea8d61de3e921bfb8e53
@@ -1,11 +1,11 @@
1
- require 'mime-types'
2
- require 'mini_magick'
3
- require 'froala-editor-sdk/utils/validation'
4
- require 'froala-editor-sdk/utils/utils'
5
-
6
-
7
- require 'froala-editor-sdk/file'
8
- require 'froala-editor-sdk/image'
9
- require 'froala-editor-sdk/s3'
10
- require 'froala-editor-sdk/version'
11
- require 'froala-editor-sdk/video'
1
+ require 'mime-types'
2
+ require 'mini_magick'
3
+ require 'froala-editor-sdk/utils/validation'
4
+ require 'froala-editor-sdk/utils/utils'
5
+
6
+
7
+ require 'froala-editor-sdk/file'
8
+ require 'froala-editor-sdk/image'
9
+ require 'froala-editor-sdk/s3'
10
+ require 'froala-editor-sdk/version'
11
+ require 'froala-editor-sdk/video'
@@ -1,114 +1,114 @@
1
- module FroalaEditorSDK
2
-
3
- require 'fileutils'
4
-
5
- # File functionality.
6
- class File
7
-
8
- # Default options that are used if no options are passed to the upload function
9
- @default_options = {
10
- fieldname: 'file',
11
- validation: {
12
- allowedExts: [".txt", ".pdf", ".doc", ".json", ".html"],
13
- allowedMimeTypes: [ "text/plain", "application/msword", "application/x-pdf", "application/pdf", "application/json","text/html" ]
14
- },
15
- resize: nil,
16
- file_access_path: '/uploads/'
17
- }
18
-
19
- # Default upload path.
20
- @default_upload_path = "public/uploads/files"
21
-
22
- # Uploads a file to the server.
23
- # Params:
24
- # +params+:: File upload parameter mostly is "file".
25
- # +upload_path+:: Server upload path, a storage path where the file will be stored.
26
- # +options+:: Hash object that contains configuration parameters for uploading a file.
27
- # Returns json object
28
- def self.upload(params, upload_path = @default_upload_path, options = {})
29
-
30
- # Merge options.
31
- options = @default_options.merge(options)
32
-
33
- file = params[options[:fieldname]]
34
-
35
- if file
36
-
37
- # Validates the file extension and mime type.
38
- validation = Validation.check(file, options)
39
-
40
- # Uses the Utlis name function to generate a random name for the file.
41
- file_name = Utils.name(file)
42
- path = Rails.root.join(upload_path, file_name)
43
-
44
- # Saves the file on the server and returns the path.
45
- serve_url = save(file, path, options[:file_access_path])
46
-
47
- resize(options, path) if !options[:resize].nil?
48
-
49
- return {:link => serve_url}.to_json
50
- else
51
- return nil
52
- end
53
- end
54
-
55
- # Saves a file on the server.
56
- # Params:
57
- # +file+:: The uploaded file that will be saved on the server.
58
- # +path+:: The path where the file will be saved.
59
- def self.save (file, path, file_access_path)
60
-
61
- # Create directory if it doesn't exist.
62
- dirname = ::File.dirname(path)
63
- unless ::File.directory?(dirname)
64
- ::FileUtils.mkdir_p(dirname)
65
- end
66
-
67
- if ::File.open(path, "wb") {|f| f.write(file.read)}
68
-
69
- # Returns a public accessible server path.
70
- return "#{file_access_path}#{Utils.get_file_name(path)}"
71
- else
72
- return "error"
73
- end
74
- end
75
-
76
- # Deletes a file found on the server.
77
- # Params:
78
- # +file+:: The file that will be deleted from the server.
79
- # +path+:: The server path where the file resides.
80
- # Returns true or false.
81
- def self.delete(file = params[:file], path)
82
-
83
- file_path = Rails.root.join(path, ::File.basename(file))
84
- begin
85
- if ::File.delete(file_path)
86
- return true
87
- else
88
- return false
89
- end
90
- rescue => exception
91
- return false
92
- end
93
- end
94
-
95
- # Resizes an image based on the options provided.
96
- # The function resizes the original file,
97
- # Params:
98
- # +options+:: The options that contain the resize hash
99
- # +path+:: The path where the image is stored
100
- def self.resize (options, path)
101
- image = MiniMagick::Image.new(path)
102
- image.path
103
- image.resize("#{options[:resize][:width]}x#{options[:resize][:height]}")
104
- end
105
-
106
- class << self
107
- attr_reader :var
108
- end
109
-
110
- def var
111
- self.class.var
112
- end
113
- end
1
+ module FroalaEditorSDK
2
+
3
+ require 'fileutils'
4
+
5
+ # File functionality.
6
+ class File
7
+
8
+ # Default options that are used if no options are passed to the upload function
9
+ @default_options = {
10
+ fieldname: 'file',
11
+ validation: {
12
+ allowedExts: [".txt", ".pdf", ".doc", ".json", ".html"],
13
+ allowedMimeTypes: [ "text/plain", "application/msword", "application/x-pdf", "application/pdf", "application/json","text/html" ]
14
+ },
15
+ resize: nil,
16
+ file_access_path: '/uploads/'
17
+ }
18
+
19
+ # Default upload path.
20
+ @default_upload_path = "public/uploads/files"
21
+
22
+ # Uploads a file to the server.
23
+ # Params:
24
+ # +params+:: File upload parameter mostly is "file".
25
+ # +upload_path+:: Server upload path, a storage path where the file will be stored.
26
+ # +options+:: Hash object that contains configuration parameters for uploading a file.
27
+ # Returns json object
28
+ def self.upload(params, upload_path = @default_upload_path, options = {})
29
+
30
+ # Merge options.
31
+ options = @default_options.merge(options)
32
+
33
+ file = params[options[:fieldname]]
34
+
35
+ if file
36
+
37
+ # Validates the file extension and mime type.
38
+ validation = Validation.check(file, options)
39
+
40
+ # Uses the Utlis name function to generate a random name for the file.
41
+ file_name = Utils.name(file)
42
+ path = Rails.root.join(upload_path, file_name)
43
+
44
+ # Saves the file on the server and returns the path.
45
+ serve_url = save(file, path, options[:file_access_path])
46
+
47
+ resize(options, path) if !options[:resize].nil?
48
+
49
+ return {:link => serve_url}.to_json
50
+ else
51
+ return nil
52
+ end
53
+ end
54
+
55
+ # Saves a file on the server.
56
+ # Params:
57
+ # +file+:: The uploaded file that will be saved on the server.
58
+ # +path+:: The path where the file will be saved.
59
+ def self.save (file, path, file_access_path)
60
+
61
+ # Create directory if it doesn't exist.
62
+ dirname = ::File.dirname(path)
63
+ unless ::File.directory?(dirname)
64
+ ::FileUtils.mkdir_p(dirname)
65
+ end
66
+
67
+ if ::File.open(path, "wb") {|f| f.write(file.read)}
68
+
69
+ # Returns a public accessible server path.
70
+ return "#{file_access_path}#{Utils.get_file_name(path)}"
71
+ else
72
+ return "error"
73
+ end
74
+ end
75
+
76
+ # Deletes a file found on the server.
77
+ # Params:
78
+ # +file+:: The file that will be deleted from the server.
79
+ # +path+:: The server path where the file resides.
80
+ # Returns true or false.
81
+ def self.delete(file = params[:file], path)
82
+
83
+ file_path = Rails.root.join(path, ::File.basename(file))
84
+ begin
85
+ if ::File.delete(file_path)
86
+ return true
87
+ else
88
+ return false
89
+ end
90
+ rescue => exception
91
+ return false
92
+ end
93
+ end
94
+
95
+ # Resizes an image based on the options provided.
96
+ # The function resizes the original file,
97
+ # Params:
98
+ # +options+:: The options that contain the resize hash
99
+ # +path+:: The path where the image is stored
100
+ def self.resize (options, path)
101
+ image = MiniMagick::Image.new(path)
102
+ image.path
103
+ image.resize("#{options[:resize][:width]}x#{options[:resize][:height]}")
104
+ end
105
+
106
+ class << self
107
+ attr_reader :var
108
+ end
109
+
110
+ def var
111
+ self.class.var
112
+ end
113
+ end
114
114
  end
@@ -1,38 +1,38 @@
1
- module FroalaEditorSDK
2
- # Image functionality.
3
- class Image < File
4
-
5
- # Default options that are used if no options are passed to the upload function.
6
- @default_options = {
7
- fieldname: 'file',
8
- validation: {
9
- allowedExts: [".gif", ".jpeg", ".jpg", ".png", ".svg", ".blob"],
10
- allowedMimeTypes: [ "image/gif", "image/jpeg", "image/pjpeg", "image/x-png", "image/png", "image/svg+xml" ]
11
- },
12
- resize: nil,
13
- file_access_path: '/uploads/'
14
- }
15
-
16
- # Default upload path.
17
- @default_upload_path = "public/uploads/images"
18
-
19
- # Loads the images from a specific path
20
- # Params:
21
- # +path+:: The server path where the images are saved
22
- # Returns Json object
23
- def self.load_images(path, options = {})
24
-
25
- # Merge options.
26
- options = @default_options.merge(options)
27
-
28
- images = Dir["#{path}*"]
29
- all_images = []
30
-
31
- images.each do |img|
32
- all_images.push({url: "#{options[:file_access_path]}#{Utils.get_file_name(img)}"})
33
- end
34
-
35
- return all_images.to_json
36
- end
37
- end
1
+ module FroalaEditorSDK
2
+ # Image functionality.
3
+ class Image < File
4
+
5
+ # Default options that are used if no options are passed to the upload function.
6
+ @default_options = {
7
+ fieldname: 'file',
8
+ validation: {
9
+ allowedExts: [".gif", ".jpeg", ".jpg", ".png", ".svg", ".blob"],
10
+ allowedMimeTypes: [ "image/gif", "image/jpeg", "image/pjpeg", "image/x-png", "image/png", "image/svg+xml" ]
11
+ },
12
+ resize: nil,
13
+ file_access_path: '/uploads/'
14
+ }
15
+
16
+ # Default upload path.
17
+ @default_upload_path = "public/uploads/images"
18
+
19
+ # Loads the images from a specific path
20
+ # Params:
21
+ # +path+:: The server path where the images are saved
22
+ # Returns Json object
23
+ def self.load_images(path, options = {})
24
+
25
+ # Merge options.
26
+ options = @default_options.merge(options)
27
+
28
+ images = Dir["#{path}*"]
29
+ all_images = []
30
+
31
+ images.each do |img|
32
+ all_images.push({url: "#{options[:file_access_path]}#{Utils.get_file_name(img)}"})
33
+ end
34
+
35
+ return all_images.to_json
36
+ end
37
+ end
38
38
  end
@@ -1,96 +1,96 @@
1
- module FroalaEditorSDK
2
-
3
- # Uploads files to S3/AWS
4
- class S3
5
-
6
- # Builds a signature based on the options.
7
- # Params:
8
- # +options+:: The configuration params that are needed to compute the signature.
9
- def self.signature (options = nil)
10
- OpenSSL::HMAC.hexdigest(
11
- "SHA256",
12
- self.sign(
13
- self.sign(
14
- self.sign(
15
- self.sign(
16
- ("AWS4" + options[:secretKey]).force_encoding(Encoding::UTF_8),
17
- options[:'date-string']
18
- ),
19
- options[:region]
20
- ),
21
- "s3"
22
- ),
23
- "aws4_request"
24
- ),
25
- self.policy(options)
26
- )
27
- end
28
-
29
- # Builds a HMAC-SHA256 digest using key and data
30
- # Params:
31
- # +key+:: Key to use for creating the digest
32
- # +data+:: Data to be used for creating the digest
33
- def self.sign(key, data)
34
- OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, data.force_encoding(Encoding::UTF_8))
35
- end
36
-
37
- # Encodes to Base64 the policy data and replaces new lines chars.
38
- # Params:
39
- # +options+:: The configuration params that are needed to compute the signature.
40
- def self.policy (options = nil)
41
- Base64.encode64(self.policy_data(options).to_json).gsub("\n", "")
42
- end
43
-
44
- # Sets policy params, bucket that will be used max file size and other params.
45
- # Params:
46
- # +options+:: Configuration params that are needed to set the policy
47
- def self.policy_data (options = nil)
48
- {
49
- expiration: 10.hours.from_now.utc.iso8601,
50
- conditions: [
51
- ["starts-with", "$key", options[:keyStart]], # Start key/folder
52
- ["starts-with", "$Content-type", ""], # Content type
53
- {"x-requested-with": "xhr"}, # Request type
54
- {"x-amz-algorithm": options[:'x-amz-algorithm']}, # Encrytion Algorithm
55
- {"x-amz-date": options[:'x-amz-date']}, # Current Date
56
- {"x-amz-credential": options[:'x-amz-credential']}, # Encrypted Credentials
57
- {bucket: options[:bucket]}, # Bucket name
58
- {acl: options[:acl]}, # ACL property
59
- {success_action_status: "201"} # Response status 201 'file created'
60
- ]
61
- }
62
- end
63
-
64
- # Builds the amazon credential by appending access key, x-amz-date, region and 's3/aws4_request'
65
- # Params:
66
- # +options+:: Configuration params to generate the AWS response
67
- def self.getXamzCredential(options = nil)
68
- "#{options[:accessKey]}#{"/"}#{options[:'date-string']}#{"/"}#{options[:region]}#{"/"}#{"s3/aws4_request"}"
69
- end
70
-
71
- # Makes all the request in order and returns AWS hash response
72
- # Params:
73
- # +options+:: Configuration params to generate the AWS response.
74
- def self.data_hash (options = nil)
75
- options[:region] = 'us-east-1' if options[:region].nil? || options[:region] == 's3'
76
- options[:'date-string'] = Time.now.strftime("%Y%m%d")
77
- options[:'x-amz-algorithm'] = "AWS4-HMAC-SHA256"
78
- options[:'x-amz-credential'] = self.getXamzCredential(options)
79
- options[:'x-amz-date'] = options[:'date-string'] + "T000000Z"
80
-
81
- {
82
- :bucket => options[:bucket], # Upload bucket
83
- :region => options[:region] != 'us-east-1' ? "s3-#{options[:region]}" : 's3', # Upload region
84
- :keyStart => options[:keyStart], # Start key/folder
85
- :params => {
86
- :acl => options[:acl], # ACL property 'public-read'
87
- :policy => self.policy(options), # Defined policy
88
- :'x-amz-algorithm' => options[:'x-amz-algorithm'], # Encrytion Algorithm
89
- :'x-amz-credential' => options[:'x-amz-credential'], # Encrypted Credentials
90
- :'x-amz-date' => options[:'x-amz-date'], # Current Date
91
- :'x-amz-signature' => self.signature(options), # Defined signature
92
- }
93
- }
94
- end
95
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Uploads files to S3/AWS
4
+ class S3
5
+
6
+ # Builds a signature based on the options.
7
+ # Params:
8
+ # +options+:: The configuration params that are needed to compute the signature.
9
+ def self.signature (options = nil)
10
+ OpenSSL::HMAC.hexdigest(
11
+ "SHA256",
12
+ self.sign(
13
+ self.sign(
14
+ self.sign(
15
+ self.sign(
16
+ ("AWS4" + options[:secretKey]).force_encoding(Encoding::UTF_8),
17
+ options[:'date-string']
18
+ ),
19
+ options[:region]
20
+ ),
21
+ "s3"
22
+ ),
23
+ "aws4_request"
24
+ ),
25
+ self.policy(options)
26
+ )
27
+ end
28
+
29
+ # Builds a HMAC-SHA256 digest using key and data
30
+ # Params:
31
+ # +key+:: Key to use for creating the digest
32
+ # +data+:: Data to be used for creating the digest
33
+ def self.sign(key, data)
34
+ OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, data.force_encoding(Encoding::UTF_8))
35
+ end
36
+
37
+ # Encodes to Base64 the policy data and replaces new lines chars.
38
+ # Params:
39
+ # +options+:: The configuration params that are needed to compute the signature.
40
+ def self.policy (options = nil)
41
+ Base64.encode64(self.policy_data(options).to_json).gsub("\n", "")
42
+ end
43
+
44
+ # Sets policy params, bucket that will be used max file size and other params.
45
+ # Params:
46
+ # +options+:: Configuration params that are needed to set the policy
47
+ def self.policy_data (options = nil)
48
+ {
49
+ expiration: 10.hours.from_now.utc.iso8601,
50
+ conditions: [
51
+ ["starts-with", "$key", options[:keyStart]], # Start key/folder
52
+ ["starts-with", "$Content-type", ""], # Content type
53
+ {"x-requested-with": "xhr"}, # Request type
54
+ {"x-amz-algorithm": options[:'x-amz-algorithm']}, # Encrytion Algorithm
55
+ {"x-amz-date": options[:'x-amz-date']}, # Current Date
56
+ {"x-amz-credential": options[:'x-amz-credential']}, # Encrypted Credentials
57
+ {bucket: options[:bucket]}, # Bucket name
58
+ {acl: options[:acl]}, # ACL property
59
+ {success_action_status: "201"} # Response status 201 'file created'
60
+ ]
61
+ }
62
+ end
63
+
64
+ # Builds the amazon credential by appending access key, x-amz-date, region and 's3/aws4_request'
65
+ # Params:
66
+ # +options+:: Configuration params to generate the AWS response
67
+ def self.getXamzCredential(options = nil)
68
+ "#{options[:accessKey]}#{"/"}#{options[:'date-string']}#{"/"}#{options[:region]}#{"/"}#{"s3/aws4_request"}"
69
+ end
70
+
71
+ # Makes all the request in order and returns AWS hash response
72
+ # Params:
73
+ # +options+:: Configuration params to generate the AWS response.
74
+ def self.data_hash (options = nil)
75
+ options[:region] = 'us-east-1' if options[:region].nil? || options[:region] == 's3'
76
+ options[:'date-string'] = Time.now.strftime("%Y%m%d")
77
+ options[:'x-amz-algorithm'] = "AWS4-HMAC-SHA256"
78
+ options[:'x-amz-credential'] = self.getXamzCredential(options)
79
+ options[:'x-amz-date'] = options[:'date-string'] + "T000000Z"
80
+
81
+ {
82
+ :bucket => options[:bucket], # Upload bucket
83
+ :region => options[:region] != 'us-east-1' ? "s3-#{options[:region]}" : 's3', # Upload region
84
+ :keyStart => options[:keyStart], # Start key/folder
85
+ :params => {
86
+ :acl => options[:acl], # ACL property 'public-read'
87
+ :policy => self.policy(options), # Defined policy
88
+ :'x-amz-algorithm' => options[:'x-amz-algorithm'], # Encrytion Algorithm
89
+ :'x-amz-credential' => options[:'x-amz-credential'], # Encrypted Credentials
90
+ :'x-amz-date' => options[:'x-amz-date'], # Current Date
91
+ :'x-amz-signature' => self.signature(options), # Defined signature
92
+ }
93
+ }
94
+ end
95
+ end
96
96
  end
@@ -1,19 +1,19 @@
1
- module FroalaEditorSDK
2
-
3
- # Basic utility functionality.
4
- class Utils
5
-
6
- # Generates a random name that will be used as name for files.
7
- def self.name (file)
8
- name = SecureRandom.urlsafe_base64
9
- ext = ::File.extname(file.original_filename)
10
-
11
- return "#{name}#{ext}"
12
- end
13
-
14
- # Returns file name from an file path
15
- def self.get_file_name(path)
16
- return ::File.basename(path)
17
- end
18
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Basic utility functionality.
4
+ class Utils
5
+
6
+ # Generates a random name that will be used as name for files.
7
+ def self.name (file)
8
+ name = SecureRandom.urlsafe_base64
9
+ ext = ::File.extname(file.original_filename)
10
+
11
+ return "#{name}#{ext}"
12
+ end
13
+
14
+ # Returns file name from an file path
15
+ def self.get_file_name(path)
16
+ return ::File.basename(path)
17
+ end
18
+ end
19
19
  end
@@ -1,35 +1,35 @@
1
- module FroalaEditorSDK
2
-
3
- # Image Validation class.
4
- # Checks if image is matching the allowed extensions and mime types.
5
- class Validation
6
- require "mime-types"
7
-
8
- def self.ext(ext, options)
9
- raise "Not allowed" unless options[:validation][:allowedExts].include?(ext)
10
- end
11
-
12
- def self.mime(mime, options)
13
- raise "Invalid mime type" unless options[:validation][:allowedMimeTypes].include?(mime)
14
- end
15
-
16
- # Checks an image with the options.
17
- # Params:
18
- # +file+:: The image that will be validated.
19
- # +options+:: The image options that contain allowed extensions and mime types.
20
- # Raises exception if the image has not passed the validation
21
- def self.check(file, options = nil)
22
-
23
- mime = file.content_type
24
- ext = ::File.extname(file.original_filename)
25
-
26
- # Check if there is custom validation.
27
- if options[:validation].class != Proc
28
- ext(ext, options) && mime(mime, options)
29
- else
30
- options[:validation].call(file.path, mime)
31
- end
32
- end
33
-
34
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Image Validation class.
4
+ # Checks if image is matching the allowed extensions and mime types.
5
+ class Validation
6
+ require "mime-types"
7
+
8
+ def self.ext(ext, options)
9
+ raise "Not allowed" unless options[:validation][:allowedExts].include?(ext)
10
+ end
11
+
12
+ def self.mime(mime, options)
13
+ raise "Invalid mime type" unless options[:validation][:allowedMimeTypes].include?(mime)
14
+ end
15
+
16
+ # Checks an image with the options.
17
+ # Params:
18
+ # +file+:: The image that will be validated.
19
+ # +options+:: The image options that contain allowed extensions and mime types.
20
+ # Raises exception if the image has not passed the validation
21
+ def self.check(file, options = nil)
22
+
23
+ mime = file.content_type
24
+ ext = ::File.extname(file.original_filename)
25
+
26
+ # Check if there is custom validation.
27
+ if options[:validation].class != Proc
28
+ ext(ext, options) && mime(mime, options)
29
+ else
30
+ options[:validation].call(file.path, mime)
31
+ end
32
+ end
33
+
34
+ end
35
35
  end
@@ -1,10 +1,9 @@
1
- module FroalaEditorSDK
2
- module Version
3
- Major = 3
4
- Minor = 2
5
- Tiny = 5
6
- Tiny1= 2
7
-
8
- String = "#{Major}.#{Minor}.#{Tiny}-#{Tiny1}"
9
- end
1
+ module FroalaEditorSDK
2
+ module Version
3
+ Major = 3
4
+ Minor = 2
5
+ Tiny = 7
6
+
7
+ String = "#{Major}.#{Minor}.#{Tiny}"
8
+ end
10
9
  end
@@ -1,20 +1,20 @@
1
- module FroalaEditorSDK
2
-
3
- # Video functionality.
4
- class Video < File
5
-
6
- # Default options that are used if no options are passed to the upload function
7
- @default_options = {
8
- fieldname: 'file',
9
- validation: {
10
- allowedExts: [".mp4", ".webm", ".ogg"],
11
- allowedMimeTypes: [ "video/mp4", "video/webm", "video/ogg" ]
12
- },
13
- resize: nil,
14
- file_access_path: '/uploads/'
15
- }
16
-
17
- # Default upload path.
18
- @default_upload_path = "public/uploads/videos"
19
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Video functionality.
4
+ class Video < File
5
+
6
+ # Default options that are used if no options are passed to the upload function
7
+ @default_options = {
8
+ fieldname: 'file',
9
+ validation: {
10
+ allowedExts: [".mp4", ".webm", ".ogg"],
11
+ allowedMimeTypes: [ "video/mp4", "video/webm", "video/ogg" ]
12
+ },
13
+ resize: nil,
14
+ file_access_path: '/uploads/'
15
+ }
16
+
17
+ # Default upload path.
18
+ @default_upload_path = "public/uploads/videos"
19
+ end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: froala-editor-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5.pre.2
4
+ version: 3.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Froala Labs
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.1'
33
+ version: 3.2.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.1'
40
+ version: 3.2.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mini_magick
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.5'
55
55
  description: Ruby SDK for Froala Editor
56
- email:
56
+ email:
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
@@ -70,7 +70,7 @@ homepage: https://github.com/froala/wysiwyg-editor-ruby-sdk
70
70
  licenses:
71
71
  - MIT
72
72
  metadata: {}
73
- post_install_message:
73
+ post_install_message:
74
74
  rdoc_options: []
75
75
  require_paths:
76
76
  - lib
@@ -81,12 +81,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">"
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 1.3.1
86
+ version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.0.3
89
- signing_key:
88
+ rubygems_version: 3.1.2
89
+ signing_key:
90
90
  specification_version: 4
91
91
  summary: Ruby on Rails SDK for Froala WYSIWYG Editor.
92
92
  test_files: []