Coder Social home page Coder Social logo

komba / vkontakte Goto Github PK

View Code? Open in Web Editor NEW

This project forked from galetahub/vkontakte

1.0 1.0 0.0 151 KB

The easiest way to access Vkontakte API and some other utils.

Home Page: http://vkontakte.ru/developers.php

License: MIT License

Ruby 100.00%

vkontakte's Introduction

Vkontakte

The easiest way to access Vkontakte API and some other utils. More info about API:

  1. vk.com/developers.php?oid=-1&p=%D0%90%D0%B2%D1%82%D0%BE%D1%80%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F

  2. vk.com/developers.php?oid=-1&p=%D0%92%D1%8B%D0%BF%D0%BE%D0%BB%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%BE%D0%B2_%D0%BA_API

  3. vk.com/developers.php?oid=-1&p=%D0%9F%D1%80%D0%B0%D0%B2%D0%B0_%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B0_%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B9

Install

gem 'vkontakte'

Configure

Vkontakte.setup do |config|
  config.app_id = "YOUR Vkontakte API ID"
  config.app_secret = "YOUR Vkontakte APP SECRET"
  config.format = :json
  config.debug = false
  config.logger = File.open(Rails.root.join('log', 'vkontakte.log'), "a")
end

Usage

User API by access_token

user = Vkontakte::App::User.new(uid, :access_token => ACCESS_TOKEN)
user.fetch # {"response"=>[{"uid"=>2592709, ...

Profile

user.profile.isAppUser      # {"response"=>"1"}
user.profile.getUserBalance
user.profile.getUserSettings
user.profile.likesGetList(:type => 'post')

Photos

user.photos.getAlbums
user.photos.getAlbumsCount
user.photos.get(:aid => 'album_id')

Groups

user.groups.get
user.groups.isMember(:gid => 'group_id')
user.groups.join(:gid => 1)
user.groups.leave(:gid => 1)

Friends

user.friends.get
user.friends.getOnline

Secure API

@app = Vkontakte::App::Secure.new
@app.secure.getAppBalance         # {"response"=>2000}
@app.auth                         # {"expires_in"=>0, "access_token"=>"d173f5...319f"}

IFrame application

Check if auth_key is valid:

def index
  @app = Vkontakte::App::Iframe.new
  @app.params = params

  if @app.valid_auth_key?
    session[:viewer_id] = params[:viewer_id]
  else
    render :action => "failure"
  end
end

Test

rake spec

Copyright © 2011 Aimbulance, released under the MIT license

vkontakte's People

Contributors

komba avatar galetahub avatar superp avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.