Class: Files::Partner

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ Partner

Returns a new instance of Partner.



7
8
9
10
# File 'lib/files.com/models/partner.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/partner.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



228
229
230
# File 'lib/files.com/models/partner.rb', line 228

def self.all(params = {}, options = {})
  list(params, options)
end

.create(params = {}, options = {}) ⇒ Object

Parameters:

allowed_ips - string - A list of allowed IPs for this Partner. Newline delimited. Partner User IP access is allowed when the IP matches the Partner, User, or Site allowed IP lists.
allow_bypassing_2fa_policies - boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
allow_providing_gpg_keys - boolean - Allow Partner Admins to provide GPG keys.
allow_user_creation - boolean - Allow Partner Admins to create users.
cc_emails_to_responsible_party - boolean - When `true`, emails sent to Partner users are copied to the responsible User or Group.
notes - string - Notes about this Partner.
responsible_group_id - int64 - ID of the Group responsible for this Partner.
responsible_user_id - int64 - ID of the User responsible for this Partner.
tags - string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags.  Tags must only contain lowercase letters, numbers, and hyphens.
name (required) - string - The name of the Partner.
root_folder (required) - string - The root folder path for this Partner.
workspace_id - int64 - ID of the Workspace associated with this Partner.


262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/files.com/models/partner.rb', line 262

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: allowed_ips must be an String") if params[:allowed_ips] and !params[:allowed_ips].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: responsible_group_id must be an Integer") if params[:responsible_group_id] and !params[:responsible_group_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: responsible_user_id must be an Integer") if params[:responsible_user_id] and !params[:responsible_user_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: tags must be an String") if params[:tags] and !params[:tags].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: root_folder must be an String") if params[:root_folder] and !params[:root_folder].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: name") unless params[:name]
  raise MissingParameterError.new("Parameter missing: root_folder") unless params[:root_folder]

  response, options = Api.send_request("/partners", :post, params, options)
  Partner.new(response.data, options)
end

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



308
309
310
311
312
313
314
315
316
# File 'lib/files.com/models/partner.rb', line 308

def self.delete(id, params = {}, options = {})
  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]

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

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



318
319
320
321
# File 'lib/files.com/models/partner.rb', line 318

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

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

Parameters:

id (required) - int64 - Partner ID.


234
235
236
237
238
239
240
241
242
# File 'lib/files.com/models/partner.rb', line 234

def self.find(id, params = {}, options = {})
  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, options = Api.send_request("/partners/#{params[:id]}", :get, params, options)
  Partner.new(response.data, options)
end

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



244
245
246
# File 'lib/files.com/models/partner.rb', line 244

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

.list(params = {}, options = {}) ⇒ Object

Parameters:

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).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id` and `id`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`.


217
218
219
220
221
222
223
224
225
226
# File 'lib/files.com/models/partner.rb', line 217

def self.list(params = {}, options = {})
  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)
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)

  List.new(Partner, params) do
    Api.send_request("/partners", :get, params, options)
  end
end

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

Parameters:

allowed_ips - string - A list of allowed IPs for this Partner. Newline delimited. Partner User IP access is allowed when the IP matches the Partner, User, or Site allowed IP lists.
allow_bypassing_2fa_policies - boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
allow_providing_gpg_keys - boolean - Allow Partner Admins to provide GPG keys.
allow_user_creation - boolean - Allow Partner Admins to create users.
cc_emails_to_responsible_party - boolean - When `true`, emails sent to Partner users are copied to the responsible User or Group.
notes - string - Notes about this Partner.
responsible_group_id - int64 - ID of the Group responsible for this Partner.
responsible_user_id - int64 - ID of the User responsible for this Partner.
tags - string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags.  Tags must only contain lowercase letters, numbers, and hyphens.
name - string - The name of the Partner.
root_folder - string - The root folder path for this Partner.


291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/files.com/models/partner.rb', line 291

def self.update(id, params = {}, options = {})
  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: allowed_ips must be an String") if params[:allowed_ips] and !params[:allowed_ips].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: responsible_group_id must be an Integer") if params[:responsible_group_id] and !params[:responsible_group_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: responsible_user_id must be an Integer") if params[:responsible_user_id] and !params[:responsible_user_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: tags must be an String") if params[:tags] and !params[:tags].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: root_folder must be an String") if params[:root_folder] and !params[:root_folder].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/partners/#{params[:id]}", :patch, params, options)
  Partner.new(response.data, options)
end

Instance Method Details

#allow_bypassing_2fa_policiesObject

boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.



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

def allow_bypassing_2fa_policies
  @attributes[:allow_bypassing_2fa_policies]
end

#allow_bypassing_2fa_policies=(value) ⇒ Object



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

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

#allow_credential_changesObject

boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.



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

def allow_credential_changes
  @attributes[:allow_credential_changes]
end

#allow_credential_changes=(value) ⇒ Object



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

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

#allow_providing_gpg_keysObject

boolean - Allow Partner Admins to provide GPG keys.



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

def allow_providing_gpg_keys
  @attributes[:allow_providing_gpg_keys]
end

#allow_providing_gpg_keys=(value) ⇒ Object



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

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

#allow_user_creationObject

boolean - Allow Partner Admins to create users.



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

def allow_user_creation
  @attributes[:allow_user_creation]
end

#allow_user_creation=(value) ⇒ Object



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

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

#allowed_ipsObject

string - A list of allowed IPs for this Partner. Newline delimited. Partner User IP access is allowed when the IP matches the Partner, User, or Site allowed IP lists.



22
23
24
# File 'lib/files.com/models/partner.rb', line 22

def allowed_ips
  @attributes[:allowed_ips]
end

#allowed_ips=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/partner.rb', line 26

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

#cc_emails_to_responsible_partyObject

boolean - When ‘true`, emails sent to Partner users are copied to the responsible User or Group.



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

def cc_emails_to_responsible_party
  @attributes[:cc_emails_to_responsible_party]
end

#cc_emails_to_responsible_party=(value) ⇒ Object



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

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

#delete(params = {}) ⇒ Object



186
187
188
189
190
191
192
193
194
# File 'lib/files.com/models/partner.rb', line 186

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("/partners/#{@attributes[:id]}", :delete, params, @options)
end

#destroy(params = {}) ⇒ Object



196
197
198
199
# File 'lib/files.com/models/partner.rb', line 196

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

#idObject

int64 - The unique ID of the Partner.



67
68
69
# File 'lib/files.com/models/partner.rb', line 67

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



71
72
73
# File 'lib/files.com/models/partner.rb', line 71

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

#nameObject

string - The name of the Partner.



85
86
87
# File 'lib/files.com/models/partner.rb', line 85

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



89
90
91
# File 'lib/files.com/models/partner.rb', line 89

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

#notesObject

string - Notes about this Partner.



94
95
96
# File 'lib/files.com/models/partner.rb', line 94

def notes
  @attributes[:notes]
end

#notes=(value) ⇒ Object



98
99
100
# File 'lib/files.com/models/partner.rb', line 98

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

#partner_admin_idsObject

array(int64) - Array of User IDs that are Partner Admins for this Partner.



103
104
105
# File 'lib/files.com/models/partner.rb', line 103

def partner_admin_ids
  @attributes[:partner_admin_ids]
end

#partner_admin_ids=(value) ⇒ Object



107
108
109
# File 'lib/files.com/models/partner.rb', line 107

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

#responsible_group_idObject

int64 - ID of the Group responsible for this Partner.



112
113
114
# File 'lib/files.com/models/partner.rb', line 112

def responsible_group_id
  @attributes[:responsible_group_id]
end

#responsible_group_id=(value) ⇒ Object



116
117
118
# File 'lib/files.com/models/partner.rb', line 116

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

#responsible_user_idObject

int64 - ID of the User responsible for this Partner.



121
122
123
# File 'lib/files.com/models/partner.rb', line 121

def responsible_user_id
  @attributes[:responsible_user_id]
end

#responsible_user_id=(value) ⇒ Object



125
126
127
# File 'lib/files.com/models/partner.rb', line 125

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

#root_folderObject

string - The root folder path for this Partner.



130
131
132
# File 'lib/files.com/models/partner.rb', line 130

def root_folder
  @attributes[:root_folder]
end

#root_folder=(value) ⇒ Object



134
135
136
# File 'lib/files.com/models/partner.rb', line 134

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

#saveObject



201
202
203
204
205
206
207
208
209
210
# File 'lib/files.com/models/partner.rb', line 201

def save
  if @attributes[:id]
    new_obj = update(@attributes)
  else
    new_obj = Partner.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#tagsObject

string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.



139
140
141
# File 'lib/files.com/models/partner.rb', line 139

def tags
  @attributes[:tags]
end

#tags=(value) ⇒ Object



143
144
145
# File 'lib/files.com/models/partner.rb', line 143

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

#update(params = {}) ⇒ Object

Parameters:

allowed_ips - string - A list of allowed IPs for this Partner. Newline delimited. Partner User IP access is allowed when the IP matches the Partner, User, or Site allowed IP lists.
allow_bypassing_2fa_policies - boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
allow_providing_gpg_keys - boolean - Allow Partner Admins to provide GPG keys.
allow_user_creation - boolean - Allow Partner Admins to create users.
cc_emails_to_responsible_party - boolean - When `true`, emails sent to Partner users are copied to the responsible User or Group.
notes - string - Notes about this Partner.
responsible_group_id - int64 - ID of the Group responsible for this Partner.
responsible_user_id - int64 - ID of the User responsible for this Partner.
tags - string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags.  Tags must only contain lowercase letters, numbers, and hyphens.
name - string - The name of the Partner.
root_folder - string - The root folder path for this Partner.


169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/files.com/models/partner.rb', line 169

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: allowed_ips must be an String") if params[:allowed_ips] and !params[:allowed_ips].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: responsible_group_id must be an Integer") if params[:responsible_group_id] and !params[:responsible_group_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: responsible_user_id must be an Integer") if params[:responsible_user_id] and !params[:responsible_user_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: tags must be an String") if params[:tags] and !params[:tags].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: root_folder must be an String") if params[:root_folder] and !params[:root_folder].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

#user_idsObject

array(int64) - Array of User IDs that belong to this Partner.



148
149
150
# File 'lib/files.com/models/partner.rb', line 148

def user_ids
  @attributes[:user_ids]
end

#user_ids=(value) ⇒ Object



152
153
154
# File 'lib/files.com/models/partner.rb', line 152

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

#workspace_idObject

int64 - ID of the Workspace associated with this Partner.



76
77
78
# File 'lib/files.com/models/partner.rb', line 76

def workspace_id
  @attributes[:workspace_id]
end

#workspace_id=(value) ⇒ Object



80
81
82
# File 'lib/files.com/models/partner.rb', line 80

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