Class: Files::ShareGroup
- Inherits:
-
Object
- Object
- Files::ShareGroup
- Defined in:
- lib/files.com/models/share_group.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(params = {}, options = {}) ⇒ Object
Parameters: user_id - int64 - User ID.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - Share Group ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: user_id - int64 - User ID.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: notes - string - Additional notes of the share group name - string - Name of the share group members - array(object) - A list of share group members.
Instance Method Summary collapse
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#id ⇒ Object
int64 - Share Group ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ ShareGroup
constructor
A new instance of ShareGroup.
-
#members ⇒ Object
array(object) - A list of share group members.
- #members=(value) ⇒ Object
-
#name ⇒ Object
string - Name of the share group.
- #name=(value) ⇒ Object
-
#notes ⇒ Object
string - Additional notes of the share group.
- #notes=(value) ⇒ Object
- #save ⇒ Object
-
#share_group_members ⇒ Object
array - A list of share group members.
- #share_group_members=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: notes - string - Additional notes of the share group name - string - Name of the share group members - array(object) - A list of share group members.
-
#user_id ⇒ Object
int64 - Owner User ID.
- #user_id=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ ShareGroup
Returns a new instance of ShareGroup.
7 8 9 10 |
# File 'lib/files.com/models/share_group.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/share_group.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/share_group.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
120 121 122 |
# File 'lib/files.com/models/share_group.rb', line 120 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
notes - string - Additional notes of the share group
name (required) - string - Name of the share group
members (required) - array(object) - A list of share group members.
145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/files.com/models/share_group.rb', line 145 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: notes must be an String") if params[:notes] and !params[:notes].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: members must be an Array") if params[:members] and !params[:members].is_a?(Array) raise MissingParameterError.new("Parameter missing: name") unless params[:name] raise MissingParameterError.new("Parameter missing: members") unless params[:members] response, = Api.send_request("/share_groups", :post, params, ) ShareGroup.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
174 175 176 177 178 179 180 181 182 |
# File 'lib/files.com/models/share_group.rb', line 174 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("/share_groups/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
184 185 186 |
# File 'lib/files.com/models/share_group.rb', line 184 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - Share Group ID.
126 127 128 129 130 131 132 133 134 |
# File 'lib/files.com/models/share_group.rb', line 126 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 MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/share_groups/#{params[:id]}", :get, params, ) ShareGroup.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
136 137 138 |
# File 'lib/files.com/models/share_group.rb', line 136 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
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: 10,000, 1,000 or less is recommended).
110 111 112 113 114 115 116 117 118 |
# File 'lib/files.com/models/share_group.rb', line 110 def self.list(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: 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) List.new(ShareGroup, params) do Api.send_request("/share_groups", :get, params, ) end end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
notes - string - Additional notes of the share group
name - string - Name of the share group
members - array(object) - A list of share group members.
161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/files.com/models/share_group.rb', line 161 def self.update(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: notes must be an String") if params[:notes] and !params[:notes].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: members must be an Array") if params[:members] and !params[:members].is_a?(Array) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/share_groups/#{params[:id]}", :patch, params, ) ShareGroup.new(response.data, ) end |
Instance Method Details
#delete(params = {}) ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'lib/files.com/models/share_group.rb', line 83 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("/share_groups/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
93 94 95 |
# File 'lib/files.com/models/share_group.rb', line 93 def destroy(params = {}) delete(params) end |
#id ⇒ Object
int64 - Share Group ID
13 14 15 |
# File 'lib/files.com/models/share_group.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/share_group.rb', line 17 def id=(value) @attributes[:id] = value end |
#members ⇒ Object
array(object) - A list of share group members.
58 59 60 |
# File 'lib/files.com/models/share_group.rb', line 58 def members @attributes[:members] end |
#members=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/share_group.rb', line 62 def members=(value) @attributes[:members] = value end |
#name ⇒ Object
string - Name of the share group
22 23 24 |
# File 'lib/files.com/models/share_group.rb', line 22 def name @attributes[:name] end |
#name=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/share_group.rb', line 26 def name=(value) @attributes[:name] = value end |
#notes ⇒ Object
string - Additional notes of the share group
31 32 33 |
# File 'lib/files.com/models/share_group.rb', line 31 def notes @attributes[:notes] end |
#notes=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/share_group.rb', line 35 def notes=(value) @attributes[:notes] = value end |
#save ⇒ Object
97 98 99 100 101 102 103 104 |
# File 'lib/files.com/models/share_group.rb', line 97 def save if @attributes[:id] update(@attributes) else new_obj = ShareGroup.create(@attributes, @options) @attributes = new_obj.attributes end end |
#share_group_members ⇒ Object
array - A list of share group members
49 50 51 |
# File 'lib/files.com/models/share_group.rb', line 49 def share_group_members @attributes[:share_group_members] end |
#share_group_members=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/share_group.rb', line 53 def share_group_members=(value) @attributes[:share_group_members] = value end |
#update(params = {}) ⇒ Object
Parameters:
notes - string - Additional notes of the share group
name - string - Name of the share group
members - array(object) - A list of share group members.
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/files.com/models/share_group.rb', line 70 def update(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 InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: members must be an Array") if params[:members] and !params[:members].is_a?(Array) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/share_groups/#{@attributes[:id]}", :patch, params, @options) end |
#user_id ⇒ Object
int64 - Owner User ID
40 41 42 |
# File 'lib/files.com/models/share_group.rb', line 40 def user_id @attributes[:user_id] end |
#user_id=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/share_group.rb', line 44 def user_id=(value) @attributes[:user_id] = value end |