Sunday, October 9, 2011

Shopify API - Rails Connection

I spent a lot of time struggling trying to get my shopify private connection working.
For those of you who are also new to rails and shopify and are stuck at this point this is how I did it.



First of all go to your shop->apps->manage apps
and set up a Private app and look for your api_key and password you will need those to authenticate your connection.

Now let's take a look at an example code that asks for products.xml using the API





require 'net/https'

api = "your-api"
password = "your-password"

http = Net::HTTP.new('yourshop.myshopify.com')
#http.use_ssl = true (We do not need to use SSL)
http.start do |http|
  req = Net::HTTP::Get.new('/admin/products.xml')

  # we have to authenticate our
  # username and password
  req.basic_auth api, password
  resp, data = http.request(req) #data will be the xml returned by the server

end


Basically you need to use an authenticated connection, to do this I used the Net:HTTP module on ruby.

Saturday, October 8, 2011

Textmate env: ruby: No such file or directory

If you get this error on Textmate you've probably deleted ruby /usr/bin/ruby.
Find it, put it back there, and follow the rainbows.

Friday, October 7, 2011

Installing ruby on rails

I had to install ruby on rails for a new project I'm working on, it is supposed to be a super easy task, it took me a while though, there's many "not that good guides".
This is the one I recommend, it's perfect.

Got this error installing rails

file 'lib' not found

here's the solution

Tuesday, October 4, 2011

I'm starting my company

Simple Custom Solutions is the name.


I'm in the process of setting up my web developing company.
Feel free to come and check out the beta version.

http://www.simplecustomsolutions.com/beta

Some of the tools we plan on using for our projects are, Actionscript 3, HTML5, CSS, jQuery, python, Pyramid Framework with SQLAlchemy, and MySQL