Class: Files::PartnerChannel

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of PartnerChannel.



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

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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



223
224
225
# File 'lib/files.com/models/partner_channel.rb', line 223

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

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

Parameters:

from_partner_folder_name - string - Optional Channel-level from-Partner folder name override.
from_partner_managed_folder_paths - array(string) - Managed folder paths inside the from-Partner folder.
from_partner_route_path - string - Optional route path for files uploaded by the Partner.
to_partner_folder_name - string - Optional Channel-level to-Partner folder name override.
to_partner_managed_folder_paths - array(string) - Managed folder paths inside the to-Partner folder.
to_partner_route_path - string - Optional route path for files delivered to the Partner.
partner_id (required) - int64 - ID of the Partner this Channel belongs to.
path (required) - string - Channel path relative to the Partner root folder.
workspace_id - int64 - ID of the Workspace associated with this Partner Channel.


253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/files.com/models/partner_channel.rb', line 253

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: from_partner_folder_name must be an String") if params[:from_partner_folder_name] and !params[:from_partner_folder_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: from_partner_managed_folder_paths must be an Array") if params[:from_partner_managed_folder_paths] and !params[:from_partner_managed_folder_paths].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: from_partner_route_path must be an String") if params[:from_partner_route_path] and !params[:from_partner_route_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: to_partner_folder_name must be an String") if params[:to_partner_folder_name] and !params[:to_partner_folder_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: to_partner_managed_folder_paths must be an Array") if params[:to_partner_managed_folder_paths] and !params[:to_partner_managed_folder_paths].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: to_partner_route_path must be an String") if params[:to_partner_route_path] and !params[:to_partner_route_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: partner_id must be an Integer") if params[:partner_id] and !params[:partner_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].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: partner_id") unless params[:partner_id]
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]

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

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



295
296
297
298
299
300
301
302
303
# File 'lib/files.com/models/partner_channel.rb', line 295

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

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



305
306
307
308
# File 'lib/files.com/models/partner_channel.rb', line 305

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

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

Parameters:

id (required) - int64 - Partner Channel ID.


229
230
231
232
233
234
235
236
237
# File 'lib/files.com/models/partner_channel.rb', line 229

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("/partner_channels/#{params[:id]}", :get, params, options)
  PartnerChannel.new(response.data, options)
end

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



239
240
241
# File 'lib/files.com/models/partner_channel.rb', line 239

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: 10000, 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`, `path` or `partner_id`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `partner_id` and `workspace_id`. Valid field combinations are `[ workspace_id, partner_id ]`.


212
213
214
215
216
217
218
219
220
221
# File 'lib/files.com/models/partner_channel.rb', line 212

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(PartnerChannel, params) do
    Api.send_request("/partner_channels", :get, params, options)
  end
end

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

Parameters:

from_partner_folder_name - string - Optional Channel-level from-Partner folder name override.
from_partner_managed_folder_paths - array(string) - Managed folder paths inside the from-Partner folder.
from_partner_route_path - string - Optional route path for files uploaded by the Partner.
to_partner_folder_name - string - Optional Channel-level to-Partner folder name override.
to_partner_managed_folder_paths - array(string) - Managed folder paths inside the to-Partner folder.
to_partner_route_path - string - Optional route path for files delivered to the Partner.
path - string - Channel path relative to the Partner root folder.


278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/files.com/models/partner_channel.rb', line 278

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: from_partner_folder_name must be an String") if params[:from_partner_folder_name] and !params[:from_partner_folder_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: from_partner_managed_folder_paths must be an Array") if params[:from_partner_managed_folder_paths] and !params[:from_partner_managed_folder_paths].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: from_partner_route_path must be an String") if params[:from_partner_route_path] and !params[:from_partner_route_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: to_partner_folder_name must be an String") if params[:to_partner_folder_name] and !params[:to_partner_folder_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: to_partner_managed_folder_paths must be an Array") if params[:to_partner_managed_folder_paths] and !params[:to_partner_managed_folder_paths].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: to_partner_route_path must be an String") if params[:to_partner_route_path] and !params[:to_partner_route_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

Instance Method Details

#channel_pathObject

string - Resolved Channel folder path.



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

def channel_path
  @attributes[:channel_path]
end

#channel_path=(value) ⇒ Object



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

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

#delete(params = {}) ⇒ Object



181
182
183
184
185
186
187
188
189
# File 'lib/files.com/models/partner_channel.rb', line 181

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

#destroy(params = {}) ⇒ Object



191
192
193
194
# File 'lib/files.com/models/partner_channel.rb', line 191

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

#effective_from_partner_folder_nameObject

string - Resolved from-Partner folder name after Channel override and default.



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

def effective_from_partner_folder_name
  @attributes[:effective_from_partner_folder_name]
end

#effective_from_partner_folder_name=(value) ⇒ Object



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

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

#effective_to_partner_folder_nameObject

string - Resolved to-Partner folder name after Channel override and default.



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

def effective_to_partner_folder_name
  @attributes[:effective_to_partner_folder_name]
end

#effective_to_partner_folder_name=(value) ⇒ Object



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

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

#from_partner_folder_nameObject

string - Optional Channel-level from-Partner folder name override.



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

def from_partner_folder_name
  @attributes[:from_partner_folder_name]
end

#from_partner_folder_name=(value) ⇒ Object



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

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

#from_partner_folder_pathObject

string - Resolved from-Partner folder path.



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

def from_partner_folder_path
  @attributes[:from_partner_folder_path]
end

#from_partner_folder_path=(value) ⇒ Object



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

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

#from_partner_managed_folder_pathsObject

array(string) - Managed folder paths inside the from-Partner folder.



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

def from_partner_managed_folder_paths
  @attributes[:from_partner_managed_folder_paths]
end

#from_partner_managed_folder_paths=(value) ⇒ Object



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

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

#from_partner_route_pathObject

string - Optional route path for files uploaded by the Partner.



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

def from_partner_route_path
  @attributes[:from_partner_route_path]
end

#from_partner_route_path=(value) ⇒ Object



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

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

#idObject

int64 - The unique ID of the Partner Channel.



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#partner_channel_template_idObject

int64 - ID of the Partner Channel Template that manages this Channel, if any.



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

def partner_channel_template_id
  @attributes[:partner_channel_template_id]
end

#partner_channel_template_id=(value) ⇒ Object



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

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

#partner_idObject

int64 - ID of the Partner this Channel belongs to.



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

def partner_id
  @attributes[:partner_id]
end

#partner_id=(value) ⇒ Object



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

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

#pathObject

string - Channel path relative to the Partner root folder. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.



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

def path
  @attributes[:path]
end

#path=(value) ⇒ Object



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

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

#saveObject



196
197
198
199
200
201
202
203
204
205
# File 'lib/files.com/models/partner_channel.rb', line 196

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

  @attributes = new_obj.attributes
  true
end

#to_partner_folder_nameObject

string - Optional Channel-level to-Partner folder name override.



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

def to_partner_folder_name
  @attributes[:to_partner_folder_name]
end

#to_partner_folder_name=(value) ⇒ Object



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

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

#to_partner_folder_pathObject

string - Resolved to-Partner folder path.



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

def to_partner_folder_path
  @attributes[:to_partner_folder_path]
end

#to_partner_folder_path=(value) ⇒ Object



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

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

#to_partner_managed_folder_pathsObject

array(string) - Managed folder paths inside the to-Partner folder.



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

def to_partner_managed_folder_paths
  @attributes[:to_partner_managed_folder_paths]
end

#to_partner_managed_folder_paths=(value) ⇒ Object



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

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

#to_partner_route_pathObject

string - Optional route path for files delivered to the Partner.



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

def to_partner_route_path
  @attributes[:to_partner_route_path]
end

#to_partner_route_path=(value) ⇒ Object



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

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

#update(params = {}) ⇒ Object

Parameters:

from_partner_folder_name - string - Optional Channel-level from-Partner folder name override.
from_partner_managed_folder_paths - array(string) - Managed folder paths inside the from-Partner folder.
from_partner_route_path - string - Optional route path for files uploaded by the Partner.
to_partner_folder_name - string - Optional Channel-level to-Partner folder name override.
to_partner_managed_folder_paths - array(string) - Managed folder paths inside the to-Partner folder.
to_partner_route_path - string - Optional route path for files delivered to the Partner.
path - string - Channel path relative to the Partner root folder.


164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/files.com/models/partner_channel.rb', line 164

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: from_partner_folder_name must be an String") if params[:from_partner_folder_name] and !params[:from_partner_folder_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: from_partner_managed_folder_paths must be an Array") if params[:from_partner_managed_folder_paths] and !params[:from_partner_managed_folder_paths].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: from_partner_route_path must be an String") if params[:from_partner_route_path] and !params[:from_partner_route_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: to_partner_folder_name must be an String") if params[:to_partner_folder_name] and !params[:to_partner_folder_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: to_partner_managed_folder_paths must be an Array") if params[:to_partner_managed_folder_paths] and !params[:to_partner_managed_folder_paths].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: to_partner_route_path must be an String") if params[:to_partner_route_path] and !params[:to_partner_route_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

#workspace_idObject

int64 - ID of the Workspace associated with this Partner Channel.



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

def workspace_id
  @attributes[:workspace_id]
end

#workspace_id=(value) ⇒ Object



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

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