Class: Files::Style

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 = {}, 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/style.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

.delete(path, params = {}, options = {}) ⇒ Object



131
132
133
134
135
136
137
138
139
# File 'lib/files.com/models/style.rb', line 131

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

  Api.send_request("/styles/#{params[:path]}", :delete, params, options)
  nil
end

.destroy(path, params = {}, options = {}) ⇒ Object



141
142
143
144
# File 'lib/files.com/models/style.rb', line 141

def self.destroy(path, params = {}, options = {})
  delete(path, params, options)
  nil
end

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

Parameters:

path (required) - string - Style path.


103
104
105
106
107
108
109
110
111
# File 'lib/files.com/models/style.rb', line 103

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

  response, options = Api.send_request("/styles/#{params[:path]}", :get, params, options)
  Style.new(response.data, options)
end

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



113
114
115
# File 'lib/files.com/models/style.rb', line 113

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

.update(path, params = {}, options = {}) ⇒ Object

Parameters:

file - file - Logo for custom branding. Required when creating a new style.
logo_click_href - string - URL to open when a public visitor clicks the logo.


120
121
122
123
124
125
126
127
128
129
# File 'lib/files.com/models/style.rb', line 120

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

  response, options = Api.send_request("/styles/#{params[:path]}", :patch, params, options)
  Style.new(response.data, options)
end

Instance Method Details

#delete(params = {}) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/files.com/models/style.rb', line 80

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[:path] and !params[:path].is_a?(String)
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]

  Api.send_request("/styles/#{@attributes[:path]}", :delete, params, @options)
end

#destroy(params = {}) ⇒ Object



90
91
92
93
# File 'lib/files.com/models/style.rb', line 90

def destroy(params = {})
  delete(params)
  nil
end

#fileObject

file - Logo for custom branding. Required when creating a new style.



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

def file
  @attributes[:file]
end

#file=(value) ⇒ Object



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

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

#idObject

int64 - Style ID



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#logoObject

Image - Logo



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

def 
  @attributes[:logo]
end

#logo=(value) ⇒ Object



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

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

#logo_click_hrefObject

string - URL to open when a public visitor clicks the logo



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

def logo_click_href
  @attributes[:logo_click_href]
end

#logo_click_href=(value) ⇒ Object



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

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

#pathObject

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

#saveObject



95
96
97
98
99
# File 'lib/files.com/models/style.rb', line 95

def save
  new_obj = update(@attributes)
  @attributes = new_obj.attributes
  true
end

#thumbnailObject

Image - Logo thumbnail



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

def thumbnail
  @attributes[:thumbnail]
end

#thumbnail=(value) ⇒ Object



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

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

#update(params = {}) ⇒ Object

Parameters:

file - file - Logo for custom branding. Required when creating a new style.
logo_click_href - string - URL to open when a public visitor clicks the logo.


69
70
71
72
73
74
75
76
77
78
# File 'lib/files.com/models/style.rb', line 69

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[:path] and !params[:path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: logo_click_href must be an String") if params[:logo_click_href] and !params[:logo_click_href].is_a?(String)
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]

  Api.send_request("/styles/#{@attributes[:path]}", :patch, params, @options)
end