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



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

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


220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/files.com/models/partner_channel.rb', line 220

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



256
257
258
259
260
261
262
263
264
# File 'lib/files.com/models/partner_channel.rb', line 256

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



266
267
268
269
# File 'lib/files.com/models/partner_channel.rb', line 266

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

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

Parameters:

id (required) - int64 - Partner Channel ID.


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

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



208
209
210
# File 'lib/files.com/models/partner_channel.rb', line 208

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


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

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_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_route_path - string - Optional route path for files delivered to the Partner.
path - string - Channel path relative to the Partner root folder.


241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/files.com/models/partner_channel.rb', line 241

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



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

def channel_path
  @attributes[:channel_path]
end

#channel_path=(value) ⇒ Object



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

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

#delete(params = {}) ⇒ Object



150
151
152
153
154
155
156
157
158
# File 'lib/files.com/models/partner_channel.rb', line 150

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



160
161
162
163
# File 'lib/files.com/models/partner_channel.rb', line 160

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

#effective_from_partner_folder_nameObject

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



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

def effective_from_partner_folder_name
  @attributes[:effective_from_partner_folder_name]
end

#effective_from_partner_folder_name=(value) ⇒ Object



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

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.



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

def effective_to_partner_folder_name
  @attributes[:effective_to_partner_folder_name]
end

#effective_to_partner_folder_name=(value) ⇒ Object



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

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.



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

def from_partner_folder_name
  @attributes[:from_partner_folder_name]
end

#from_partner_folder_name=(value) ⇒ Object



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

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

#from_partner_folder_pathObject

string - Resolved from-Partner folder path.



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

def from_partner_folder_path
  @attributes[:from_partner_folder_path]
end

#from_partner_folder_path=(value) ⇒ Object



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

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

#from_partner_route_pathObject

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



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

def from_partner_route_path
  @attributes[:from_partner_route_path]
end

#from_partner_route_path=(value) ⇒ Object



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

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



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

def path
  @attributes[:path]
end

#path=(value) ⇒ Object



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

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

#saveObject



165
166
167
168
169
170
171
172
173
174
# File 'lib/files.com/models/partner_channel.rb', line 165

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.



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

def to_partner_folder_name
  @attributes[:to_partner_folder_name]
end

#to_partner_folder_name=(value) ⇒ Object



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

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

#to_partner_folder_pathObject

string - Resolved to-Partner folder path.



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

def to_partner_folder_path
  @attributes[:to_partner_folder_path]
end

#to_partner_folder_path=(value) ⇒ Object



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

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

#to_partner_route_pathObject

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



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

def to_partner_route_path
  @attributes[:to_partner_route_path]
end

#to_partner_route_path=(value) ⇒ Object



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

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_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_route_path - string - Optional route path for files delivered to the Partner.
path - string - Channel path relative to the Partner root folder.


135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/files.com/models/partner_channel.rb', line 135

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