class XmlConv::State::Login

Constants

VIEW

Public Class Methods

new(session, model) click to toggle source
Calls superclass method
# File lib/xmlconv/state/login.rb, line 13
def initialize(session, model)
  if session.request_method.eql?('POST')
    xml_src = session.post_content
    SBSM.debug "XmlConv::State::Login POST params were #{session.request_params}"
    SBSM.debug " xml_src #{xml_src.encoding} now #{xml_src}"
    unless xml_src.length == 0
      transaction = XmlConv::Util::Transaction.new
      transaction.domain      = session.server_name
      transaction.input       = xml_src
      transaction.reader      = 'SunStoreBdd'
      transaction.writer      = XmlConv::CONFIG.writer
      transaction.destination = XmlConv::Util::Destination.book(XmlConv::CONFIG.destination)
      transaction.partner     = File.basename(session.request_path)
      transaction.origin      = "http://#{session.remote_ip}"
      transaction.postprocs.push(['Soap', 'update_partner'])
      transaction.postprocs.push(['Bbmb2', 'inject', XmlConv::CONFIG.bbmb_url, 'customer_id'])
      @transaction = transaction
      res = session.app.execute_with_response(transaction)
    end
  end
  super
end

Public Instance Methods

login() click to toggle source
# File lib/xmlconv/state/login.rb, line 45
def login
        if(@session.login)
                Transactions.new(@session, @session.persistence_layer.transactions)
        else
                self
        end
end
to_html(context) click to toggle source
Calls superclass method
# File lib/xmlconv/state/login.rb, line 35
def to_html(context)
  if @session.request_method.eql?('POST')
    string = StringIO.new
    @transaction.response.write(string, 2)
    string.rewind
    string.read
  else
    super(context)
  end
end
transaction() click to toggle source
# File lib/xmlconv/state/login.rb, line 52
def transaction
        if((id = @session.user_input(:transaction_id)) \
                && (transaction = @session.persistence_layer.transaction(id)))
                TransactionLogin.new(@session.persistence_layer, transaction)
        else
                self
        end
end