Skip to main content

Posts

Showing posts from September, 2014

Omniauth Linked in Ruby On Rails

def get_linkedin_user_data
     omniauth = request.env["omniauth.auth"]
     dat=omniauth.extra.raw_info
     linked_app_key = "xxxxxxx"
     linkedin_secret_key = "yyyyyyy"
     client = LinkedIn::Client.new(linked_app_key,linkedin_secret_key)
     client.authorize_from_access(omniauth['credentials']['token'],omniauth['credentials']['secret'])
     connections=client.connections(:fields => ["id", "first-name", "last-name","picture-url"])
     uid=omniauth['uid']
     token=omniauth["credentials"]["token"]
     secret=omniauth["credentials"]["secret"]
  #linked user data
    omniauth = request.env["omniauth.auth"]
     data             = omniauth.info
     user_name        = data["name"]
     user_email       = data["email"]
     user_nickname    = data["nickname"]
     user_firstname   = data["first_name…

Kola Gem Implementaion In Ruby On Rails

Facebook omniauth with kola gem Implementation on Rails 3
1)Gem file add these lines
gem 'koala'

2)Facebook User Details getting

 token = request.env['omniauth.auth']["credentials"]["token"]
   # omniauth = request.env["omniauth.auth"]
   # token = omniauth['credentials']['token']
 @graph = Koala::Facebook::API.new(token)
 #Get The User Details of user
 fb_profile = @graph.get_object("me")
 #Get The Fb user freinds list
 friends = @graph.get_connections("me", "friends")
 firend_ids = friends.map{ |friend| friend["id"]}
  image_url = @graph.get_picture(@fb_id)
  image = open(image_url)
      full_name = fb_profile["name"]
      sub_name = fb_profile["first_name"]
      if fb.include?("location")
        location = fb_profile["location"]["name"]
      elsif fb.include?("hometown")
        location = fb_profile["hometown"]["name&quo…

Ezpservices Integration In Ruby on Rails(Cafe Press)

Ezprints  Integration In rails

1)Posting Order to Ezprints and get the shipping values
require 'net/https'
require 'rexml/document'
def shipping_options_ezp_services
      @order = Order.where(:id => 5).first
      @total_orders = Order.all
      xml = "<?xml version='1.0' encoding='UTF-8'?>
      <orders partnerid='45678' version='1'>
      <ordersession>
      <order>
      <orderid>#{@order.id}</orderid>
      <shippingaddress>
      <firstname>#{@order.first_name}</firstname>
      <address1>#{@order.address1}</address1>
      <city>#{@order.city}</city>
      <state>#{@order.state}</state>
      <zip>#{@order.zip}</zip>
      <countrycode>#{@order.country}</countrycode>
      <phone>#{@order.phone_no}</phone>
      </shippingaddress>"
     @total_orders.each do |t|
        xml << &q…