Class: Docdata::Order::Client
- Inherits:
-
Object
- Object
- Docdata::Order::Client
- Defined in:
- lib/docdata/order/client.rb
Overview
Client for the Docdata Order API.
Constant Summary collapse
- XMLNS_DDP =
"http://www.docdatapayments.com/services/paymentservice/1_3/"- DDP_VERSION =
"1.3"
Instance Method Summary collapse
- #create(options = {}) ⇒ Object
-
#initialize(name, password, options = {}) ⇒ Client
constructor
A new instance of Client.
- #start(options = {}) ⇒ Object
- #status(options = {}) ⇒ Object
Constructor Details
#initialize(name, password, options = {}) ⇒ Client
Returns a new instance of Client.
12 13 14 |
# File 'lib/docdata/order/client.rb', line 12 def initialize(name, password, = {}) = .merge(merchant: { name: name, password: password }) end |
Instance Method Details
#create(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/docdata/order/client.rb', line 16 def create( = {}) params = .merge() response = client.call(:create, message: CreateRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) raise Exception, response unless response.success? CreateResponse.new(params, response) end |
#start(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/docdata/order/client.rb', line 26 def start( = {}) params = .merge() response = client.call(:start, message: StartRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) raise Exception, response unless response.success? StartResponse.new(params, response) end |
#status(options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/docdata/order/client.rb', line 36 def status( = {}) params = .merge() response = client.call(:status_extended, message: ExtendedStatusRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) raise Exception, response unless response.success? ExtendedStatusResponse.new(params, response) end |