Class: Files::Style
- Inherits:
-
Object
- Object
- Files::Style
- Defined in:
- lib/files.com/models/style.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(path, params = {}, options = {}) ⇒ Object
- .delete(path, params = {}, options = {}) ⇒ Object
- .destroy(path, params = {}, options = {}) ⇒ Object
-
.list(path, params = {}, options = {}) ⇒ Object
Parameters: path (required) - string - Style path.
-
.update(path, params = {}, options = {}) ⇒ Object
Parameters: file (required) - file - Logo for custom branding.
Instance Method Summary collapse
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#file ⇒ Object
file - Logo for custom branding.
- #file=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ Style
constructor
A new instance of Style.
-
#logo ⇒ Object
Logo.
- #logo=(value) ⇒ Object
-
#path ⇒ Object
string - Folder path This must be slash-delimited, but it must neither start nor end with a slash.
- #path=(value) ⇒ Object
- #save ⇒ Object
-
#thumbnail ⇒ Object
Logo thumbnail.
- #thumbnail=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: file (required) - file - Logo for custom branding.
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Style
Returns a new instance of Style.
7 8 9 10 |
# File 'lib/files.com/models/style.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/style.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/style.rb', line 5 def @options end |
Class Method Details
.all(path, params = {}, options = {}) ⇒ Object
91 92 93 |
# File 'lib/files.com/models/style.rb', line 91 def self.all(path, params = {}, = {}) list(path, params, ) end |
.delete(path, params = {}, options = {}) ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/files.com/models/style.rb', line 108 def self.delete(path, params = {}, = {}) params ||= {} params[:path] = path raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) response, = Api.send_request("/styles/#{URI.encode_www_form_component(params[:path])}", :delete, params, ) response.data end |
.destroy(path, params = {}, options = {}) ⇒ Object
118 119 120 |
# File 'lib/files.com/models/style.rb', line 118 def self.destroy(path, params = {}, = {}) delete(path, params, ) end |
.list(path, params = {}, options = {}) ⇒ Object
Parameters:
path (required) - string - Style path.
81 82 83 84 85 86 87 88 89 |
# File 'lib/files.com/models/style.rb', line 81 def self.list(path, params = {}, = {}) params ||= {} params[:path] = path raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) response, = Api.send_request("/styles/#{URI.encode_www_form_component(params[:path])}", :get, params, ) Style.new(response.data, ) end |
.update(path, params = {}, options = {}) ⇒ Object
Parameters:
file (required) - file - Logo for custom branding.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/files.com/models/style.rb', line 97 def self.update(path, params = {}, = {}) params ||= {} params[:path] = path raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) raise MissingParameterError.new("Parameter missing: file") unless params.dig(:file) response, = Api.send_request("/styles/#{URI.encode_www_form_component(params[:path])}", :patch, params, ) Style.new(response.data, ) end |
Instance Method Details
#delete(params = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/files.com/models/style.rb', line 61 def delete(params = {}) params ||= {} params[:path] = @attributes[:path] raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path] raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) Api.send_request("/styles/#{URI.encode_www_form_component(@attributes[:path])}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/style.rb', line 71 def destroy(params = {}) delete(params) end |
#file ⇒ Object
file - Logo for custom branding.
40 41 42 |
# File 'lib/files.com/models/style.rb', line 40 def file @attributes[:file] end |
#file=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/style.rb', line 44 def file=(value) @attributes[:file] = value end |
#logo ⇒ Object
Logo
13 14 15 |
# File 'lib/files.com/models/style.rb', line 13 def logo @attributes[:logo] end |
#logo=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/style.rb', line 17 def logo=(value) @attributes[:logo] = value end |
#path ⇒ Object
string - Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
22 23 24 |
# File 'lib/files.com/models/style.rb', line 22 def path @attributes[:path] end |
#path=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/style.rb', line 26 def path=(value) @attributes[:path] = value end |
#save ⇒ Object
75 76 77 |
# File 'lib/files.com/models/style.rb', line 75 def save update(@attributes) end |
#thumbnail ⇒ Object
Logo thumbnail
31 32 33 |
# File 'lib/files.com/models/style.rb', line 31 def thumbnail @attributes[:thumbnail] end |
#thumbnail=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/style.rb', line 35 def thumbnail=(value) @attributes[:thumbnail] = value end |
#update(params = {}) ⇒ Object
Parameters:
file (required) - file - Logo for custom branding.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/files.com/models/style.rb', line 50 def update(params = {}) params ||= {} params[:path] = @attributes[:path] raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path] raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) raise MissingParameterError.new("Parameter missing: file") unless params.dig(:file) Api.send_request("/styles/#{URI.encode_www_form_component(@attributes[:path])}", :patch, params, @options) end |