Class: GlobalCollect::Requests::Base
- Inherits:
-
Object
- Object
- GlobalCollect::Requests::Base
- Defined in:
- lib/global_collect/requests/base.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#suggested_response_mixins ⇒ Object
readonly
Returns the value of attribute suggested_response_mixins.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#default_xml_encoding_options ⇒ Object
WDL §3.1.
-
#initialize(action) ⇒ Base
constructor
A new instance of Base.
-
#to_xml ⇒ Object
WDL §4.
Constructor Details
#initialize(action) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 |
# File 'lib/global_collect/requests/base.rb', line 7 def initialize(action) @action = action @suggested_response_mixins ||= [] @version = GlobalCollect::default_api_version end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
3 4 5 |
# File 'lib/global_collect/requests/base.rb', line 3 def action @action end |
#suggested_response_mixins ⇒ Object (readonly)
Returns the value of attribute suggested_response_mixins.
5 6 7 |
# File 'lib/global_collect/requests/base.rb', line 5 def suggested_response_mixins @suggested_response_mixins end |
#version ⇒ Object
Returns the value of attribute version.
4 5 6 |
# File 'lib/global_collect/requests/base.rb', line 4 def version @version end |
Instance Method Details
#default_xml_encoding_options ⇒ Object
WDL §3.1
19 20 21 |
# File 'lib/global_collect/requests/base.rb', line 19 def { :encoding => "UTF-8" } end |
#to_xml ⇒ Object
WDL §4
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/global_collect/requests/base.rb', line 24 def to_xml xml = Builder::XmlMarkup.new xml.instruct!(:xml, ) xml.tag!("XML") do |xml_node| xml_node.tag!("REQUEST") do |req_node| req_node.tag!("ACTION", @action) req_node.tag!("META") do || .tag!("IPADDRESS" , GlobalCollect::ip_address ) if GlobalCollect::authentication_scheme == :ip_check .tag!("MERCHANTID", GlobalCollect::merchant_id) .tag!("VERSION" , version) end req_node.tag!("PARAMS") do |params_node| yield(params_node) end end end xml.target! end |