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, name, promo) ⇒ Object



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

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

  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(donation_id, name, recipient, body, ecard_send_date = nil, ecard_confirmation_email = nil) ⇒ Object

rubocop:disable Metrics/ParameterLists



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/stbaldricks/endpoints/promo.rb', line 19

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

  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