Class: Epics::HeaderRequest
- Inherits:
-
Object
- Object
- Epics::HeaderRequest
- Extended by:
- Forwardable
- Defined in:
- lib/epics/header_request.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #build(options = {}) ⇒ Object
-
#initialize(client) ⇒ HeaderRequest
constructor
A new instance of HeaderRequest.
Constructor Details
#initialize(client) ⇒ HeaderRequest
Returns a new instance of HeaderRequest.
5 6 7 |
# File 'lib/epics/header_request.rb', line 5 def initialize(client) self.client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/epics/header_request.rb', line 3 def client @client end |
Instance Method Details
#build(options = {}) ⇒ Object
11 12 13 14 15 16 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 |
# File 'lib/epics/header_request.rb', line 11 def build( = {}) [:with_bank_pubkey_digests] = true if [:with_bank_pubkey_digests].nil? Nokogiri::XML::Builder.new do |xml| xml.header(authenticate: true) { xml.static { xml.HostID host_id xml.Nonce [:nonce] if [:nonce] xml.Timestamp [:timestamp] if [:timestamp] xml.PartnerID partner_id xml.UserID user_id xml.Product(client.product_name, 'Language' => client.locale) xml.OrderDetails { xml.OrderType [:order_type] xml.OrderAttribute [:order_attribute] xml.StandardOrderParams { build_attributes(xml, [:order_params]) } if [:order_params] build_attributes(xml, [:custom_order_params]) if [:custom_order_params] } xml.BankPubKeyDigests { xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: 'http://www.w3.org/2001/04/xmlenc#sha256') xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: 'http://www.w3.org/2001/04/xmlenc#sha256') } if [:with_bank_pubkey_digests] xml.SecurityMedium '0000' xml.NumSegments [:num_segments] if [:num_segments] } xml.mutable { build_attributes(xml, [:mutable]) } if [:mutable] } end.doc.root end |