Using Phaxio with Rails 3.1 app - ruby-on-rails

I am trying to use the Phaxio API to include the ability to send faxes to customers from my Rails app, however I am having difficulty trying to implement it. I know Phaxio is new and there doesn't seem to be much on it except for what is provided by their online docs, which don't really cover too much and have no examples using rails.
From what I can gather from their docs is that I need to send a request to https://api.phaxio.com/v1/send along with some parameters. In their example they use curl to do this but how would I do this from a rails controller? Is their any helper libraries out there for this or will I have to write it from scratch? I might be swinging in the dark here but any help on this subject matter would be greatly appreciated.
Thanks

I just sent over an email to you, but I'll post some example code here as well. We're currently working on a Ruby helper for Phaxio, but here's some code that should help you get started in the mean time.
You'll need to gem install mime-types first.
http://pastebin.com/jfTLn6Bq
-Josh Nankin
Co-Founder, Phaxio

Related

How to use rails gem to connect to API?

I'm trying to connect my RoR app to the api at this website https://www.humanapi.co
There is a gem available here, https://github.com/humanapi/humanapi, that is supposed to make the process easy. I have read through the documentation several times Unfortunately, because I am new to RoR and web development in general, I'm not exactly sure how to implement this. Any help you can give is greatly appreciated!
Specifically: It says to configure the initilizer using these values..
HumanApi.config do |c|
c.app_id = ENV['HUMANAPI_KEY']
c.query_key = ENV['HUMANAPI_SECRET']
end
I understand this in concept, i have used omniauth etc before. But do I need to create another initializer or just use an existing one?
and finally, this is what i don't understand the most...
humanizable :get_the_token
def get_the_token
# the code to reach the token
"# the code to reach the token
I'm at a complete loss with that, how would i get the token? here is the documentation for web access to the api (which i've read a lot) http://hub.humanapi.co/docs/connect-web-guide
Well, it's not your fault, the documentation of the gem is poorly written and doesn't show what exactly is going on or what is it even doing
This gem is also outdated, created 3 years ago and there are no issues or updates or anything. you better go looking for a different gem that do the functionality you want

Using Photobucket api with Ruby on Rails

I am trying to use Photobucket(API) as a image uploading option in my website.
Is there any available gem to do this? or should i use things like REST to achieve this?
Please suggest.
Thanks,
Balan
The only thing I really found was this https://bitbucket.org/photobucket/api-ruby/src/7b69e473fb9fd5b4d37e2ad7f266500e45ef524b/example.rb?at=default. They are using the oauth rubygem to talk to photobucket, still a lot of manual process involved. It is also still using REST.
I would say the easiest way it going ahead and using REST following http://pic.photobucket.com/dev_help/WebHelpPublic/PhotobucketPublicHelp.htm and http://pic.photobucket.com/dev_help/WebHelpPublic/Content/FAQ/FAQOverview.htm to get you started.
I haven't done a REST client in ruby but this gem looks pretty good https://github.com/rest-client/rest-client.
I would recommend, assuming you have the time, making a photobucket ruby gem and wrapping the REST calls in useful class abstractions. It is great for the community, forces you to follow good practices(to a certain extent) and will provide great experience to put on a resume/talk about in an interview.

JSON api on Ruby on Rails

I'm creating a JavaScript web app. I want to use Ruby on Rails to provide the API to the data in JSON format. I am writing the front-end entirely in JavaScript that will make Ajax calls to the API. This way, I will have a consistent data API when I can write different apps on different platforms.
I'm new to Ruby on Rails and I'm not sure if this is a good approach. If so, could you help me point to a good tutorial to implement the back-end that I just mentioned? If not, please help suggest a good way.
Api example code : https://github.com/pigon-web-services/api-app/blob/master/app/controllers/location_controller.rb
How to use this api with javascript : http://pigon.ws/examples/jsonp?api=locationapi
I didn't work with it yet, but the Rails-API gem by spastorino might be helpful.
Also there is a Railscast on this, so you might want to check this out as a starting point

Twitter bot with Rails

I am trying to create a Twitter bot with Ruby on Rails but I just dont find any useful information on this manner...
Is it posible?
I tried with the GEM twibot but it is deprecated it is not longer useful.
Does Rails have a method for trigger events when (for example) a twit is posted?
Anyone have worked with something like this?
Any tutorial?
Any information at all that is in current use, I mean that does work today with the Twitter API (Many of the stuff I googled does not work now)?
Thank you very much.
Twitter itself is running on Rails, and it has a REST API. You could easily write your own solution with ActiveResource
You can get started with the ActiveResource videos on Railscasts
rails per se does not have any support for twitter. it's just an mvc-web-framework. but there are a lot of ruby gems for twitter. my favorite is this https://github.com/jnunemaker/twitter but you can find a lot more here https://www.ruby-toolbox.com/categories/api_clients.html

Embed Blog in Ruby on Rails

I have a Ruby on Rails application and want to include a blog inside the application.
I was wondering what's the best way to do that. I don't want to have a link to an external blog. I want the blog integrated in my application. Also i don't have the time to programm the blog functionality. I want to use existing solutions.
What's the best way to accomplish that? Any recommendations? What are the best solutions?
The best way to include one application within another is by using engines. This might help you Ruby on Rails 3.1 Blog Engines
Perhaps Typo would address your needs installed as a Rails Engine.
Since nobody has done it so far I need to mention here that the spirit of Rails is to make everything friendly enough so that you can code your own.
It's a bit more work but then your blog module fits right in with the rest of the app.

Resources