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



185
186
187
# File 'lib/files.com/models/partner.rb', line 185

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

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

Parameters:

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.
root_folder - string - The root folder path 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.
workspace_id - int64 - ID of the Workspace associated with this Partner.


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

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].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: 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: 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]

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

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



250
251
252
253
254
255
256
257
258
# File 'lib/files.com/models/partner.rb', line 250

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



260
261
262
263
# File 'lib/files.com/models/partner.rb', line 260

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

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

Parameters:

id (required) - int64 - Partner ID.


191
192
193
194
195
196
197
198
199
# File 'lib/files.com/models/partner.rb', line 191

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



201
202
203
# File 'lib/files.com/models/partner.rb', line 201

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


174
175
176
177
178
179
180
181
182
183
# File 'lib/files.com/models/partner.rb', line 174

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:

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.
root_folder - string - The root folder path 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.


236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/files.com/models/partner.rb', line 236

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: notes must be an String") if params[:notes] and !params[:notes].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: 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 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.



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

def allow_credential_changes
  @attributes[:allow_credential_changes]
end

#allow_credential_changes=(value) ⇒ Object



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

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

#allow_providing_gpg_keysObject

boolean - Allow Partner Admins to provide GPG keys.



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

def allow_providing_gpg_keys
  @attributes[:allow_providing_gpg_keys]
end

#allow_providing_gpg_keys=(value) ⇒ Object



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

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

#allow_user_creationObject

boolean - Allow Partner Admins to create users.



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

def allow_user_creation
  @attributes[:allow_user_creation]
end

#allow_user_creation=(value) ⇒ Object



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

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

#delete(params = {}) ⇒ Object



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

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



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

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

#idObject

int64 - The unique ID of the Partner.



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#nameObject

string - The name of the Partner.



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

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



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

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

#notesObject

string - Notes about this Partner.



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

def notes
  @attributes[:notes]
end

#notes=(value) ⇒ Object



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

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

#partner_admin_idsObject

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



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

def partner_admin_ids
  @attributes[:partner_admin_ids]
end

#partner_admin_ids=(value) ⇒ Object



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

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

#root_folderObject

string - The root folder path for this Partner.



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

def root_folder
  @attributes[:root_folder]
end

#root_folder=(value) ⇒ Object



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

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

#saveObject



158
159
160
161
162
163
164
165
166
167
# File 'lib/files.com/models/partner.rb', line 158

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.



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

def tags
  @attributes[:tags]
end

#tags=(value) ⇒ Object



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

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

#update(params = {}) ⇒ Object

Parameters:

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.
root_folder - string - The root folder path 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.


129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/files.com/models/partner.rb', line 129

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: root_folder must be an String") if params[:root_folder] and !params[:root_folder].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 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.



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

def user_ids
  @attributes[:user_ids]
end

#user_ids=(value) ⇒ Object



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

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

#workspace_idObject

int64 - ID of the Workspace associated with this Partner.



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

def workspace_id
  @attributes[:workspace_id]
end

#workspace_id=(value) ⇒ Object



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

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