class MessageQuickly::Messaging::ReceiptTemplateAttachment

Attributes

address[RW]
adjustments[RW]
currency[RW]
elements[RW]
order_number[RW]
order_url[RW]
payment_method[RW]
recipient_name[RW]
summary[RW]
timestamp[RW]

Public Class Methods

new(params = {}) click to toggle source
Calls superclass method
# File lib/message_quickly/messaging/receipt_template_attachment.rb, line 7
def initialize(params = {})
  self.elements ||= []
  self.address ||= Receipt::Address.new
  self.summary ||= Receipt::Summary.new
  self.adjustments ||= []
  params['template_type'] ||= 'receipt'
  super(params)
end

Public Instance Methods

build_address() { |address| ... } click to toggle source
# File lib/message_quickly/messaging/receipt_template_attachment.rb, line 20
def build_address
  yield address
end
build_adjustment() { |adjustment| ... } click to toggle source
# File lib/message_quickly/messaging/receipt_template_attachment.rb, line 28
def build_adjustment
  adjustments << Receipt::Adjustment.new.tap { |adjustment| yield adjustment }
end
build_element() { |element| ... } click to toggle source
# File lib/message_quickly/messaging/receipt_template_attachment.rb, line 16
def build_element
  elements << Receipt::Element.new.tap { |element| yield element }
end
build_summary() { |summary| ... } click to toggle source
# File lib/message_quickly/messaging/receipt_template_attachment.rb, line 24
def build_summary
  yield summary
end
to_hash() click to toggle source
# File lib/message_quickly/messaging/receipt_template_attachment.rb, line 32
def to_hash
  {
    type: type,
    payload: {
      template_type: template_type,
      recipient_name: recipient_name,
      order_number: order_number,
      currency: currency,
      payment_method: payment_method,
      order_url: order_url,
      timestamp: timestamp,
      elements: elements.collect { |element| element.to_hash },
      address: address.to_hash,
      summary: summary.to_hash,
      adjustments: adjustments.collect { |adjustment| adjustment.to_hash }
    }
  }
end