Class: Files::As2Partner

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of As2Partner.



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

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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



233
234
235
# File 'lib/files.com/models/as2_partner.rb', line 233

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

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

Parameters:

enable_dedicated_ips - boolean - If `true`, we will use your site's dedicated IPs for all outbound connections to this AS2 PArtner.
http_auth_username - string - Username to send to server for HTTP Authentication.
http_auth_password - string - Password to send to server for HTTP Authentication.
mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response?  This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.
server_certificate - string - Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS?
as2_station_id (required) - int64 - ID of the AS2 Station associated with this partner.
name (required) - string - The partner's formal AS2 name.
uri (required) - string - Public URI where we will send the AS2 messages (via HTTP/HTTPS).
public_certificate (required) - string - Public certificate for AS2 Partner.  Note: This is the certificate for AS2 message security, not a certificate used for HTTPS authentication.


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

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: http_auth_username must be an String") if params[:http_auth_username] and !params[:http_auth_username].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: http_auth_password must be an String") if params[:http_auth_password] and !params[:http_auth_password].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: mdn_validation_level must be an String") if params[:mdn_validation_level] and !params[:mdn_validation_level].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: server_certificate must be an String") if params[:server_certificate] and !params[:server_certificate].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: as2_station_id must be an Integer") if params[:as2_station_id] and !params[:as2_station_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: uri must be an String") if params[:uri] and !params[:uri].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params[:public_certificate] and !params[:public_certificate].is_a?(String)
  raise MissingParameterError.new("Parameter missing: as2_station_id") unless params[:as2_station_id]
  raise MissingParameterError.new("Parameter missing: name") unless params[:name]
  raise MissingParameterError.new("Parameter missing: uri") unless params[:uri]
  raise MissingParameterError.new("Parameter missing: public_certificate") unless params[:public_certificate]

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

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



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

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

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



317
318
319
320
# File 'lib/files.com/models/as2_partner.rb', line 317

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

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

Parameters:

id (required) - int64 - As2 Partner ID.


239
240
241
242
243
244
245
246
247
# File 'lib/files.com/models/as2_partner.rb', line 239

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

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



249
250
251
# File 'lib/files.com/models/as2_partner.rb', line 249

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).
action - string
page - int64


222
223
224
225
226
227
228
229
230
231
# File 'lib/files.com/models/as2_partner.rb', line 222

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: action must be an String") if params[:action] and !params[:action].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params[:page] and !params[:page].is_a?(Integer)

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

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

Parameters:

enable_dedicated_ips - boolean - If `true`, we will use your site's dedicated IPs for all outbound connections to this AS2 PArtner.
http_auth_username - string - Username to send to server for HTTP Authentication.
http_auth_password - string - Password to send to server for HTTP Authentication.
mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response?  This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.
server_certificate - string - Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS?
name - string - The partner's formal AS2 name.
uri - string - Public URI where we will send the AS2 messages (via HTTP/HTTPS).
public_certificate - string - Public certificate for AS2 Partner.  Note: This is the certificate for AS2 message security, not a certificate used for HTTPS authentication.


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

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: http_auth_username must be an String") if params[:http_auth_username] and !params[:http_auth_username].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: http_auth_password must be an String") if params[:http_auth_password] and !params[:http_auth_password].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: mdn_validation_level must be an String") if params[:mdn_validation_level] and !params[:mdn_validation_level].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: server_certificate must be an String") if params[:server_certificate] and !params[:server_certificate].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: uri must be an String") if params[:uri] and !params[:uri].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params[:public_certificate] and !params[:public_certificate].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

Instance Method Details

#as2_station_idObject

int64 - ID of the AS2 Station associated with this partner.



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

def as2_station_id
  @attributes[:as2_station_id]
end

#as2_station_id=(value) ⇒ Object



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

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

#delete(params = {}) ⇒ Object



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

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

#destroy(params = {}) ⇒ Object



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

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

#enable_dedicated_ipsObject

boolean - If ‘true`, we will use your site’s dedicated IPs for all outbound connections to this AS2 PArtner.



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

def enable_dedicated_ips
  @attributes[:enable_dedicated_ips]
end

#enable_dedicated_ips=(value) ⇒ Object



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

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

#hex_public_certificate_serialObject

string - Serial of public certificate used for message security in hex format.



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

def hex_public_certificate_serial
  @attributes[:hex_public_certificate_serial]
end

#hex_public_certificate_serial=(value) ⇒ Object



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

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

#http_auth_passwordObject

string - Password to send to server for HTTP Authentication.



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

def http_auth_password
  @attributes[:http_auth_password]
end

#http_auth_password=(value) ⇒ Object



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

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

#http_auth_usernameObject

string - Username to send to server for HTTP Authentication.



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

def http_auth_username
  @attributes[:http_auth_username]
end

#http_auth_username=(value) ⇒ Object



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

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

#idObject

int64 - ID of the AS2 Partner.



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#mdn_validation_levelObject

string - How should Files.com evaluate message transfer success based on a partner’s MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. ‘none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.



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

def mdn_validation_level
  @attributes[:mdn_validation_level]
end

#mdn_validation_level=(value) ⇒ Object



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

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

#nameObject

string - The partner’s formal AS2 name.



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

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



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

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

#public_certificateObject

string - Public certificate for AS2 Partner. Note: This is the certificate for AS2 message security, not a certificate used for HTTPS authentication.



157
158
159
# File 'lib/files.com/models/as2_partner.rb', line 157

def public_certificate
  @attributes[:public_certificate]
end

#public_certificate=(value) ⇒ Object



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

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

#public_certificate_issuerObject

string - Issuer of public certificate used for message security.



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

def public_certificate_issuer
  @attributes[:public_certificate_issuer]
end

#public_certificate_issuer=(value) ⇒ Object



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

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

#public_certificate_md5Object

string - MD5 hash of public certificate used for message security.



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

def public_certificate_md5
  @attributes[:public_certificate_md5]
end

#public_certificate_md5=(value) ⇒ Object



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

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

#public_certificate_not_afterObject

string - Not after value of public certificate used for message security.



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

def public_certificate_not_after
  @attributes[:public_certificate_not_after]
end

#public_certificate_not_after=(value) ⇒ Object



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

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

#public_certificate_not_beforeObject

string - Not before value of public certificate used for message security.



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

def public_certificate_not_before
  @attributes[:public_certificate_not_before]
end

#public_certificate_not_before=(value) ⇒ Object



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

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

#public_certificate_serialObject

string - Serial of public certificate used for message security.



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

def public_certificate_serial
  @attributes[:public_certificate_serial]
end

#public_certificate_serial=(value) ⇒ Object



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

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

#public_certificate_subjectObject

string - Subject of public certificate used for message security.



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

def public_certificate_subject
  @attributes[:public_certificate_subject]
end

#public_certificate_subject=(value) ⇒ Object



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

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

#saveObject



206
207
208
209
210
211
212
213
214
215
# File 'lib/files.com/models/as2_partner.rb', line 206

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

  @attributes = new_obj.attributes
  true
end

#server_certificateObject

string - Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS?



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

def server_certificate
  @attributes[:server_certificate]
end

#server_certificate=(value) ⇒ Object



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

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

#update(params = {}) ⇒ Object

Parameters:

enable_dedicated_ips - boolean - If `true`, we will use your site's dedicated IPs for all outbound connections to this AS2 PArtner.
http_auth_username - string - Username to send to server for HTTP Authentication.
http_auth_password - string - Password to send to server for HTTP Authentication.
mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response?  This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.
server_certificate - string - Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS?
name - string - The partner's formal AS2 name.
uri - string - Public URI where we will send the AS2 messages (via HTTP/HTTPS).
public_certificate - string - Public certificate for AS2 Partner.  Note: This is the certificate for AS2 message security, not a certificate used for HTTPS authentication.


174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/files.com/models/as2_partner.rb', line 174

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: http_auth_username must be an String") if params[:http_auth_username] and !params[:http_auth_username].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: http_auth_password must be an String") if params[:http_auth_password] and !params[:http_auth_password].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: mdn_validation_level must be an String") if params[:mdn_validation_level] and !params[:mdn_validation_level].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: server_certificate must be an String") if params[:server_certificate] and !params[:server_certificate].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: uri must be an String") if params[:uri] and !params[:uri].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params[:public_certificate] and !params[:public_certificate].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

#uriObject

string - Public URI where we will send the AS2 messages (via HTTP/HTTPS).



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

def uri
  @attributes[:uri]
end

#uri=(value) ⇒ Object



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

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