httparty

HTTPS and HTTParty - Timeout and EOF

Hi all, I'm trying to post something to an HTTPS resource, but it seems it doesn't work. My code look something like this: require 'httparty' class MyClass include HTTParty base_uri "https://mydomain.com:8085/search" basic_auth 'admin', 'changeme' format :xml def mymethod self.class.post('/job', :query => ...

How can I use httparty with UTF-8 encoding

Hi. I have url like this http://example.com/tag/София/new.json and I want to make get request with HTTParty, but when I do HTTPArty.get "http://example.com/tag/София/new.json" I get: URI::InvalidURIError at / bad URI(is not URI?): link here Any ideas how to handle this ? Thanks in advance, Mitko Kostov. ...

Trying to connect to a "digest authentication" webservice using HTTParty or Net:HTTP (or etc)

I have been trying to connect to a web service that is using digest authentication. I am able to connect in Safari using user:[email protected]/endpoint I have tried in Ruby and Rails to connect using HTTParty and Net:HTTP using the "basic"auth" options, but have not had any luck. Wondering if the HTTParty/Net:HTTP "basic_au...

Use HTTParty methods in a subclass

I'm trying to write an API wrapper in ruby and am stumped on how I can call HTTParty methods from a subclass. For instance, I want the user to create a connection to the api and then be able to query results from subclasses. module ApiWrapper class Connection include HTTParty base_uri '...' def initialize( ...

how to mimic a curl action with httparty

I have loved using HTTParty in the past, but at the moment I'm coming up against a problem I haven't been able to figure out yet. The API I'm interacting with is successfully contacted like so: curl -X PUT -d 'id=1175600;status=0' http://www.lingq.com/api_v2/ru/lingqs/?apikey=[long-key] All other functions in this API I haven't had t...

send json object with httparty

Hi there, I'm trying to implement the in App purchase from within my iPhone app. To verify the receipt I need to send a json object to the iTunes server. Im trying to do this with the httparty plugin: require 'httparty' class ItunesVerification include HTTParty base_uri 'https://sandbox.itunes.apple.com' default_params :output =...

How can I get httparty to work with Glassfish? Getting 400 BadRequest response.

Using: Glassfish v3. Httparty 0.6.1 & 0.5.2. I'm starting glassfish using "mvn glassfish:run" (maven-glassfish-plugin) Everything works in the application. This url works in RESTClient, cURL, and in the browser, but when I try with httpparty at the command line, I get this: $> httparty -v "http://localhost:8080/parakeet/tickets/111"...

OAuth and HTTParty

Is it possible to use OAuth with HTTParty? I'm trying to do this API call, but, contradictory to the documentation, it needs authentication. Before you say "Use a Twitter-specific Gem", hear me out--I've tried. I've tried twitter, grackle, and countless others, but none support this specific API call. So, I've turned to HTTParty. So, h...

Get individual JSON objects with Ruby.

Forgive me if this is a really stupid question, but how do I get individual items from a JSON GET with HTTParty? For example: require 'rubygems' require 'httparty' require 'pp' player = pp HTTParty.get('http://api.dribbble.com/players/1') will return this: {"name"=>"Dan Cederholm", "avatar_url"=> "http://dribbble.com/system/users...

ruby httparty get response url or id after post

How can I get the response url or id from a rails project with httparty in a separate script after doing a post? ruby script: HTTParty.post('http://localhost:3000/change_logs', parameters) response.body and all the others ones do not show the url and the response id ...

How to consume Rest API with complex objects using Httparty and Ruby

I am trying to implement call this API method in Ruby https://zferral.com/api-docs/affiliate#aff-create-usage-example which expects this object: { "affiliate" : { "email" : "[email protected]", "send_user_email" : "1" }} Using a Httparty class, I call this: result = self.class.post("/api/#{@apikey}/affiliate/create....

Is it possible to work with HTTParty request results as an object

Hi guys, I wonder if it possible to work with HTTParty (http://github.com/jnunemaker/httparty) request results as an object. Currently i use string keys to access to values of result: result["imageurl"] or result["address"]["street"] If i were in JavaScript I could simply use: result.imageurl or result.address.street Regards, Alexe...

Can someone provide an example for how to post XML using HTTParty and Ruby on Rails?

Hi All, I need to post some xml to a webservice and I'm trying to use HTTParty. Can someone provide an example as to how I go about doing so? Here is the format of the XML I need to post: <Candidate xmlns="com.mysite/2010/10/10" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; <FirstName></FirstName> <LastName></LastName> <Emai...

Error patterns in rails, raise "text evaluting to RuntimeError" or raise MyModule::CustomError?

Q: The title is perhaps too big of question and the answer probably is "it depends"? However, providing some practical cases/examples should help developers, like myself, recognize when to apply what. I'll start out with my particular situation. Would you or would you not use custom error classes? Why/why not? Other examples as the one...

Exception when using httparty for itunes verification

Hi all, Here is a piece of code I wrote to implement itunes_verification. http://gist.github.com/raw/622038/b32accd30e86f7c714f2cffefd19857f558c8d97/gistfile1.rb ItunesVerification.verify_apple_receipt("wefwfrw") But, its always throwing {"exception"=>"java.lang.NullPointerException", "status"=>21002} from the itunes server. "java.l...

Can I consume a SOAP web service using httparty or weary?

I am currently working on a ROR project that needs to consume some SOAP based web services. What I know about consuming web services borders on the 'dangerous'. The example that the site provides is using asp with XMLHTTP to send what appears to be some XML wrapped in a SOAP envelope. Included in the XML is the authentication informat...