Class: Files::FileCommentReaction
- Inherits:
-
Object
- Object
- Files::FileCommentReaction
- Defined in:
- lib/files.com/models/file_comment_reaction.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
-
.create(params = {}, options = {}) ⇒ Object
Parameters: user_id - int64 - User ID.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
Instance Method Summary collapse
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#emoji ⇒ Object
string - Emoji used in the reaction.
- #emoji=(value) ⇒ Object
-
#file_comment_id ⇒ Object
int64 - ID of file comment to attach reaction to.
- #file_comment_id=(value) ⇒ Object
-
#id ⇒ Object
int64 - Reaction ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ FileCommentReaction
constructor
A new instance of FileCommentReaction.
- #save ⇒ Object
-
#user_id ⇒ Object
int64 - User ID.
- #user_id=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ FileCommentReaction
Returns a new instance of FileCommentReaction.
7 8 9 10 |
# File 'lib/files.com/models/file_comment_reaction.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/file_comment_reaction.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 5 def @options end |
Class Method Details
.create(params = {}, options = {}) ⇒ Object
Parameters:
user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
file_comment_id (required) - int64 - ID of file comment to attach reaction to.
emoji (required) - string - Emoji to react with.
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 75 def self.create(params = {}, = {}) 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: file_comment_id must be an Integer") if params[:file_comment_id] and !params[:file_comment_id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: emoji must be an String") if params[:emoji] and !params[:emoji].is_a?(String) raise MissingParameterError.new("Parameter missing: file_comment_id") unless params[:file_comment_id] raise MissingParameterError.new("Parameter missing: emoji") unless params[:emoji] response, = Api.send_request("/file_comment_reactions", :post, params, ) FileCommentReaction.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 86 def self.delete(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 MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/file_comment_reactions/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
96 97 98 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 96 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
Instance Method Details
#delete(params = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 48 def delete(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[: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] Api.send_request("/file_comment_reactions/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
58 59 60 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 58 def destroy(params = {}) delete(params) end |
#emoji ⇒ Object
string - Emoji used in the reaction.
22 23 24 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 22 def emoji @attributes[:emoji] end |
#emoji=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 26 def emoji=(value) @attributes[:emoji] = value end |
#file_comment_id ⇒ Object
int64 - ID of file comment to attach reaction to.
40 41 42 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 40 def file_comment_id @attributes[:file_comment_id] end |
#file_comment_id=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 44 def file_comment_id=(value) @attributes[:file_comment_id] = value end |
#id ⇒ Object
int64 - Reaction ID
13 14 15 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 17 def id=(value) @attributes[:id] = value end |
#save ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 62 def save if @attributes[:id] raise NotImplementedError.new("The FileCommentReaction object doesn't support updates.") else new_obj = FileCommentReaction.create(@attributes, @options) @attributes = new_obj.attributes end end |
#user_id ⇒ Object
int64 - User ID. Provide a value of ‘0` to operate the current session’s user.
31 32 33 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 31 def user_id @attributes[:user_id] end |
#user_id=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/file_comment_reaction.rb', line 35 def user_id=(value) @attributes[:user_id] = value end |