Sha256: 6a22304fd7c3c8177fa08fcc817f094e8a0a29a8e8fad414f38523c0943f7a41

Contents?: true

Size: 611 Bytes

Versions: 7

Compression:

Stored size: 611 Bytes

Contents

module SugarCRM
  
class Request

  attr :request, true
  attr :url, true
  attr :method, true
  attr :json, true
  attr :http_method

  def initialize(url, method, json, debug=false)
    @url      = url
    @method   = method
    @json     = json

    @request  = 'method=' << @method.to_s
    @request << '&input_type=JSON'
    @request << '&response_type=JSON'
    @request << '&rest_data=' << @json
    
    if debug
      puts "#{method}: Request:"
      pp @request 
      puts "\n"
    end
    self
  end
  
  def length
    self.to_s.length
  end
  
  def to_s
    URI.escape(@request)
  end
  
end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sugarcrm-0.8.2 lib/sugarcrm/request.rb
sugarcrm-0.8.1 lib/sugarcrm/request.rb
sugarcrm-0.8.0 lib/sugarcrm/request.rb
sugarcrm-0.7.9 lib/sugarcrm/request.rb
sugarcrm-0.7.8 lib/sugarcrm/request.rb
sugarcrm-0.7.7 lib/sugarcrm/request.rb
sugarcrm-0.7.2 lib/sugarcrm/request.rb