class Cuenote::Api::Command

Public Class Methods

new(command, params={}) click to toggle source
# File lib/cuenote/api/command.rb, line 5
def initialize(command, params={})
  @command, @params = [command, params]
end

Public Instance Methods

build(id) click to toggle source
# File lib/cuenote/api/command.rb, line 13
def build(id)
  build_command @command, id, @params
end
builder() click to toggle source
# File lib/cuenote/api/command.rb, line 9
def builder
  @builder ||= ::Builder::XmlMarkup.new
end

Private Instance Methods

build_command(command, id, params) click to toggle source
# File lib/cuenote/api/command.rb, line 19
def build_command command, id, params
  options = {}
  options[:id] = id if id
  options[:command] = command
  if params && params.size > 0
    builder.execute options do |exec|
      exec.parameter do |parameter|
        params.each do |key, val|
          eval "parameter.#{key} \"#{val}\""
        end
      end
    end
  else
    builder.execute options
  end
end