Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8721731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:16:04+00:00 2026-06-13T07:16:04+00:00

is there a ruby curl library that will allow me to duplicate this request:

  • 0

is there a ruby curl library that will allow me to duplicate this request:

curl -d '<hello xmlns="http://checkout.google.com/schema/2"/>' https://S_MERCHANT_ID:S_MERCHANT_KEY@sandbox.google.com/checkout/api/checkout/v2/request/Merchant/S_MERCHANT_ID

i have tried curb, but their PostField.content class is not cooperating with google’s checkout api. here is the code from my curb request:

c = Curl::Easy.new("https://MY_ID:MY_KEY@sandbox.google.com/checkout/api/checkout/v2/request/Merchant/MY_ID_AGAIN")
c.http_auth_types = :basic
c.username = 'MY_ID'
c.password = 'MY_KEY'
# c.headers["data"] = '<?xml version="1.0" encoding="UTF-8"?><hello xmlns="http://checkout.google.com/schema/2"/>'
c.http_post(Curl::PostField.content('', '<?xml version="1.0" encoding="UTF-8"?><hello xmlns="http://checkout.google.com/schema/2"/>'))
c.perform

i HAVE managed to get it working using ruby’s system command, but im not sure how to handle the response from it.

req = system("curl -d '<hello xmlns=\"http://checkout.google.com/schema/2\"/>' https://MY_ID:MY_KEY@sandbox.google.com/checkout/api/checkout/v2/request/Merchant/MY_ID")

I have been at it for 2 hours now. any help would be greatly appreciated, thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:16:05+00:00Added an answer on June 13, 2026 at 7:16 am

    I figured it out (YAAAAY!)

    if anyone else is having this problem, here is the solution.

    executable commands work fine in the command line, but if you are trying to render the output of an executable command from a controller in rails, make sure you use render :json instead of render :text to print the results.

    for some reason the render :text was only outputting bits and pieces of my command’s output (and driving me insane in the process).

    For those of you trying to integrate with google checkout in rails, here is how you make http requests to google:

    First step: add rest-client to your Gemfile. here is how to do it from the command line:

    $ cd /path/to/your/rails/app
    $ sudo nano Gemfile
    

    Next, add the gem to your gemfile by placing the following somewhere in your Gemfile

    $ gem "rest-client"
    

    next, run bundle install

    $ bundle install
    

    restart your server. if apache2:

    $ sudo service apache2 reload
    

    if webrick:

    $ rails s
    

    then, in your controller (assuming you have rails set up and are able to access a controller from the browser) write the following code:

    $ url = "https://YOUR_GOOGLE_CHECKOUT_MERCHANT_ID:YOUR_GOOGLE_CHECKOUT_KEY@sandbox.google.com/checkout/api/checkout/v2/request/Merchant/YOUR_GOOGLE_CHECKOUT_MERCHANT_ID"
    $ req = RestClient.post(url, '<hello xmlns="http://checkout.google.com/schema/2"/>')
    render :json => req
    

    Please don’t forget to replace YOUR_GOOGLE_MERCHANT_ID with your actual merchant id and YOUR_GOOGLE_CHECKOUT_KEY with your actual google checkout key

    <?xml version="1.0" encoding="UTF-8"?>
    <bye xmlns="http://checkout.google.com/schema/2" serial-number="1dfc3b90-1fa6-47ea-a585-4d5482b6c785" />
    

    (answer courtesy of nexo)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a Ruby library that will allow me to either calculate the checksum
Is there a cURL library for Ruby?
Is there a ruby gem that will format dates relative to the current time?
Is there a Ruby site like this http://python.mirocommunity.org (python videos). This is a great
Is there a Ruby/Rails library that I can generate word clouds (output should be
Is there a Ruby gem which can be used to create a Google Slideshow
Is there a ruby gem or such for MySQL connection pooling that isn't part
In Ruby is there any method that lists all the global variables available at
Expect seems to be a very powerful automation tool: http://www.nist.gov/mel/msid/expect.cfm Is there a Ruby
In Ruby there is an each_cons on Enumerable . It works like this (1..5).each_cons(3)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.