Questions tagged [httparty]

HTTParty is a Ruby gem written by John Nunemaker focused on the consumption of web services and APIs.

HTTParty is a Ruby gem written by John Nunemaker focused on the consumption of web services and APIs. It boasts a very readable DSL and out-of-the-box support for JSON, HTML and XML.

For more information refer to: It's an HTTParty and Everyone Is Invited!

621 questions
0
votes
0 answers

HTTParty gem how to rescue errors

I would like to rescue errors related to all connection errors using httpparty gem (reset by peer,timeout, etc..) Something like: begin response = HTTParty.get('http://somewhere.url', http_proxyaddr: proxy_addr,http_proxyport: proxy_port,…
Jakub Kuchar
  • 1,665
  • 2
  • 23
  • 39
0
votes
1 answer

Rails how to build a custom json request in my helper

I am working with an API and I am trying to post the following request in a helper module ShoppingCartHelper def update_order HTTParty.post("APIURL", :body => { @all_lines.each do |line| :ProductCode =>…
user7954
  • 323
  • 4
  • 12
0
votes
2 answers

Output Raw HTTP Request without Sending in Ruby

I am trying to setup a POST request to a rest api using ruby. What I want to do is to output the raw HTTP request without actually sending the request. I have looked at HTTParty and Net:HTTP, but it seems the only way to output the request is only…
Wahaj Ali
  • 4,093
  • 3
  • 23
  • 35
0
votes
2 answers

Convert Curl command line in Rails

This is my curl command which works nicely in Command line : curl --data @order_new.json \ -H "X-Augury-Token:My_token_goes_here" \ -H "Content-Type:application/json" \ …
Ajay
  • 4,199
  • 4
  • 27
  • 47
0
votes
1 answer

Unable to send post or put parameters using RocketPants client

I am writing an api client using the RocketPants gem and am trying to use HTTParty as included in the gem to read, create, update and destroy resources. Reading and destroying works just fine, but I am facing problems creating and updating resources…
Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115
0
votes
1 answer

Logon failure with Ruby Httparty and Json

i was trying to log in into a site which has the following API: POST https://www.Thesite.com/Account/LogOn post JSON data:{UserName:xxx,Pasword:xxx,SecondFactor:[optional]} save the CookieContainer & header["SecretKey"] to pass for next calls, else…
0
votes
1 answer

How to retrieve the IP address of another website?

I need to retrieve the IP address of some of my websites from a main dashboard in Rails, but I'm not sure how to go about it. Googling so far has only returned answers on how to get the IP address of visitors. I'm using HTTParty to parse the pages,…
mind.blank
  • 4,820
  • 3
  • 22
  • 49
0
votes
1 answer

rails: different methods for different users

I have a location field on my User model with two possible values, Spain and France (maybe more in the future). I need to make API calls for each user but call a different API depending on the user's location (also, parse the response differently).…
joshblour
  • 1,024
  • 10
  • 19
0
votes
1 answer

Can a mysterious html "block" class stop access to specific divs? (Rails / HTTParty)

I am using HTTParty to access and parse certain web pages. Using my usual approach: response = HTTParty.get(url) doc = Nokogiri::HTML(response) doc.css('ul').each do |link| p link end All is going well, until I get to a page which has a class…
Jonathan_W
  • 638
  • 9
  • 24
0
votes
1 answer

Standardising json

I am using HTTParty to call the Flickr API. I get a response but it's escaped. How can I get plain and simple json?> class Flickr require 'httparty' include HTTParty API_KEY = '2e18b933c285b552701e7c6f5bff3aee' SECRET =…
rctneil
  • 7,016
  • 10
  • 40
  • 83
0
votes
1 answer

Rails display JSON from an api GET request

I'm a rails beginner and I'm trying to display a json object I get back from an external api. I'm using HTTParty and I'm almost positive I have that set up correctly. I have a function in my HTTParty class called self.get_all() How would I go…
Cristiano
  • 2,839
  • 8
  • 25
  • 35
0
votes
2 answers

How can I get HTTParty to recognize ":footer" and ":collector" parameters?

I received the following code from a development team: curl -u EMAILADDRESS:PASSWORD -d "sender=NAME &message=[Invite Link]&collector=COLLECTOR&subject=Test Invite&footer=My Custom Text [Unsubscription Link]" I have been told that the…
Luigi
  • 5,443
  • 15
  • 54
  • 108
0
votes
1 answer

HTTParty not setting configuration parameters

I'm using the HTTParty gem to post a request on another website of mine. In my dedicated class I define some defaults according to HTTParty's documentation: require 'httparty' class Notifier include HTTParty base_uri "my_awesome_site.com" …
Miotsu
  • 1,776
  • 18
  • 30
0
votes
1 answer

How do I handle, parse, a colon in the url with httparty and json

I'm trying to parse the Mochi Media API on my site. Unfortunately, they make use of colons in their API URLs.... http://feedmonger.mochimedia.com/feeds/query/?q=(recommendation:>=0) and category:action&partner_id=XXXX The question is, using…
dnyce
  • 415
  • 1
  • 6
  • 20
0
votes
3 answers

HTTPArty/Rails: How to handle the Response array

I am calling an API that returns an array of JSON objects and I cant seem to properly access each element. This is a sample return value of the API…
user2158382
  • 4,430
  • 12
  • 55
  • 97