Sha256: 4a8dc422633ecf1a850b36be631b6e2a5fbd6d94a91021da23a36c5cfc740026
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
require "rest-client" require "json" module SendcloudClient API_BASE = 'https://api.sendcloud.net/apiv2' class Error < StandardError; end def self.setup yield self end class << self attr_accessor :api_user, :api_key end def self.sendmail(options = {}) return if options[:to].length == 0 uri = "#{API_BASE}/mail/send" res = RestClient.post uri, apiUser: SendcloudClient.api_user, apiKey: SendcloudClient.api_key, to: options[:to], from: options[:from], fromName: options[:fromName], subject: options[:subject], html: options[:html] JSON.parse(res) rescue nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sendcloud_client-0.0.3 | lib/sendcloud_client.rb |