Class: Burlap::Call

Inherits:
Object show all
Defined in:
lib/burlap/call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Call

Returns a new instance of Call.



5
6
7
8
9
10
11
12
# File 'lib/burlap/call.rb', line 5

def initialize params={}
  params.each do |key, value|
    method = :"#{key}="
    send(method, value) if respond_to?(method)
  end

  validate_attributes
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



3
4
5
# File 'lib/burlap/call.rb', line 3

def arguments
  @arguments
end

#headersObject

Returns the value of attribute headers.



3
4
5
# File 'lib/burlap/call.rb', line 3

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



3
4
5
# File 'lib/burlap/call.rb', line 3

def method
  @method
end

Instance Method Details

#to_burlapObject



22
23
24
25
26
27
28
29
# File 'lib/burlap/call.rb', line 22

def to_burlap
  # todo: handle headers
  contents = [Burlap::Node.new(:name => "method", :value => method).to_burlap]
  contents += arguments.map do |arg|
    arg.to_burlap
  end
  Burlap::Node.new(:name => "burlap:call", :value => contents.join("")).to_burlap
end