Class: Files::As2Station

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of As2Station.



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

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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



213
214
215
# File 'lib/files.com/models/as2_station.rb', line 213

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

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

Parameters:

name (required) - string - AS2 Name
public_certificate (required) - string
private_key (required) - string
private_key_password - string


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

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].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 InvalidParameterError.new("Bad parameter: private_key must be an String") if params[:private_key] and !params[:private_key].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: private_key_password must be an String") if params[:private_key_password] and !params[:private_key_password].is_a?(String)
  raise MissingParameterError.new("Parameter missing: name") unless params[:name]
  raise MissingParameterError.new("Parameter missing: public_certificate") unless params[:public_certificate]
  raise MissingParameterError.new("Parameter missing: private_key") unless params[:private_key]

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

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



270
271
272
273
274
275
276
277
278
# File 'lib/files.com/models/as2_station.rb', line 270

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

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



280
281
282
283
# File 'lib/files.com/models/as2_station.rb', line 280

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

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

Parameters:

id (required) - int64 - As2 Station ID.


219
220
221
222
223
224
225
226
227
# File 'lib/files.com/models/as2_station.rb', line 219

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

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



229
230
231
# File 'lib/files.com/models/as2_station.rb', line 229

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


204
205
206
207
208
209
210
211
# File 'lib/files.com/models/as2_station.rb', line 204

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)

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

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

Parameters:

name - string - AS2 Name
public_certificate - string
private_key - string
private_key_password - string


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

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: name must be an String") if params[:name] and !params[:name].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 InvalidParameterError.new("Bad parameter: private_key must be an String") if params[:private_key] and !params[:private_key].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: private_key_password must be an String") if params[:private_key_password] and !params[:private_key_password].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

Instance Method Details

#delete(params = {}) ⇒ Object



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

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

#destroy(params = {}) ⇒ Object



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

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

#domainObject

string - The station’s AS2 domain name.



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

def domain
  @attributes[:domain]
end

#domain=(value) ⇒ Object



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

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

#hex_public_certificate_serialObject

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



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

def hex_public_certificate_serial
  @attributes[:hex_public_certificate_serial]
end

#hex_public_certificate_serial=(value) ⇒ Object



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

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

#idObject

int64 - Id of the AS2 Station.



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#nameObject

string - The station’s formal AS2 name.



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

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



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

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

#private_keyObject

string



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

def private_key
  @attributes[:private_key]
end

#private_key=(value) ⇒ Object



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

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

#private_key_md5Object

string - MD5 hash of private key used for message security.



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

def private_key_md5
  @attributes[:private_key_md5]
end

#private_key_md5=(value) ⇒ Object



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

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

#private_key_passwordObject

string



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

def private_key_password
  @attributes[:private_key_password]
end

#private_key_password=(value) ⇒ Object



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

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

#private_key_password_md5Object

string - MD5 hash of private key password used for message security.



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

def private_key_password_md5
  @attributes[:private_key_password_md5]
end

#private_key_password_md5=(value) ⇒ Object



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

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

#public_certificateObject

string



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

def public_certificate
  @attributes[:public_certificate]
end

#public_certificate=(value) ⇒ Object



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

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

#public_certificate_issuerObject

string - Issuer of public certificate used for message security.



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

def public_certificate_issuer
  @attributes[:public_certificate_issuer]
end

#public_certificate_issuer=(value) ⇒ Object



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

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

#public_certificate_md5Object

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



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

def public_certificate_md5
  @attributes[:public_certificate_md5]
end

#public_certificate_md5=(value) ⇒ Object



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

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.



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

def public_certificate_not_after
  @attributes[:public_certificate_not_after]
end

#public_certificate_not_after=(value) ⇒ Object



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

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.



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

def public_certificate_not_before
  @attributes[:public_certificate_not_before]
end

#public_certificate_not_before=(value) ⇒ Object



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

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.



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

def public_certificate_serial
  @attributes[:public_certificate_serial]
end

#public_certificate_serial=(value) ⇒ Object



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

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

#public_certificate_subjectObject

string - Subject of public certificate used for message security.



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

def public_certificate_subject
  @attributes[:public_certificate_subject]
end

#public_certificate_subject=(value) ⇒ Object



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

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

#saveObject



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

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

  @attributes = new_obj.attributes
  true
end

#update(params = {}) ⇒ Object

Parameters:

name - string - AS2 Name
public_certificate - string
private_key - string
private_key_password - string


161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/files.com/models/as2_station.rb', line 161

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: name must be an String") if params[:name] and !params[:name].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 InvalidParameterError.new("Bad parameter: private_key must be an String") if params[:private_key] and !params[:private_key].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: private_key_password must be an String") if params[:private_key_password] and !params[:private_key_password].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

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

#uriObject

string - Public URI for sending AS2 message to.



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

def uri
  @attributes[:uri]
end

#uri=(value) ⇒ Object



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

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