Class: Files::As2Station
- Inherits:
-
Object
- Object
- Files::As2Station
- Defined in:
- lib/files.com/models/as2_station.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create(params = {}, options = {}) ⇒ Object
Parameters: name (required) - string - AS2 Name public_certificate (required) - string private_key (required) - string private_key_password - string.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - As2 Station ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: name - string - AS2 Name public_certificate - string private_key - string private_key_password - string.
Instance Method Summary collapse
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#domain ⇒ Object
string - The station’s AS2 domain name.
- #domain=(value) ⇒ Object
-
#hex_public_certificate_serial ⇒ Object
string - Serial of public certificate used for message security in hex format.
- #hex_public_certificate_serial=(value) ⇒ Object
-
#id ⇒ Object
int64 - Id of the AS2 Station.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ As2Station
constructor
A new instance of As2Station.
-
#name ⇒ Object
string - The station’s formal AS2 name.
- #name=(value) ⇒ Object
-
#private_key ⇒ Object
string.
- #private_key=(value) ⇒ Object
-
#private_key_md5 ⇒ Object
string - MD5 hash of private key used for message security.
- #private_key_md5=(value) ⇒ Object
-
#private_key_password ⇒ Object
string.
- #private_key_password=(value) ⇒ Object
-
#private_key_password_md5 ⇒ Object
string - MD5 hash of private key password used for message security.
- #private_key_password_md5=(value) ⇒ Object
-
#public_certificate ⇒ Object
string.
- #public_certificate=(value) ⇒ Object
-
#public_certificate_issuer ⇒ Object
string - Issuer of public certificate used for message security.
- #public_certificate_issuer=(value) ⇒ Object
-
#public_certificate_md5 ⇒ Object
string - MD5 hash of public certificate used for message security.
- #public_certificate_md5=(value) ⇒ Object
-
#public_certificate_not_after ⇒ Object
string - Not after value of public certificate used for message security.
- #public_certificate_not_after=(value) ⇒ Object
-
#public_certificate_not_before ⇒ Object
string - Not before value of public certificate used for message security.
- #public_certificate_not_before=(value) ⇒ Object
-
#public_certificate_serial ⇒ Object
string - Serial of public certificate used for message security.
- #public_certificate_serial=(value) ⇒ Object
-
#public_certificate_subject ⇒ Object
string - Subject of public certificate used for message security.
- #public_certificate_subject=(value) ⇒ Object
- #save ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: name - string - AS2 Name public_certificate - string private_key - string private_key_password - string.
-
#uri ⇒ Object
string - Public URI for sending AS2 message to.
- #uri=(value) ⇒ Object
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 = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/as2_station.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/as2_station.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
210 211 212 |
# File 'lib/files.com/models/as2_station.rb', line 210 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
name (required) - string - AS2 Name
public_certificate (required) - string
private_key (required) - string
private_key_password - string
235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/files.com/models/as2_station.rb', line 235 def self.create(params = {}, = {}) 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, = Api.send_request("/as2_stations", :post, params, ) As2Station.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
267 268 269 270 271 272 273 274 275 |
# File 'lib/files.com/models/as2_station.rb', line 267 def self.delete(id, params = {}, = {}) 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, = Api.send_request("/as2_stations/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
277 278 279 |
# File 'lib/files.com/models/as2_station.rb', line 277 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - As2 Station ID.
216 217 218 219 220 221 222 223 224 |
# File 'lib/files.com/models/as2_station.rb', line 216 def self.find(id, params = {}, = {}) 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, = Api.send_request("/as2_stations/#{params[:id]}", :get, params, ) As2Station.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
226 227 228 |
# File 'lib/files.com/models/as2_station.rb', line 226 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
201 202 203 204 205 206 207 208 |
# File 'lib/files.com/models/as2_station.rb', line 201 def self.list(params = {}, = {}) 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, ) end end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
name - string - AS2 Name
public_certificate - string
private_key - string
private_key_password - string
253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/files.com/models/as2_station.rb', line 253 def self.update(id, params = {}, = {}) 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, = Api.send_request("/as2_stations/#{params[:id]}", :patch, params, ) As2Station.new(response.data, ) 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 |
# File 'lib/files.com/models/as2_station.rb', line 185 def destroy(params = {}) delete(params) end |
#domain ⇒ Object
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_serial ⇒ Object
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 |
#id ⇒ Object
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 |
#name ⇒ Object
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_key ⇒ Object
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_md5 ⇒ Object
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_password ⇒ Object
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_md5 ⇒ Object
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_certificate ⇒ Object
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_issuer ⇒ Object
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_md5 ⇒ Object
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_after ⇒ Object
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_before ⇒ Object
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_serial ⇒ Object
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_subject ⇒ Object
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 |
#save ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/files.com/models/as2_station.rb', line 189 def save if @attributes[:id] update(@attributes) else new_obj = As2Station.create(@attributes, @options) @attributes = new_obj.attributes end 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 |
#uri ⇒ Object
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 |