omniauth-instagram 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop-https---raw-githubusercontent-com-tmilewski-rubocop-defaults-master-rubocop-yml +58 -0
- data/.rubocop.yml +19 -0
- data/Gemfile +13 -1
- data/Rakefile +12 -7
- data/lib/omniauth-instagram.rb +1 -1
- data/lib/omniauth-instagram/version.rb +1 -1
- data/lib/omniauth/strategies/instagram.rb +10 -12
- data/omniauth-instagram.gemspec +12 -12
- data/spec/omniauth/strategies/instagram_spec.rb +4 -4
- data/spec/spec_helper.rb +3 -4
- metadata +5 -59
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4901cc04b34ba21547740f5c24db2fada64a1136
         | 
| 4 | 
            +
              data.tar.gz: 196bd3e48f99f6bb8fc4bfcfe683602788e5ed76
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0a2eb95e52c28b554587b0de91903fe7b216be9490d7a0da6afe26837fde709e596e8d45328b25d9862089624e23d624b5fdb10b030a70636264382734d4a6f1
         | 
| 7 | 
            +
              data.tar.gz: fbbde0931be93b7c650d549e31e67240da5443d7649eea07900cf4792f3e1b98ef13d2127b32db70acf5554fb2bf88dec2ca76f1b334851b02123125d2a4bebc
         | 
| @@ -0,0 +1,58 @@ | |
| 1 | 
            +
            # see https://github.com/bbatsov/rubocop/blob/master/config/default.yml
         | 
| 2 | 
            +
            # for default configuration
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            AllCops:
         | 
| 5 | 
            +
              TargetRubyVersion: 2.4
         | 
| 6 | 
            +
              DisplayCopNames: true
         | 
| 7 | 
            +
              Exclude:
         | 
| 8 | 
            +
                - 'db/schema.rb'
         | 
| 9 | 
            +
                - 'bin/*'
         | 
| 10 | 
            +
                - 'vendor/**/*'
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            Rails:
         | 
| 13 | 
            +
              Enabled: true
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            Documentation:
         | 
| 16 | 
            +
              Enabled: false
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            Metrics/LineLength:
         | 
| 19 | 
            +
              Max: 125
         | 
| 20 | 
            +
              Exclude:
         | 
| 21 | 
            +
                - 'db/migrate/*'
         | 
| 22 | 
            +
                - 'config/initializers/devise.rb'
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            Metrics/MethodLength:
         | 
| 25 | 
            +
              CountComments: false
         | 
| 26 | 
            +
              Max: 10
         | 
| 27 | 
            +
              Exclude:
         | 
| 28 | 
            +
                - 'db/migrate/*'
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            Metrics/ModuleLength:
         | 
| 31 | 
            +
              CountComments: false
         | 
| 32 | 
            +
              Max: 100
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            Metrics/AbcSize:
         | 
| 35 | 
            +
              # The ABC size is a calculated magnitude, so this number can be a Fixnum or a Float.
         | 
| 36 | 
            +
              # http://c2.com/cgi/wiki?AbcMetric
         | 
| 37 | 
            +
              Max: 15
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            Metrics/CyclomaticComplexity:
         | 
| 40 | 
            +
              # http://www.rubydoc.info/github/bbatsov/rubocop/Rubocop/Cop/Style/CyclomaticComplexity
         | 
| 41 | 
            +
              Max: 6
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            Metrics/PerceivedComplexity:
         | 
| 44 | 
            +
              # http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/PerceivedComplexity
         | 
| 45 | 
            +
              Max: 7
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            Metrics/ClassLength:
         | 
| 48 | 
            +
              CountComments: false
         | 
| 49 | 
            +
              Max: 100
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            Style/MultilineMethodCallIndentation:
         | 
| 52 | 
            +
              EnforcedStyle: indented
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            Style/FrozenStringLiteralComment:
         | 
| 55 | 
            +
              Enabled: false
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            Style/ClassAndModuleChildren:
         | 
| 58 | 
            +
              Enabled: false
         | 
    
        data/.rubocop.yml
    ADDED
    
    | @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            inherit_from:
         | 
| 2 | 
            +
              - https://raw.githubusercontent.com/tmilewski/rubocop-defaults/master/rubocop.yml
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Style/FileName:
         | 
| 5 | 
            +
              Enabled: false
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            AllCops:
         | 
| 8 | 
            +
              Exclude:
         | 
| 9 | 
            +
                - 'tmp/**/*'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            Metrics/MethodLength:
         | 
| 12 | 
            +
              CountComments: false
         | 
| 13 | 
            +
              Max: 12
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            Metrics/AbcSize:
         | 
| 16 | 
            +
              Max: 20.35
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            Style/FormatString:
         | 
| 19 | 
            +
              Enabled: false
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -1,4 +1,16 @@ | |
| 1 1 | 
             
            source 'http://rubygems.org'
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            gem 'rake'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            group :development do
         | 
| 6 | 
            +
              gem 'rubocop', '>= 0.48.1'
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            group :test do
         | 
| 10 | 
            +
              # gem 'coveralls', require: false
         | 
| 11 | 
            +
              gem 'rack-test'
         | 
| 12 | 
            +
              gem 'rspec', '~> 3.6.0' # '~> 3.6.0'
         | 
| 13 | 
            +
              gem 'simplecov', require: false
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 4 16 | 
             
            gemspec
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,12 +1,17 @@ | |
| 1 1 | 
             
            #!/usr/bin/env rake
         | 
| 2 | 
            -
            require  | 
| 2 | 
            +
            require 'bundler/gem_tasks'
         | 
| 3 3 | 
             
            require 'rspec/core/rake_task'
         | 
| 4 | 
            +
            RSpec::Core::RakeTask.new(:spec)
         | 
| 4 5 |  | 
| 5 | 
            -
             | 
| 6 | 
            -
            task :default => :spec
         | 
| 6 | 
            +
            task test: :spec
         | 
| 7 7 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 8 | 
            +
            begin
         | 
| 9 | 
            +
              require 'rubocop/rake_task'
         | 
| 10 | 
            +
              RuboCop::RakeTask.new
         | 
| 11 | 
            +
            rescue LoadError
         | 
| 12 | 
            +
              task :rubocop do
         | 
| 13 | 
            +
                $stderr.puts 'Rubocop is disabled'
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
| 10 16 |  | 
| 11 | 
            -
             | 
| 12 | 
            -
            task :default => :spec
         | 
| 17 | 
            +
            task default: %i[spec rubocop]
         | 
    
        data/lib/omniauth-instagram.rb
    CHANGED
    
    | @@ -1,2 +1,2 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'omniauth-instagram/version'
         | 
| 2 2 | 
             
            require 'omniauth/strategies/instagram'
         | 
| @@ -3,11 +3,9 @@ require 'omniauth-oauth2' | |
| 3 3 | 
             
            module OmniAuth
         | 
| 4 4 | 
             
              module Strategies
         | 
| 5 5 | 
             
                class Instagram < OmniAuth::Strategies::OAuth2
         | 
| 6 | 
            -
                  option :client_options,  | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
                    :token_url => 'https://api.instagram.com/oauth/access_token'
         | 
| 10 | 
            -
                  }
         | 
| 6 | 
            +
                  option :client_options,         site: 'https://api.instagram.com',
         | 
| 7 | 
            +
                                                  authorize_url: 'https://api.instagram.com/oauth/authorize',
         | 
| 8 | 
            +
                                                  token_url: 'https://api.instagram.com/oauth/access_token'
         | 
| 11 9 |  | 
| 12 10 | 
             
                  def callback_url
         | 
| 13 11 | 
             
                    full_host + script_name + callback_path
         | 
| @@ -30,7 +28,7 @@ module OmniAuth | |
| 30 28 | 
             
                      'email'    => raw_info['email'],
         | 
| 31 29 | 
             
                      'image'    => raw_info['profile_picture'],
         | 
| 32 30 | 
             
                      'bio'      => raw_info['bio'],
         | 
| 33 | 
            -
                      'website'  => raw_info['website'] | 
| 31 | 
            +
                      'website'  => raw_info['website']
         | 
| 34 32 | 
             
                    }
         | 
| 35 33 | 
             
                  end
         | 
| 36 34 |  | 
| @@ -42,14 +40,14 @@ module OmniAuth | |
| 42 40 |  | 
| 43 41 | 
             
                  def raw_info
         | 
| 44 42 | 
             
                    if options[:extra_data]
         | 
| 45 | 
            -
                      endpoint =  | 
| 43 | 
            +
                      endpoint = '/users/self'
         | 
| 46 44 | 
             
                      params = {}
         | 
| 47 45 | 
             
                      access_token.options[:mode] = :query
         | 
| 48 | 
            -
                      access_token.options[:param_name] =  | 
| 49 | 
            -
                      params[ | 
| 50 | 
            -
                      @data ||= access_token.get("/v1#{endpoint}",  | 
| 46 | 
            +
                      access_token.options[:param_name] = 'access_token'
         | 
| 47 | 
            +
                      params['sig'] = generate_sig(endpoint, 'access_token' => access_token.token) if options[:enforce_signed_requests]
         | 
| 48 | 
            +
                      @data ||= access_token.get("/v1#{endpoint}", params: params).parsed['data'] || {}
         | 
| 51 49 | 
             
                    else
         | 
| 52 | 
            -
                      @data ||= access_token.params[ | 
| 50 | 
            +
                      @data ||= access_token.params['user']
         | 
| 53 51 | 
             
                    end
         | 
| 54 52 | 
             
                    @data
         | 
| 55 53 | 
             
                  end
         | 
| @@ -78,7 +76,7 @@ module OmniAuth | |
| 78 76 | 
             
                      sig += '|%s=%s' % [key, val]
         | 
| 79 77 | 
             
                    end
         | 
| 80 78 | 
             
                    digest = OpenSSL::Digest.new('sha256')
         | 
| 81 | 
            -
                     | 
| 79 | 
            +
                    OpenSSL::HMAC.hexdigest(digest, secret, sig)
         | 
| 82 80 | 
             
                  end
         | 
| 83 81 | 
             
                end
         | 
| 84 82 | 
             
              end
         | 
    
        data/omniauth-instagram.gemspec
    CHANGED
    
    | @@ -1,24 +1,24 @@ | |
| 1 1 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            require File.expand_path('../lib/omniauth-instagram/version', __FILE__)
         | 
| 3 4 |  | 
| 4 5 | 
             
            Gem::Specification.new do |gem|
         | 
| 5 | 
            -
              gem.authors       = [ | 
| 6 | 
            -
              gem.email         = [ | 
| 7 | 
            -
              gem.description   =  | 
| 8 | 
            -
              gem.summary       =  | 
| 9 | 
            -
              gem.homepage      =  | 
| 6 | 
            +
              gem.authors       = ['Mihai Anca']
         | 
| 7 | 
            +
              gem.email         = ['mihai@mihaia.com']
         | 
| 8 | 
            +
              gem.description   = 'OmniAuth strategy for Instagram.'
         | 
| 9 | 
            +
              gem.summary       = 'OmniAuth strategy for Instagram.'
         | 
| 10 | 
            +
              gem.homepage      = 'https://github.com/ropiku/omniauth-instagram'
         | 
| 10 11 |  | 
| 11 | 
            -
              gem.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 12 | 
            +
              gem.executables   = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
         | 
| 12 13 | 
             
              gem.files         = `git ls-files`.split("\n")
         | 
| 13 14 | 
             
              gem.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 14 | 
            -
              gem.name          =  | 
| 15 | 
            -
              gem.require_paths = [ | 
| 15 | 
            +
              gem.name          = 'omniauth-instagram'
         | 
| 16 | 
            +
              gem.require_paths = ['lib']
         | 
| 16 17 | 
             
              gem.version       = OmniAuth::Instagram::VERSION
         | 
| 17 18 |  | 
| 18 19 | 
             
              gem.add_dependency 'omniauth', '~> 1'
         | 
| 19 20 | 
             
              gem.add_dependency 'omniauth-oauth2', '~> 1'
         | 
| 20 | 
            -
             | 
| 21 | 
            -
               | 
| 22 | 
            -
               | 
| 23 | 
            -
              gem.add_development_dependency 'webmock'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              # s.add_development_dependency 'dotenv', '>= 2.0'
         | 
| 23 | 
            +
              # s.add_development_dependency 'sinatra', '>= 2.0'
         | 
| 24 24 | 
             
            end
         | 
| @@ -1,20 +1,20 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe OmniAuth::Strategies::Instagram do
         | 
| 4 | 
            -
              context  | 
| 4 | 
            +
              context 'client options' do
         | 
| 5 5 | 
             
                subject do
         | 
| 6 6 | 
             
                  OmniAuth::Strategies::Instagram.new({})
         | 
| 7 7 | 
             
                end
         | 
| 8 8 |  | 
| 9 | 
            -
                it  | 
| 9 | 
            +
                it 'should have the correct site' do
         | 
| 10 10 | 
             
                  expect(subject.options.client_options.site).to eq('https://api.instagram.com')
         | 
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 | 
            -
                it  | 
| 13 | 
            +
                it 'should have the correct authorize url' do
         | 
| 14 14 | 
             
                  expect(subject.options.client_options.authorize_url).to eq('https://api.instagram.com/oauth/authorize')
         | 
| 15 15 | 
             
                end
         | 
| 16 16 |  | 
| 17 | 
            -
                it  | 
| 17 | 
            +
                it 'should have the correct token url' do
         | 
| 18 18 | 
             
                  expect(subject.options.client_options.token_url).to eq('https://api.instagram.com/oauth/access_token')
         | 
| 19 19 | 
             
                end
         | 
| 20 20 | 
             
              end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 1 | 
            +
            $LOAD_PATH.unshift File.expand_path('..', __FILE__)
         | 
| 2 | 
            +
            $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
         | 
| 3 3 | 
             
            require 'simplecov'
         | 
| 4 4 | 
             
            SimpleCov.start
         | 
| 5 5 | 
             
            require 'rspec'
         | 
| @@ -11,6 +11,5 @@ require 'omniauth-instagram' | |
| 11 11 | 
             
            RSpec.configure do |config|
         | 
| 12 12 | 
             
              config.include WebMock::API
         | 
| 13 13 | 
             
              config.include Rack::Test::Methods
         | 
| 14 | 
            -
              config.extend  OmniAuth::Test::StrategyMacros, : | 
| 14 | 
            +
              config.extend  OmniAuth::Test::StrategyMacros, type: :strategy
         | 
| 15 15 | 
             
            end
         | 
| 16 | 
            -
             | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: omniauth-instagram
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mihai Anca
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-05-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: omniauth
         | 
| @@ -38,62 +38,6 @@ dependencies: | |
| 38 38 | 
             
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '1'
         | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: rspec
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - "~>"
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '2.12'
         | 
| 48 | 
            -
              type: :development
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - "~>"
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '2.12'
         | 
| 55 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name: rack-test
         | 
| 57 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            -
                requirements:
         | 
| 59 | 
            -
                - - ">="
         | 
| 60 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: '0'
         | 
| 62 | 
            -
              type: :development
         | 
| 63 | 
            -
              prerelease: false
         | 
| 64 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                requirements:
         | 
| 66 | 
            -
                - - ">="
         | 
| 67 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: '0'
         | 
| 69 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name: simplecov
         | 
| 71 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            -
                requirements:
         | 
| 73 | 
            -
                - - ">="
         | 
| 74 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: '0'
         | 
| 76 | 
            -
              type: :development
         | 
| 77 | 
            -
              prerelease: false
         | 
| 78 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            -
                requirements:
         | 
| 80 | 
            -
                - - ">="
         | 
| 81 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: '0'
         | 
| 83 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            -
              name: webmock
         | 
| 85 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 | 
            -
                requirements:
         | 
| 87 | 
            -
                - - ">="
         | 
| 88 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version: '0'
         | 
| 90 | 
            -
              type: :development
         | 
| 91 | 
            -
              prerelease: false
         | 
| 92 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 | 
            -
                requirements:
         | 
| 94 | 
            -
                - - ">="
         | 
| 95 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            -
                    version: '0'
         | 
| 97 41 | 
             
            description: OmniAuth strategy for Instagram.
         | 
| 98 42 | 
             
            email:
         | 
| 99 43 | 
             
            - mihai@mihaia.com
         | 
| @@ -102,6 +46,8 @@ extensions: [] | |
| 102 46 | 
             
            extra_rdoc_files: []
         | 
| 103 47 | 
             
            files:
         | 
| 104 48 | 
             
            - ".gitignore"
         | 
| 49 | 
            +
            - ".rubocop-https---raw-githubusercontent-com-tmilewski-rubocop-defaults-master-rubocop-yml"
         | 
| 50 | 
            +
            - ".rubocop.yml"
         | 
| 105 51 | 
             
            - Gemfile
         | 
| 106 52 | 
             
            - README.md
         | 
| 107 53 | 
             
            - Rakefile
         | 
| @@ -130,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 130 76 | 
             
                  version: '0'
         | 
| 131 77 | 
             
            requirements: []
         | 
| 132 78 | 
             
            rubyforge_project: 
         | 
| 133 | 
            -
            rubygems_version: 2. | 
| 79 | 
            +
            rubygems_version: 2.6.11
         | 
| 134 80 | 
             
            signing_key: 
         | 
| 135 81 | 
             
            specification_version: 4
         | 
| 136 82 | 
             
            summary: OmniAuth strategy for Instagram.
         |