Class: Wirecard::Elastic::Request::Body::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/wirecard/elastic/request/body/builder.rb,
lib/wirecard/elastic/request/body/builder/xml.rb

Defined Under Namespace

Classes: Xml

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin, template) ⇒ Builder

set the template and the origin instance the origin will be used to setup the params by using the different datas of the class asking for a body content



15
16
17
18
# File 'lib/wirecard/elastic/request/body/builder.rb', line 15

def initialize(origin, template)
  @origin   = origin
  @template = template
end

Instance Attribute Details

#originObject (readonly)

Returns the value of attribute origin.



9
10
11
# File 'lib/wirecard/elastic/request/body/builder.rb', line 9

def origin
  @origin
end

#templateObject (readonly)

Returns the value of attribute template.



9
10
11
# File 'lib/wirecard/elastic/request/body/builder.rb', line 9

def template
  @template
end

Instance Method Details

#paramsObject

generation of the parameters used in the template through the origin instance



27
28
29
# File 'lib/wirecard/elastic/request/body/builder.rb', line 27

def params
  Params.const_get(template.capitalize).new(origin).deliver!
end

#to_xmlObject

conversion into XML format



21
22
23
# File 'lib/wirecard/elastic/request/body/builder.rb', line 21

def to_xml
  Xml.new(template, params).build!
end