Class: Hubspot::Api::TransactionEmail::SingleSend
- Inherits:
-
Object
- Object
- Hubspot::Api::TransactionEmail::SingleSend
- Defined in:
- lib/hubspot/api/transaction_email/single_send.rb
Defined Under Namespace
Classes: KeyError
Instance Attribute Summary collapse
-
#hapikey ⇒ Object
Returns the value of attribute hapikey.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hapikey) ⇒ SingleSend
constructor
A new instance of SingleSend.
-
#post(options = {}) ⇒ Object
TODO: DWE: if RUBY_VERSION > “2.3” See – dig(:message, :to).
Constructor Details
#initialize(hapikey) ⇒ SingleSend
Returns a new instance of SingleSend.
11 12 13 |
# File 'lib/hubspot/api/transaction_email/single_send.rb', line 11 def initialize(hapikey) @hapikey = hapikey end |
Instance Attribute Details
#hapikey ⇒ Object
Returns the value of attribute hapikey.
9 10 11 |
# File 'lib/hubspot/api/transaction_email/single_send.rb', line 9 def hapikey @hapikey end |
Class Method Details
.post(options) ⇒ Object
16 17 18 |
# File 'lib/hubspot/api/transaction_email/single_send.rb', line 16 def post() SingleSend.new(Hubspot.configuration.hapikey).post() end |
Instance Method Details
#post(options = {}) ⇒ Object
TODO: DWE: if RUBY_VERSION > “2.3” See – dig(:message, :to)
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hubspot/api/transaction_email/single_send.rb', line 22 def post( = {}) raise ArgumentError, "EmailId: Required Error" if [:emailId].blank? raise ArgumentError, "To: Required Error" if [:message].blank? raise KeyError, "Hubspot Api Key Error" if hapikey.blank? response = Hubspot.post("/email/public/v1/singleEmail/send?hapikey=#{hapikey}", ) if response[:status] == "200" response else raise StandardError, "Something went wrong!" end end |