Module: SendcloudClient
- Defined in:
- lib/sendcloud_client.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- API_BASE =
'https://api.sendcloud.net/apiv2'
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.api_user ⇒ Object
Returns the value of attribute api_user.
Class Method Summary collapse
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
13 14 15 |
# File 'lib/sendcloud_client.rb', line 13 def api_key @api_key end |
.api_user ⇒ Object
Returns the value of attribute api_user.
13 14 15 |
# File 'lib/sendcloud_client.rb', line 13 def api_user @api_user end |
Class Method Details
.sendmail(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sendcloud_client.rb', line 16 def self.sendmail( = {}) return if [:to].length == 0 uri = "#{API_BASE}/mail/send" res = RestClient.post uri, apiUser: SendcloudClient.api_user, apiKey: SendcloudClient.api_key, to: [:to], from: [:from], fromName: [:from], subject: [:from], html: [:from] JSON.parse(res) rescue nil end |
.setup {|_self| ... } ⇒ Object
8 9 10 |
# File 'lib/sendcloud_client.rb', line 8 def self.setup yield self end |