Sha256: 6c6b427fc5ed84009c553752082ddcd20c6ec62eaa20590efd2347e01bfb04c9

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

module UEncode
  class Request
    include HTTParty

    base_uri "https://www.uencode.com"
    format :xml
    
    def initialize(job)
      @job = job
    end

    def send
      response = self.class.put "/jobs?version=300", :body => @job.to_xml
      parse_response response
    end

    private
    def parse_response(response_xml)
      doc      = Nokogiri::XML response_xml.body
      code     = doc.xpath("//code").text
      message  = doc.xpath("//message").text
      jobid    = doc.xpath("//jobid").text
      userdata = doc.xpath("//userdata").text

      Response.new(
        :code     => code,
        :message  => message,
        :jobid    => jobid,
        :userdata => userdata
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uencode-0.0.3 lib/uencode/request.rb
uencode-0.0.2 lib/uencode/request.rb
uencode-0.0.1 lib/uencode/request.rb