Sha256: e6a649d1c00c884bd774805bd8632df14a4400701d333c25603f509f0d035338

Contents?: true

Size: 822 Bytes

Versions: 13

Compression:

Stored size: 822 Bytes

Contents

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('https://api.stackexchange.com/2.2/questions?site=stackoverflow')
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'
end

options = {
  :body => {
    :pear => { # your resource
      :foo => '123', # your columns/data
      :bar => 'second',
      :baz => 'last thing'
    }
  }
}

pp Partay.post('/pears.xml', options)

Version data entries

13 entries across 12 versions & 4 rubygems

Version Path
alloy_sdk-0.1.0 vendor/bundle/ruby/3.0.0/gems/httparty-0.13.1/examples/basic.rb
alloy_sdk-0.1.0 vendor/bundle/ruby/2.6.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.9 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.8 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.7 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.6 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.5 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.4 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.3 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.2 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
allegro_api_client-0.0.1 gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb
httparty-0.13.1 examples/basic.rb