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 domain (required) - string - AS2 Domain uri (required) - string - URL base for AS2 responses public_certificate (required) - string private_key (required) - 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 domain - string - AS2 Domain uri - string - URL base for AS2 responses public_certificate - string private_key - string.
Instance Method Summary collapse
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#domain ⇒ Object
string - The station’s AS2 domain name.
- #domain=(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
-
#public_certificate ⇒ Object
string - Public certificate used for message security.
- #public_certificate=(value) ⇒ Object
-
#public_certificate_md5 ⇒ Object
string - MD5 hash of public certificate used for message security.
- #public_certificate_md5=(value) ⇒ Object
- #save ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: name - string - AS2 Name domain - string - AS2 Domain uri - string - URL base for AS2 responses public_certificate - string private_key - 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
140 141 142 |
# File 'lib/files.com/models/as2_station.rb', line 140 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
name (required) - string - AS2 Name
domain (required) - string - AS2 Domain
uri (required) - string - URL base for AS2 responses
public_certificate (required) - string
private_key (required) - string
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/files.com/models/as2_station.rb', line 166 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: domain must be an String") if params.dig(:domain) and !params.dig(:domain).is_a?(String) raise InvalidParameterError.new("Bad parameter: uri must be an String") if params.dig(:uri) and !params.dig(:uri).is_a?(String) raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params.dig(:public_certificate) and !params.dig(:public_certificate).is_a?(String) raise InvalidParameterError.new("Bad parameter: private_key must be an String") if params.dig(:private_key) and !params.dig(:private_key).is_a?(String) raise MissingParameterError.new("Parameter missing: name") unless params.dig(:name) raise MissingParameterError.new("Parameter missing: domain") unless params.dig(:domain) raise MissingParameterError.new("Parameter missing: uri") unless params.dig(:uri) raise MissingParameterError.new("Parameter missing: public_certificate") unless params.dig(:public_certificate) raise MissingParameterError.new("Parameter missing: private_key") unless params.dig(:private_key) response, = Api.send_request("/as2_stations", :post, params, ) As2Station.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
203 204 205 206 207 208 209 210 211 |
# File 'lib/files.com/models/as2_station.rb', line 203 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/as2_stations/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
213 214 215 |
# File 'lib/files.com/models/as2_station.rb', line 213 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - As2 Station ID.
146 147 148 149 150 151 152 153 154 |
# File 'lib/files.com/models/as2_station.rb', line 146 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/as2_stations/#{params[:id]}", :get, params, ) As2Station.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
156 157 158 |
# File 'lib/files.com/models/as2_station.rb', line 156 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).
131 132 133 134 135 136 137 138 |
# File 'lib/files.com/models/as2_station.rb', line 131 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(: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
domain - string - AS2 Domain
uri - string - URL base for AS2 responses
public_certificate - string
private_key - string
188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/files.com/models/as2_station.rb', line 188 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: domain must be an String") if params.dig(:domain) and !params.dig(:domain).is_a?(String) raise InvalidParameterError.new("Bad parameter: uri must be an String") if params.dig(:uri) and !params.dig(:uri).is_a?(String) raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params.dig(:public_certificate) and !params.dig(:public_certificate).is_a?(String) raise InvalidParameterError.new("Bad parameter: private_key must be an String") if params.dig(:private_key) and !params.dig(:private_key).is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/as2_stations/#{params[:id]}", :patch, params, ) As2Station.new(response.data, ) end |
Instance Method Details
#delete(params = {}) ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/files.com/models/as2_station.rb', line 105 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.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) Api.send_request("/as2_stations/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
115 116 117 |
# File 'lib/files.com/models/as2_station.rb', line 115 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 |
#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
76 77 78 |
# File 'lib/files.com/models/as2_station.rb', line 76 def private_key @attributes[:private_key] end |
#private_key=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/as2_station.rb', line 80 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 |
#public_certificate ⇒ Object
string - Public certificate used for message security.
49 50 51 |
# File 'lib/files.com/models/as2_station.rb', line 49 def public_certificate @attributes[:public_certificate] end |
#public_certificate=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/as2_station.rb', line 53 def public_certificate=(value) @attributes[:public_certificate] = 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 |
#save ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/files.com/models/as2_station.rb', line 119 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
domain - string - AS2 Domain
uri - string - URL base for AS2 responses
public_certificate - string
private_key - string
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/files.com/models/as2_station.rb', line 90 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.dig(:id) and !params.dig(:id).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: domain must be an String") if params.dig(:domain) and !params.dig(:domain).is_a?(String) raise InvalidParameterError.new("Bad parameter: uri must be an String") if params.dig(:uri) and !params.dig(:uri).is_a?(String) raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params.dig(:public_certificate) and !params.dig(:public_certificate).is_a?(String) raise InvalidParameterError.new("Bad parameter: private_key must be an String") if params.dig(:private_key) and !params.dig(:private_key).is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params.dig(: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 |