Skip to content
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@jnunemaker @kalmanh @gmccue @grempe
28 lines (23 sloc) 807 Bytes
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')
require 'pp'
# You can also use post, put, delete, head, options in the same fashion
response = HTTParty.get('')
puts response.body, response.code, response.message, response.headers.inspect
# An example post to a minimal rails app in the development environment
# Note that "skip_before_filter :verify_authenticity_token" must be set in the
# "pears" controller for this example
class Partay
include HTTParty
base_uri 'http://localhost:3000'
options = {
body: {
pear: { # your resource
foo: '123', # your columns/data
bar: 'second',
baz: 'last thing'
pp'/pears.xml', options)
You can’t perform that action at this time.