Ruby on Rails Wednesday, May 31, 2017

Hassan is correctly encouraging you towards the higher-level abstractions, like a Gem specifically written for this purpose.


If you really want to know how to make outgoing http requests, the answer is the Net::HTTP Ruby library, which is documented here:


But as Hassan said if there's a higher level abstraction, like a Gem, prefer that to writing your own low-level code.

But as a ruby developer the Net::HTTP Ruby library is at the very least something you should learn about and play around with, even if you don't actually need it for this immediate purpose.
-Jason



On May 31, 2017, at 1:39 PM, Joe Guerra <JGuerra@jginfosys.com> wrote:

Ok, I'll try the gem.

How about passing the parameters in the url?  and opening up the canada post site with that?

Thanks,
Joe

On Wednesday, May 31, 2017 at 1:36:20 PM UTC-4, Hassan Schroeder wrote:
On Wed, May 31, 2017 at 10:27 AM, Joe Guerra <JGu...@jginfosys.com> wrote:
> Hmm, which gem would allow you to perform http requests within Rails?  I
> would like to send a request to the canadapost website and pass it some
> parameters and return a shipping total.
>
> I do believe there is a canadapost gem, but I'm not sure how upto date it
> is.

Searching for `ruby gem canada post` turns up more than one -- why
don't you just try them and see which you prefer?

Similarly `ruby gem http` will show you some possibilities if you want
to roll your own solution. See also:
https://ruby-doc.org/stdlib-2.4.1/libdoc/net/http/rdoc/index.html

HTH!
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/80f27a88-f7ca-4bc8-a66c-380da41a4ccf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

If you'd like to reply by encrypted email you can find my public key on jasonfleetwoodboldt.com (more about setting GPG: https://gpgtools.org

No comments:

Post a Comment