Class: Carousel::Request

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

Direct Known Subclasses

Inventory, Order

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Request

Returns a new instance of Request.



6
7
8
# File 'lib/carousel/request.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#build_user(xml) ⇒ Object



21
22
23
24
# File 'lib/carousel/request.rb', line 21

def build_user(xml)
  xml.user @client.username
  xml.password @client.password
end

#construct_xml(type) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/carousel/request.rb', line 10

def construct_xml(type)
  @client.type = type
  xml = ::Builder::XmlMarkup.new :indent => 2
  xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
  xml.tag! type do
    yield(xml) if block_given?
  end
  xml.target!
end