Module: ObiWan::XmlClient::RegisterOfferSubscription

Defined in:
lib/obi-wan/messages.rb

Class Method Summary collapse

Class Method Details

.obi_request(offer_subscription) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/obi-wan/messages.rb', line 83

def self.obi_request(offer_subscription)
  os = offer_subscription
  builder = Nokogiri::XML::Builder.new do
    request('xmlns' => 'http://biz.aol.com/schema/2006-12-18') { 
      registerOfferSubscription {
        orderRequests {
          OrderRequest {
            offerId             os.offer_id

            # event_source is a unique order id, non numeric if desired
            # can be something like timestamp-userid-random()
            eventSource         os.event_source
            paymentInstrumentId os.payment_instrument_id
            contactEmail        os.contact_email
            promoCode           os.promo_code
            tosAcceptedDate     os.tos_accepted_date
            tosName             os.tos_name
          }
        }
      }
    }
  end.doc.to_xml
end