Class: SBF::Client::PromoEndpoint

Inherits:
EntityEndpoint show all
Defined in:
lib/stbaldricks/endpoints/promo.rb

Instance Attribute Summary

Attributes inherited from EntityEndpoint

#orig_target_class

Instance Method Summary collapse

Methods inherited from EntityEndpoint

#aggregate, #create, #delete, #find, #find_first, #get, #initialize, #save, #update

Constructor Details

This class inherits a constructor from SBF::Client::EntityEndpoint

Instance Method Details

#render_template(body, donation_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/stbaldricks/endpoints/promo.rb', line 6

def render_template(body, donation_id)
  response = SBF::Client::Api::Request.post_request("#{base_uri}/render_email", body: body, donation_id: donation_id)

  if ok?(response)
    data = response.body
  else
    error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
  end

  SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error)
end

#send_promo_email(recipient, body, donation_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/stbaldricks/endpoints/promo.rb', line 18

def send_promo_email(recipient, body, donation_id)
  response = SBF::Client::Api::Request.post_request("#{base_uri}/send_promo_email", recipient: recipient, body: body, donation_id: donation_id)

  if ok?(response)
    data = response.body
  else
    error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
  end

  SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error)
end