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



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

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.
notes - string - Notes about 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.


227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/files.com/models/partner.rb', line 227

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: 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



266
267
268
269
270
271
272
273
274
# File 'lib/files.com/models/partner.rb', line 266

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



276
277
278
279
# File 'lib/files.com/models/partner.rb', line 276

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

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

Parameters:

id (required) - int64 - Partner ID.


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

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



212
213
214
# File 'lib/files.com/models/partner.rb', line 212

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 `name`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`.


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

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.
notes - string - Notes about 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.


251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/files.com/models/partner.rb', line 251

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: 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

#delete(params = {}) ⇒ Object



154
155
156
157
158
159
160
161
162
# File 'lib/files.com/models/partner.rb', line 154

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



164
165
166
167
# File 'lib/files.com/models/partner.rb', line 164

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

#idObject

int64 - The unique ID of the Partner.



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#nameObject

string - The name of the Partner.



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

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



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

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

#notesObject

string - Notes about this Partner.



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

def notes
  @attributes[:notes]
end

#notes=(value) ⇒ Object



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

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

#partner_admin_idsObject

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



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

def partner_admin_ids
  @attributes[:partner_admin_ids]
end

#partner_admin_ids=(value) ⇒ Object



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

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

#root_folderObject

string - The root folder path for this Partner.



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

def root_folder
  @attributes[:root_folder]
end

#root_folder=(value) ⇒ Object



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

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

#saveObject



169
170
171
172
173
174
175
176
177
178
# File 'lib/files.com/models/partner.rb', line 169

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.



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

def tags
  @attributes[:tags]
end

#tags=(value) ⇒ Object



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

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.
notes - string - Notes about 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.


139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/files.com/models/partner.rb', line 139

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: 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.



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

def user_ids
  @attributes[:user_ids]
end

#user_ids=(value) ⇒ Object



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

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

#workspace_idObject

int64 - ID of the Workspace associated with this Partner.



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

def workspace_id
  @attributes[:workspace_id]
end

#workspace_id=(value) ⇒ Object



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

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