├── .gitignore ├── lib ├── odnoklassniki │ ├── version.rb │ ├── rest │ │ ├── mediatopic.rb │ │ ├── user.rb │ │ └── mediatopic │ │ │ ├── content.rb │ │ │ └── photoalbum.rb │ ├── utils.rb │ ├── connection.rb │ ├── config.rb │ ├── client.rb │ ├── request.rb │ └── error.rb └── odnoklassniki.rb ├── Gemfile ├── Rakefile ├── .travis.yml ├── test ├── test_helper.rb ├── lib │ ├── odnoklassniki │ │ ├── error_test.rb │ │ ├── config_test.rb │ │ ├── request_test.rb │ │ └── client_test.rb │ └── odnoklassniki_test.rb └── vcr_cassettes │ ├── client_wrong_credentials_post.yml │ ├── wrong_credentials_getCurrentUser.yml │ ├── client_wrong_credentials_getCurrentUser.yml │ ├── client_wrong_credentials_token.yml │ └── wrong_credentials_token.yml ├── LICENSE ├── odnoklassniki.gemspec └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle 2 | /Gemfile.lock 3 | /coverage 4 | -------------------------------------------------------------------------------- /lib/odnoklassniki/version.rb: -------------------------------------------------------------------------------- 1 | module Odnoklassniki 2 | VERSION = '0.0.3' 3 | end 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | # Specify your gem's dependencies in odnoklassniki.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | require 'rake/testtask' 4 | 5 | Rake::TestTask.new do |t| 6 | t.test_files = Dir.glob('test/**/*_test.rb') 7 | end 8 | 9 | task(default: :test) 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.0.0 4 | - 2.1.0 5 | - 2.1.5 6 | - 2.2.0 7 | - jruby-19mode # JRuby in 1.9 mode 8 | - rbx 9 | matrix: 10 | allow_failures: 11 | - rvm: jruby-19mode 12 | - rvm: rbx 13 | -------------------------------------------------------------------------------- /lib/odnoklassniki/rest/mediatopic.rb: -------------------------------------------------------------------------------- 1 | module Odnoklassniki 2 | module REST 3 | class Mediatopic 4 | 5 | attr_accessor :client 6 | 7 | def initialize(client) 8 | @client = client 9 | end 10 | 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/odnoklassniki/utils.rb: -------------------------------------------------------------------------------- 1 | module Odnoklassniki 2 | module Utils 3 | 4 | class << self 5 | 6 | def _symbolize_keys(hash) 7 | symbolized = {} 8 | hash.each do |k, v| 9 | v = _symbolize_keys(v) if v.is_a?(Hash) 10 | symbolized[k.to_sym] = v 11 | end 12 | symbolized 13 | end 14 | 15 | end 16 | 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | if ENV['COV'] == '1' 2 | require 'simplecov' 3 | SimpleCov.start 4 | end 5 | 6 | require 'minitest/autorun' 7 | require "minitest/reporters" 8 | Minitest::Reporters.use! 9 | 10 | require 'vcr' 11 | VCR.configure do |config| 12 | config.cassette_library_dir = "test/vcr_cassettes" 13 | config.hook_into :webmock # or :fakeweb 14 | end 15 | 16 | require_relative '../lib/odnoklassniki' 17 | -------------------------------------------------------------------------------- /lib/odnoklassniki/rest/user.rb: -------------------------------------------------------------------------------- 1 | module Odnoklassniki 2 | module REST 3 | class User 4 | 5 | attr_accessor :client 6 | 7 | def initialize(client) 8 | @client = client 9 | end 10 | 11 | def current_user(fields=[]) 12 | options = fields.empty? ? {} : fiels.join(',') 13 | client.get('users.getCurrentUser', options) 14 | end 15 | 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/lib/odnoklassniki/error_test.rb: -------------------------------------------------------------------------------- 1 | require_relative '../../test_helper' 2 | 3 | class TestOdnoklassnikiError < Minitest::Test 4 | 5 | def test_from_response 6 | error = Odnoklassniki::Error. 7 | from_response({ 'error_msg' => 'message', 'error_code' => 123 }) 8 | assert_instance_of Odnoklassniki::Error, error 9 | assert_equal error.code, 123 10 | assert_equal error.message, 'message' 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /lib/odnoklassniki.rb: -------------------------------------------------------------------------------- 1 | require_relative 'odnoklassniki/error' 2 | require_relative 'odnoklassniki/version' 3 | require_relative 'odnoklassniki/client' 4 | require_relative 'odnoklassniki/config' 5 | 6 | module Odnoklassniki 7 | 8 | class << self 9 | attr_accessor :config 10 | 11 | def new(options = {}) 12 | Odnoklassniki::Client.new(options) 13 | end 14 | 15 | def configure 16 | @config = Odnoklassniki::Config.new 17 | yield @config 18 | @config 19 | end 20 | 21 | def options 22 | (@config && @config.options) || {} 23 | end 24 | 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /test/lib/odnoklassniki_test.rb: -------------------------------------------------------------------------------- 1 | require_relative '../test_helper' 2 | 3 | class TestOdnoklassniki < Minitest::Test 4 | 5 | def setup 6 | @options = { 7 | access_token: '1', 8 | client_id: '2', 9 | client_secret: '3', 10 | application_key: '4' 11 | } 12 | Odnoklassniki.configure do |c| 13 | @options.each { |k, v| c.send("#{k}=", v) } 14 | end 15 | end 16 | 17 | def test_new 18 | assert_instance_of Odnoklassniki::Client, Odnoklassniki.new 19 | end 20 | 21 | def test_configure 22 | assert_equal Odnoklassniki::Client.new.instance_variable_get(:@access_token), '1' 23 | end 24 | 25 | def test_options 26 | assert_equal Odnoklassniki.options, @options 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /lib/odnoklassniki/connection.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | module Odnoklassniki 4 | module Connection 5 | API_HOST = 'http://api.odnoklassniki.ru' 6 | 7 | def connection(options={}) 8 | options = options.clone 9 | 10 | default_options = { 11 | :headers => { 12 | :accept => 'application/json', 13 | :user_agent => "odnoklassniki ruby gem/#{Odnoklassniki::VERSION}" 14 | }, 15 | :url => "#{API_HOST}/" 16 | } 17 | 18 | client = Faraday.default_adapter 19 | 20 | Faraday.new(default_options.merge(options)) do |conn| 21 | conn.request :multipart 22 | conn.request :url_encoded 23 | conn.adapter client 24 | end 25 | end 26 | 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /test/lib/odnoklassniki/config_test.rb: -------------------------------------------------------------------------------- 1 | require_relative '../../test_helper' 2 | 3 | class TestOdnoklassnikiConfig < Minitest::Test 4 | 5 | def setup 6 | @options = { 7 | access_token: '1', 8 | client_id: '2', 9 | client_secret: '3', 10 | application_key: '4' 11 | } 12 | end 13 | 14 | def test_configure 15 | config = Odnoklassniki::Config.configure do |c| 16 | @options.each do |k, v| 17 | c.send("#{k}=", v) 18 | end 19 | end 20 | assert_equal config.options, @options 21 | end 22 | 23 | def test_new 24 | config = Odnoklassniki::Config.new(@options) 25 | assert_equal config.options, @options 26 | end 27 | 28 | def test_options 29 | opts = @options.merge({some_unused_key: 123}) 30 | config = Odnoklassniki::Config.new(opts) 31 | assert_equal config.options, @options 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /lib/odnoklassniki/config.rb: -------------------------------------------------------------------------------- 1 | module Odnoklassniki 2 | class Config 3 | 4 | VALID_OPTIONS_KEYS = [:access_token, 5 | :client_id, 6 | :client_secret, 7 | :application_key].freeze 8 | 9 | attr_accessor *VALID_OPTIONS_KEYS 10 | 11 | def self.configure 12 | config = self.new 13 | yield config 14 | config 15 | end 16 | 17 | def initialize(options={}) 18 | @access_token = options[:access_token] || options['access_token'] 19 | @client_id = options[:client_id] || options['client_id'] 20 | @client_secret = options[:client_secret] || options['client_secret'] 21 | @application_key = options[:application_key] || options['application_key'] 22 | end 23 | 24 | def options 25 | options = {} 26 | VALID_OPTIONS_KEYS.each{ |pname| options[pname] = send(pname) } 27 | options 28 | end 29 | 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /test/lib/odnoklassniki/request_test.rb: -------------------------------------------------------------------------------- 1 | require_relative '../../test_helper' 2 | 3 | class TestOdnoklassnikiRequest < Minitest::Test 4 | 5 | def setup 6 | @request = Odnoklassniki::Request.new({ 7 | access_token: 'token', 8 | client_secret: 'client_secret', 9 | application_key: 'application_key' 10 | }) 11 | end 12 | 13 | def test_get_with_wrong_credentials 14 | VCR.use_cassette('wrong_credentials_getCurrentUser') do 15 | error = assert_raises Odnoklassniki::Error::ClientError do 16 | @request.get('/api/users/getCurrentUser') 17 | end 18 | assert_equal 'PARAM_API_KEY : Application not exist', error.message 19 | assert_equal 101, error.code 20 | end 21 | end 22 | 23 | def test_post_with_wrong_credentials 24 | VCR.use_cassette('wrong_credentials_token') do 25 | error = assert_raises Odnoklassniki::Error::ClientError do 26 | @request.post('/oauth/token.do') 27 | end 28 | assert_match /Provide OAUTH request parameters!/, error.message 29 | assert_equal error.code, nil 30 | end 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Alexey Gaziev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /test/vcr_cassettes/client_wrong_credentials_post.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: http://api.odnoklassniki.ru/api/mediatopic/post 6 | body: 7 | encoding: UTF-8 8 | string: '' 9 | headers: 10 | Accept: 11 | - application/json 12 | User-Agent: 13 | - odnoklassniki ruby gem/0.0.1 14 | Content-Length: 15 | - '0' 16 | Accept-Encoding: 17 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - Apache-Coyote/1.1 25 | Invocation-Error: 26 | - '101' 27 | Pragma: 28 | - no-cache 29 | Expires: 30 | - Thu, 01 Jan 1970 00:00:00 GMT 31 | Cache-Control: 32 | - no-cache 33 | - no-store 34 | Content-Type: 35 | - application/json;charset=utf-8 36 | Content-Language: 37 | - en-US 38 | Content-Length: 39 | - '85' 40 | Date: 41 | - Wed, 04 Feb 2015 14:30:21 GMT 42 | Connection: 43 | - close 44 | body: 45 | encoding: UTF-8 46 | string: '{"error_code":101,"error_data":null,"error_msg":"PARAM_API_KEY : No 47 | application key"}' 48 | http_version: 49 | recorded_at: Wed, 04 Feb 2015 14:30:22 GMT 50 | recorded_with: VCR 2.9.3 51 | -------------------------------------------------------------------------------- /test/vcr_cassettes/wrong_credentials_getCurrentUser.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.odnoklassniki.ru/api/users/getCurrentUser?access_token=token&application_key=application_key&sig=4784959f6620c78221bff139d6cf9309 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - application/json 12 | User-Agent: 13 | - odnoklassniki ruby gem/0.0.1 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - Apache-Coyote/1.1 23 | Invocation-Error: 24 | - '101' 25 | Pragma: 26 | - no-cache 27 | Expires: 28 | - Thu, 01 Jan 1970 00:00:00 GMT 29 | Cache-Control: 30 | - no-cache 31 | - no-store 32 | Content-Type: 33 | - application/json;charset=utf-8 34 | Content-Language: 35 | - en-US 36 | Content-Length: 37 | - '88' 38 | Date: 39 | - Wed, 04 Feb 2015 12:56:52 GMT 40 | Connection: 41 | - close 42 | body: 43 | encoding: UTF-8 44 | string: '{"error_code":101,"error_msg":"PARAM_API_KEY : Application not exist","error_data":null}' 45 | http_version: 46 | recorded_at: Wed, 04 Feb 2015 12:56:52 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /test/vcr_cassettes/client_wrong_credentials_getCurrentUser.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.odnoklassniki.ru/api/users/getCurrentUser?access_token=token&application_key=application_key&sig=4784959f6620c78221bff139d6cf9309 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - application/json 12 | User-Agent: 13 | - odnoklassniki ruby gem/0.0.1 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - Apache-Coyote/1.1 23 | Invocation-Error: 24 | - '101' 25 | Pragma: 26 | - no-cache 27 | Expires: 28 | - Thu, 01 Jan 1970 00:00:00 GMT 29 | Cache-Control: 30 | - no-cache 31 | - no-store 32 | Content-Type: 33 | - application/json;charset=utf-8 34 | Content-Language: 35 | - en-US 36 | Content-Length: 37 | - '88' 38 | Date: 39 | - Wed, 04 Feb 2015 14:30:21 GMT 40 | Connection: 41 | - close 42 | body: 43 | encoding: UTF-8 44 | string: '{"error_code":101,"error_data":null,"error_msg":"PARAM_API_KEY : Application 45 | not exist"}' 46 | http_version: 47 | recorded_at: Wed, 04 Feb 2015 14:30:21 GMT 48 | recorded_with: VCR 2.9.3 49 | -------------------------------------------------------------------------------- /odnoklassniki.gemspec: -------------------------------------------------------------------------------- 1 | lib = File.expand_path('../lib', __FILE__) 2 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 3 | require 'odnoklassniki/version' 4 | 5 | Gem::Specification.new do |s| 6 | s.name = 'odnoklassniki' 7 | s.version = Odnoklassniki::VERSION 8 | s.platform = Gem::Platform::RUBY 9 | s.authors = ['gazay'] 10 | s.licenses = ['MIT'] 11 | s.email = ['alex.gaziev@gmail.com'] 12 | s.homepage = 'https://github.com/gazay/odnoklassniki' 13 | s.summary = %q{Ruby wrapper for Odnoklassniki API} 14 | s.description = %q{Ruby wrapper for REST Odnoklassniki API calls. GET and POST calls.} 15 | 16 | s.rubyforge_project = 'odnoklassniki' 17 | 18 | s.files = `git ls-files`.split("\n") 19 | s.require_paths = ['lib'] 20 | s.add_dependency 'faraday', '>= 0.9', '< 2' 21 | s.add_dependency 'multi_json', '~> 1.10', '>= 1.10.0' 22 | s.add_development_dependency 'pry', '0.10.1' 23 | s.add_development_dependency 'byebug', '3.5.1' 24 | s.add_development_dependency 'pry-byebug', '3.0.0' 25 | s.add_development_dependency 'minitest', '5.5.1' 26 | s.add_development_dependency 'minitest-reporters', '1.0.10' 27 | s.add_development_dependency 'simplecov', '0.9.1' 28 | s.add_development_dependency 'rake', '10.1.0' 29 | s.add_development_dependency 'vcr', '2.9.3' 30 | s.add_development_dependency 'webmock', '1.20.4' 31 | end 32 | -------------------------------------------------------------------------------- /test/lib/odnoklassniki/client_test.rb: -------------------------------------------------------------------------------- 1 | require_relative '../../test_helper' 2 | 3 | class TestOdnoklassnikiClient < Minitest::Test 4 | 5 | def setup 6 | @client = Odnoklassniki::Client.new({ 7 | access_token: 'token', 8 | client_id: 'client_id', 9 | client_secret: 'client_secret', 10 | application_key: 'application_key' 11 | }) 12 | end 13 | 14 | def test_get_with_wrong_credentials 15 | VCR.use_cassette('client_wrong_credentials_getCurrentUser') do 16 | error = assert_raises Odnoklassniki::Error::ClientError do 17 | @client.instance_variable_set(:@refreshed, true) 18 | @client.get('users.getCurrentUser') 19 | end 20 | assert_equal 'PARAM_API_KEY : Application not exist', error.message 21 | assert_equal 101, error.code 22 | end 23 | end 24 | 25 | def test_post_with_wrong_credentials 26 | VCR.use_cassette('client_wrong_credentials_post') do 27 | error = assert_raises Odnoklassniki::Error::ClientError do 28 | @client.instance_variable_set(:@refreshed, true) 29 | @client.post('mediatopic.post') 30 | end 31 | assert_match /No application key/, error.message 32 | assert_equal 101, error.code 33 | end 34 | end 35 | 36 | def test_refresh_token_with_wrong_credentials 37 | VCR.use_cassette('client_wrong_credentials_token') do 38 | error = assert_raises Odnoklassniki::Error::ClientError do 39 | @client.refresh_token! 40 | end 41 | assert_equal nil, error.code 42 | end 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /test/vcr_cassettes/client_wrong_credentials_token.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: http://api.odnoklassniki.ru/oauth/token.do 6 | body: 7 | encoding: UTF-8 8 | string: access_token=token&application_key=application_key&client_id=client_id&client_secret=client_secret&grant_type=refresh_token&refresh_token=token&sig=c40601c8f1fdd56139160d7140af3ed0 9 | headers: 10 | Accept: 11 | - application/json 12 | User-Agent: 13 | - odnoklassniki ruby gem/0.0.1 14 | Content-Type: 15 | - application/x-www-form-urlencoded 16 | Accept-Encoding: 17 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - Apache-Coyote/1.1 25 | Set-Cookie: 26 | - JSESSIONID=9190C3142FFCE4EF71502920B5597956; Path=/; HttpOnly 27 | Content-Type: 28 | - text/html;charset=utf-8 29 | Content-Language: 30 | - en-US 31 | Content-Length: 32 | - '146' 33 | Date: 34 | - Wed, 04 Feb 2015 14:30:22 GMT 35 | Connection: 36 | - close 37 | body: 38 | encoding: UTF-8 39 | string: |2 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 | 51 | 52 | Error : Failed to convert value of type [java.lang.String] to required type [java.lang.Long] 53 | 54 | 55 | http_version: 56 | recorded_at: Wed, 04 Feb 2015 14:30:23 GMT 57 | recorded_with: VCR 2.9.3 58 | -------------------------------------------------------------------------------- /lib/odnoklassniki/client.rb: -------------------------------------------------------------------------------- 1 | require_relative 'request' 2 | 3 | module Odnoklassniki 4 | class Client 5 | 6 | def initialize(attrs= {}) 7 | attrs = Odnoklassniki.options.merge(attrs) 8 | Config::VALID_OPTIONS_KEYS.each do |key| 9 | instance_variable_set("@#{key}".to_sym, attrs[key]) 10 | end 11 | @refreshed = false 12 | end 13 | 14 | def get(method, params={}, &block) 15 | request_method(:get, method, params, block) 16 | end 17 | 18 | def post(method, params={}, &block) 19 | request_method(:post, method, params, block) 20 | end 21 | 22 | def refresh_token! 23 | @refreshed = true 24 | data = request.post('/oauth/token.do', refresh_credentials) 25 | @request = nil 26 | @access_token = data['access_token'] 27 | end 28 | 29 | private 30 | 31 | def fallback(params) 32 | [params.delete(:method), params] 33 | end 34 | 35 | def method_path(method) 36 | if method.start_with?('api') 37 | "/#{method}" 38 | elsif method.start_with?('/api') 39 | method 40 | elsif method.start_with?('/') 41 | "/api#{method}" 42 | else 43 | "/api/#{method}" 44 | end.gsub('.', '/') 45 | end 46 | 47 | def refresh_credentials 48 | { 49 | refresh_token: @access_token, 50 | grant_type: 'refresh_token', 51 | client_id: @client_id, 52 | client_secret: @client_secret 53 | } 54 | end 55 | 56 | def request_method(http_method, method, params, block) 57 | method, params = fallback(method) if method.is_a?(Hash) 58 | response = request.send(http_method, method_path(method), params) 59 | response = block.call response if block 60 | response 61 | end 62 | 63 | def request 64 | refresh_token! unless @refreshed 65 | @request ||= Request.new(credentials) 66 | end 67 | 68 | def credentials 69 | { 70 | access_token: @access_token, 71 | client_secret: @client_secret, 72 | application_key: @application_key 73 | } 74 | end 75 | 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /test/vcr_cassettes/wrong_credentials_token.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: http://api.odnoklassniki.ru/oauth/token.do 6 | body: 7 | encoding: UTF-8 8 | string: '' 9 | headers: 10 | Accept: 11 | - application/json 12 | User-Agent: 13 | - odnoklassniki ruby gem/0.0.1 14 | Content-Length: 15 | - '0' 16 | Accept-Encoding: 17 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 18 | response: 19 | status: 20 | code: 400 21 | message: Bad Request 22 | headers: 23 | Server: 24 | - Apache-Coyote/1.1 25 | Content-Type: 26 | - text/html;charset=utf-8 27 | Content-Language: 28 | - en 29 | Transfer-Encoding: 30 | - chunked 31 | Vary: 32 | - Accept-Encoding 33 | Date: 34 | - Wed, 04 Feb 2015 13:00:29 GMT 35 | Connection: 36 | - close 37 | body: 38 | encoding: UTF-8 39 | string: 'type 48 | Status report
message Provide OAUTH request parameters!
description 49 | The request sent by the client was syntactically incorrect.
12 |
13 |
14 |
15 |