Class: Clearsale::Analysis

Inherits:
Object
  • Object
show all
Defined in:
lib/clearsale/analysis.rb

Class Method Summary collapse

Class Method Details

.clear_connectorObject



18
19
20
# File 'lib/clearsale/analysis.rb', line 18

def self.clear_connector
  @connector = nil
end

.connectorObject



3
4
5
# File 'lib/clearsale/analysis.rb', line 3

def self.connector
  @connector ||= Clearsale::Connector.build
end

.get_order_status(order_id) ⇒ Object



22
23
24
25
# File 'lib/clearsale/analysis.rb', line 22

def self.get_order_status(order_id)
  request = {'orderID' => order_id}
  OrderResponse.build_from_update(connector.do_request('GetOrderStatus', request))
end

.send_order(order_hash, payment_hash, user_hash) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/clearsale/analysis.rb', line 7

def self.send_order(order_hash, payment_hash, user_hash)
  order = Object.new(order_hash)
  payment = Object.new(payment_hash)
  user = Object.new(user_hash)

  order_xml = Clearsale::Order.to_xml(order, payment, user)
  request = {"xml" => order_xml}

  OrderResponse.build_from_send_order(connector.do_request('SendOrders', request))
end