Class: Sendhub::Client
- Inherits:
-
Object
- Object
- Sendhub::Client
- Defined in:
- lib/sendhub/http.rb,
lib/sendhub/client.rb
Constant Summary collapse
- VERSION =
'0.1.5'
Instance Method Summary collapse
- #get(options = {}) ⇒ Object
-
#initialize(config = nil) ⇒ Client
constructor
A new instance of Client.
- #send_email(options = {}) ⇒ Object
Constructor Details
#initialize(config = nil) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 |
# File 'lib/sendhub/client.rb', line 6 def initialize(config=nil) config[:host] ||= 'api.sendhub.net' @uri = URI.parse('http://'+config[:host]+'/') @api_key = config[:api_key] @secret_key = config[:secret_key] puts "SendhubRubyClient: #{@uri}, #{@api_key}" end |
Instance Method Details
#get(options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/sendhub/client.rb', line 23 def get(={}) res = _get('/email/' + [:email_id]) Sendhub::Response.new(res) end |
#send_email(options = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/sendhub/client.rb', line 16 def send_email(={}) res = _post '/emails', nil, #res.merge!('redirect_url' => @uri.to_s+"merchants/#{@merchant_id}/transactions/#{res['id']}") #res.merge!('secret_token' => securely_hash_data("#{res['id']}-#{res['amount']}")) Sendhub::Response.new(res) end |