Class: Docdata::Order::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/docdata/order/request.rb

Overview

Base class for XML requests to Docdata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Request

Returns a new instance of Request.



13
14
15
# File 'lib/docdata/order/request.rb', line 13

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/docdata/order/request.rb', line 11

def options
  @options
end

Instance Method Details

#to_sObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/docdata/order/request.rb', line 17

def to_s
  builder = Builder::XmlMarkup.new

  # Merchant credentials.
  builder.merchant(name: merchant_name, password: merchant_password)

  build_request(builder)

  # This element contains information about the application contacting the webservice.
  # This info is useful when debugging troubleshooting technical integration issues.
  builder.integrationInfo do |integration|
    # The name of the plugin used to contact this webservice.
    integration.webshopPlugin("docdata-order")
    # The version of the plugin used to contact this webservice.
    integration.webshopPluginVersion(Docdata::Order::VERSION)
    # The name of the plugin creator used to contact this webservice.
    integration.integratorName("Kentaa")
    # The programming language used to contact this webservice.
    integration.programmingLanguage("Ruby #{RUBY_VERSION}")
    # The operating system from which this webservice is contacted.
    integration.operatingSystem(RUBY_PLATFORM)
    # The full version number (including minor e.q. 1.3.0)
    # of the xsd which is used during integration. DDP can make minor
    # (non-breaking) changes to the xsd. These are reflected in a minor
    # version number. It can therefore be useful to know if a different
    # minor version of the xsd was used during merchant development than
    # the one currently active in production.
    integration.ddpXsdVersion(Docdata::Order::Client::DDP_VERSION)
  end

  builder.target!
end