signet 0.11.0 → 0.14.1
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/CHANGELOG.md +51 -15
- data/Gemfile +5 -4
- data/README.md +4 -6
- data/Rakefile +107 -37
- data/lib/signet.rb +17 -14
- data/lib/signet/errors.rb +4 -4
- data/lib/signet/oauth_1.rb +129 -154
- data/lib/signet/oauth_1/client.rb +309 -343
- data/lib/signet/oauth_1/credential.rb +40 -37
- data/lib/signet/oauth_1/server.rb +197 -203
- data/lib/signet/oauth_1/signature_methods/hmac_sha1.rb +11 -10
- data/lib/signet/oauth_1/signature_methods/plaintext.rb +8 -7
- data/lib/signet/oauth_1/signature_methods/rsa_sha1.rb +11 -11
- data/lib/signet/oauth_2.rb +41 -43
- data/lib/signet/oauth_2/client.rb +328 -313
- data/lib/signet/version.rb +2 -73
- data/signet.gemspec +37 -39
- data/spec/signet/oauth_1/client_spec.rb +313 -315
- data/spec/signet/oauth_1/credential_spec.rb +64 -56
- data/spec/signet/oauth_1/server_spec.rb +362 -362
- data/spec/signet/oauth_1/signature_methods/hmac_sha1_spec.rb +26 -26
- data/spec/signet/oauth_1/signature_methods/plaintext_spec.rb +28 -28
- data/spec/signet/oauth_1/signature_methods/rsa_sha1_spec.rb +34 -35
- data/spec/signet/oauth_1_spec.rb +553 -524
- data/spec/signet/oauth_2/client_spec.rb +652 -576
- data/spec/signet/oauth_2_spec.rb +88 -89
- data/spec/signet_spec.rb +41 -41
- data/spec/spec_helper.rb +7 -7
- data/spec/spec_helper_spec.rb +8 -8
- metadata +64 -52
- data/tasks/clobber.rake +0 -2
- data/tasks/gem.rake +0 -34
- data/tasks/git.rake +0 -40
- data/tasks/metrics.rake +0 -41
- data/tasks/spec.rake +0 -34
- data/tasks/wiki.rake +0 -38
- data/tasks/yard.rake +0 -21
    
        data/tasks/clobber.rake
    DELETED
    
    
    
        data/tasks/gem.rake
    DELETED
    
    | @@ -1,34 +0,0 @@ | |
| 1 | 
            -
            require "rubygems/package_task"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            namespace :gem do
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              desc "Build the gem"
         | 
| 6 | 
            -
              task :build do
         | 
| 7 | 
            -
                system "gem build signet.gemspec"
         | 
| 8 | 
            -
              end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              desc "Install the gem"
         | 
| 11 | 
            -
              task :install => ["clobber", "gem:package"] do
         | 
| 12 | 
            -
                sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
              desc "Uninstall the gem"
         | 
| 16 | 
            -
              task :uninstall do
         | 
| 17 | 
            -
                installed_list = Gem.source_index.find_name(PKG_NAME)
         | 
| 18 | 
            -
                if installed_list &&
         | 
| 19 | 
            -
                    (installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
         | 
| 20 | 
            -
                  sh(
         | 
| 21 | 
            -
                    "#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
         | 
| 22 | 
            -
                    "--ignore-dependencies --executables #{PKG_NAME}"
         | 
| 23 | 
            -
                  )
         | 
| 24 | 
            -
                end
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
              desc "Reinstall the gem"
         | 
| 28 | 
            -
              task :reinstall => [:uninstall, :install]
         | 
| 29 | 
            -
            end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            desc "Alias to gem:package"
         | 
| 32 | 
            -
            task "gem" => "gem:package"
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            task "clobber" => ["gem:clobber_package"]
         | 
    
        data/tasks/git.rake
    DELETED
    
    | @@ -1,40 +0,0 @@ | |
| 1 | 
            -
            namespace :git do
         | 
| 2 | 
            -
              namespace :tag do
         | 
| 3 | 
            -
                desc "List tags from the Git repository"
         | 
| 4 | 
            -
                task :list do
         | 
| 5 | 
            -
                  tags = `git tag -l`
         | 
| 6 | 
            -
                  tags.gsub!("\r", "")
         | 
| 7 | 
            -
                  tags = tags.split("\n").sort {|a, b| b <=> a }
         | 
| 8 | 
            -
                  puts tags.join("\n")
         | 
| 9 | 
            -
                end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                desc "Create a new tag in the Git repository"
         | 
| 12 | 
            -
                task :create do
         | 
| 13 | 
            -
                  changelog = File.open("CHANGELOG.md", "r") { |file| file.read }
         | 
| 14 | 
            -
                  puts "-" * 80
         | 
| 15 | 
            -
                  puts changelog
         | 
| 16 | 
            -
                  puts "-" * 80
         | 
| 17 | 
            -
                  puts
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                  v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
         | 
| 20 | 
            -
                  abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                  tag = "#{PKG_NAME}-#{PKG_VERSION}"
         | 
| 23 | 
            -
                  msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                  existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n")
         | 
| 26 | 
            -
                  if existing_tags.include?(tag)
         | 
| 27 | 
            -
                    warn("Tag already exists, deleting...")
         | 
| 28 | 
            -
                    unless system "git tag -d #{tag}"
         | 
| 29 | 
            -
                      abort "Tag deletion failed."
         | 
| 30 | 
            -
                    end
         | 
| 31 | 
            -
                  end
         | 
| 32 | 
            -
                  puts "Creating git tag '#{tag}'..."
         | 
| 33 | 
            -
                  unless system "git tag -a -m \"#{msg}\" #{tag}"
         | 
| 34 | 
            -
                    abort "Tag creation failed."
         | 
| 35 | 
            -
                  end
         | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
              end
         | 
| 38 | 
            -
            end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            task "gem:release" => "git:tag:create"
         | 
    
        data/tasks/metrics.rake
    DELETED
    
    | @@ -1,41 +0,0 @@ | |
| 1 | 
            -
            namespace :metrics do
         | 
| 2 | 
            -
              task :lines do
         | 
| 3 | 
            -
                lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
         | 
| 4 | 
            -
                for file_name in FileList["lib/**/*.rb"]
         | 
| 5 | 
            -
                  f = File.open(file_name)
         | 
| 6 | 
            -
                  while line = f.gets
         | 
| 7 | 
            -
                    lines += 1
         | 
| 8 | 
            -
                    next if line =~ /^\s*$/
         | 
| 9 | 
            -
                    next if line =~ /^\s*#/
         | 
| 10 | 
            -
                    codelines += 1
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
                  puts "L: #{sprintf("%4d", lines)}, " +
         | 
| 13 | 
            -
                    "LOC #{sprintf("%4d", codelines)} | #{file_name}"
         | 
| 14 | 
            -
                  total_lines     += lines
         | 
| 15 | 
            -
                  total_codelines += codelines
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  lines, codelines = 0, 0
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                puts "Code: Lines #{total_lines}, LOC #{total_codelines}\n\n"
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
         | 
| 23 | 
            -
                for file_name in FileList["spec/**/*_spec.rb"]
         | 
| 24 | 
            -
                  f = File.open(file_name)
         | 
| 25 | 
            -
                  while line = f.gets
         | 
| 26 | 
            -
                    lines += 1
         | 
| 27 | 
            -
                    next if line =~ /^\s*$/
         | 
| 28 | 
            -
                    next if line =~ /^\s*#/
         | 
| 29 | 
            -
                    codelines += 1
         | 
| 30 | 
            -
                  end
         | 
| 31 | 
            -
                  puts "L: #{sprintf("%4d", lines)}, " +
         | 
| 32 | 
            -
                    "LOC #{sprintf("%4d", codelines)} | #{file_name}"
         | 
| 33 | 
            -
                  total_lines     += lines
         | 
| 34 | 
            -
                  total_codelines += codelines
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                  lines, codelines = 0, 0
         | 
| 37 | 
            -
                end
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                puts "Specs: Lines #{total_lines}, LOC #{total_codelines}\n\n"
         | 
| 40 | 
            -
              end
         | 
| 41 | 
            -
            end
         | 
    
        data/tasks/spec.rake
    DELETED
    
    | @@ -1,34 +0,0 @@ | |
| 1 | 
            -
            require 'rspec/core/rake_task'
         | 
| 2 | 
            -
            require 'rake/clean'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            CLOBBER.include('coverage', 'specdoc')
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            namespace :spec do
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              RSpec::Core::RakeTask.new(:normal) do |t|
         | 
| 9 | 
            -
                t.pattern = FileList['spec/**/*_spec.rb']
         | 
| 10 | 
            -
                t.rspec_opts = ['--color', '--format', 'documentation']
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              RSpec::Core::RakeTask.new(:all) do |t|
         | 
| 14 | 
            -
                t.pattern = FileList['spec/**/*_spec.rb']
         | 
| 15 | 
            -
                t.rspec_opts = ['--color', '--format', 'documentation']
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              desc "Generate HTML Specdocs for all specs"
         | 
| 19 | 
            -
              RSpec::Core::RakeTask.new(:specdoc) do |t|
         | 
| 20 | 
            -
                specdoc_path = File.expand_path(
         | 
| 21 | 
            -
                  File.join(File.dirname(__FILE__), '..', 'documentation')
         | 
| 22 | 
            -
                )
         | 
| 23 | 
            -
                Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                output_file = File.join(specdoc_path, 'index.html')
         | 
| 26 | 
            -
                t.pattern = FileList['spec/**/*_spec.rb']
         | 
| 27 | 
            -
                t.rspec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
         | 
| 28 | 
            -
                t.fail_on_error = false
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
            desc "Alias to spec:normal"
         | 
| 34 | 
            -
            task "spec" => "spec:normal"
         | 
    
        data/tasks/wiki.rake
    DELETED
    
    | @@ -1,38 +0,0 @@ | |
| 1 | 
            -
            $LOAD_PATH.unshift(
         | 
| 2 | 
            -
              File.expand_path(File.join(File.dirname(__FILE__), '../yard/lib'))
         | 
| 3 | 
            -
            )
         | 
| 4 | 
            -
            $LOAD_PATH.unshift(File.expand_path('.'))
         | 
| 5 | 
            -
            $LOAD_PATH.uniq!
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            require 'rake'
         | 
| 8 | 
            -
            require 'rake/clean'
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            CLOBBER.include('wiki')
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            begin
         | 
| 13 | 
            -
              require 'yard'
         | 
| 14 | 
            -
              require 'yard/rake/wikidoc_task'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
              namespace :wiki do
         | 
| 17 | 
            -
                desc 'Generate Wiki Documentation with YARD'
         | 
| 18 | 
            -
                YARD::Rake::WikidocTask.new do |yardoc|
         | 
| 19 | 
            -
                  yardoc.name = 'reference'
         | 
| 20 | 
            -
                  yardoc.options = [
         | 
| 21 | 
            -
                    '--verbose',
         | 
| 22 | 
            -
                    '--markup', 'markdown',
         | 
| 23 | 
            -
                    '-e', 'yard/lib/yard-google-code.rb',
         | 
| 24 | 
            -
                    '-p', 'yard/templates',
         | 
| 25 | 
            -
                    '-f', 'wiki',
         | 
| 26 | 
            -
                    '-o', 'wiki'
         | 
| 27 | 
            -
                  ]
         | 
| 28 | 
            -
                  yardoc.files = [
         | 
| 29 | 
            -
                    'lib/**/*.rb', 'ext/**/*.c', '-', 'README.md', 'CHANGELOG.md'
         | 
| 30 | 
            -
                  ]
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                task 'generate' => ['wiki:reference', 'wiki:supported_apis']
         | 
| 34 | 
            -
              end
         | 
| 35 | 
            -
            rescue LoadError
         | 
| 36 | 
            -
              # If yard isn't available, it's not the end of the world
         | 
| 37 | 
            -
              warn('YARD unavailable. Cannot fully generate wiki.')
         | 
| 38 | 
            -
            end
         | 
    
        data/tasks/yard.rake
    DELETED
    
    | @@ -1,21 +0,0 @@ | |
| 1 | 
            -
            require 'rake/clean'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            CLOBBER.include('doc')
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            require 'yard'
         | 
| 6 | 
            -
            require 'yard/rake/yardoc_task'
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            namespace :doc do
         | 
| 9 | 
            -
              desc 'Generate Yardoc documentation'
         | 
| 10 | 
            -
              YARD::Rake::YardocTask.new do |yardoc|
         | 
| 11 | 
            -
                yardoc.name = 'yard'
         | 
| 12 | 
            -
                yardoc.options = ['--verbose', '--markup', 'markdown']
         | 
| 13 | 
            -
                yardoc.files = [
         | 
| 14 | 
            -
                  'lib/**/*.rb', 'ext/**/*.c', '-',
         | 
| 15 | 
            -
                  'README.md', 'CHANGELOG.md', 'LICENSE'
         | 
| 16 | 
            -
                ]
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
            end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            desc 'Alias to doc:yard'
         | 
| 21 | 
            -
            task 'doc' => 'doc:yard'
         |