jira-ruby 2.1.2 → 2.1.3
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/lib/jira/client.rb +11 -6
- data/lib/jira/http_client.rb +2 -2
- data/lib/jira/oauth_client.rb +2 -0
- data/lib/jira/version.rb +1 -1
- data/spec/jira/client_spec.rb +13 -0
- data/spec/jira/http_client_spec.rb +2 -2
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3167a32cb87f89e17ad016fa13bac784a689c9c39ac800e70137a9944b00b550
         | 
| 4 | 
            +
              data.tar.gz: 28c6dd444429802a94c58d13a3786647de6bfe37164251fc043761a70ef9d20f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f35ac632b07ffd50c4bc58c810bc10e8ed54ffdd212b9d172e3ce2080ee3e947754e5b9afd521bbc655e69064fd658bb29dda880833afc7327d089c8eea3d31c
         | 
| 7 | 
            +
              data.tar.gz: 361f3be9096ca1eed2383c4dcd4c388806b6f56e1b44305e802c7bb206a79b1216a4e6c8104ee26472a4f81c59b9b1c533c4d18d140b7e5928e6d3d581e571bc
         | 
    
        data/lib/jira/client.rb
    CHANGED
    
    | @@ -36,7 +36,9 @@ module JIRA | |
| 36 36 | 
             
              #   :http_debug         => false,
         | 
| 37 37 | 
             
              #   :shared_secret      => nil,
         | 
| 38 38 | 
             
              #   :cert_path          => nil,
         | 
| 39 | 
            -
              #   :key_path           => nil
         | 
| 39 | 
            +
              #   :key_path           => nil,
         | 
| 40 | 
            +
              #   :ssl_client_cert    => nil,
         | 
| 41 | 
            +
              #   :ssl_client_key     => nil
         | 
| 40 42 | 
             
              #
         | 
| 41 43 | 
             
              # See the JIRA::Base class methods for all of the available methods on these accessor
         | 
| 42 44 | 
             
              # objects.
         | 
| @@ -86,7 +88,9 @@ module JIRA | |
| 86 88 | 
             
                  :base_url,
         | 
| 87 89 | 
             
                  :shared_secret,
         | 
| 88 90 | 
             
                  :cert_path,
         | 
| 89 | 
            -
                  :key_path
         | 
| 91 | 
            +
                  :key_path,
         | 
| 92 | 
            +
                  :ssl_client_cert,
         | 
| 93 | 
            +
                  :ssl_client_key
         | 
| 90 94 | 
             
                ].freeze
         | 
| 91 95 |  | 
| 92 96 | 
             
                DEFAULT_OPTIONS = {
         | 
| @@ -110,10 +114,11 @@ module JIRA | |
| 110 114 | 
             
                  raise ArgumentError, "Unknown option(s) given: #{unknown_options}" unless unknown_options.empty?
         | 
| 111 115 |  | 
| 112 116 | 
             
                  if options[:use_client_cert]
         | 
| 113 | 
            -
                     | 
| 114 | 
            -
                     | 
| 115 | 
            -
             | 
| 116 | 
            -
                     | 
| 117 | 
            +
                    @options[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(@options[:cert_path])) if @options[:cert_path]
         | 
| 118 | 
            +
                    @options[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(@options[:key_path])) if @options[:key_path]
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                    raise ArgumentError, 'Options: :cert_path or :ssl_client_cert must be set when :use_client_cert is true' unless @options[:ssl_client_cert]
         | 
| 121 | 
            +
                    raise ArgumentError, 'Options: :key_path or :ssl_client_key must be set when :use_client_cert is true' unless @options[:ssl_client_key]
         | 
| 117 122 | 
             
                  end
         | 
| 118 123 |  | 
| 119 124 | 
             
                  case options[:auth_type]
         | 
    
        data/lib/jira/http_client.rb
    CHANGED
    
    | @@ -53,8 +53,8 @@ module JIRA | |
| 53 53 | 
             
                  http_conn = http_class.new(uri.host, uri.port)
         | 
| 54 54 | 
             
                  http_conn.use_ssl = @options[:use_ssl]
         | 
| 55 55 | 
             
                  if @options[:use_client_cert]
         | 
| 56 | 
            -
                    http_conn.cert = @options[: | 
| 57 | 
            -
                    http_conn.key = @options[: | 
| 56 | 
            +
                    http_conn.cert = @options[:ssl_client_cert]
         | 
| 57 | 
            +
                    http_conn.key = @options[:ssl_client_key]
         | 
| 58 58 | 
             
                  end
         | 
| 59 59 | 
             
                  http_conn.verify_mode = @options[:ssl_verify_mode]
         | 
| 60 60 | 
             
                  http_conn.ssl_version = @options[:ssl_version] if @options[:ssl_version]
         | 
    
        data/lib/jira/oauth_client.rb
    CHANGED
    
    | @@ -38,6 +38,8 @@ module JIRA | |
| 38 38 | 
             
                  @options[:request_token_path] = @options[:context_path] + @options[:request_token_path]
         | 
| 39 39 | 
             
                  @options[:authorize_path] = @options[:context_path] + @options[:authorize_path]
         | 
| 40 40 | 
             
                  @options[:access_token_path] = @options[:context_path] + @options[:access_token_path]
         | 
| 41 | 
            +
                  # proxy_address does not exist in oauth's gem context but proxy does
         | 
| 42 | 
            +
                  @options[:proxy] = @options[:proxy_address] if @options[:proxy_address]
         | 
| 41 43 | 
             
                  OAuth::Consumer.new(@options[:consumer_key], @options[:consumer_secret], @options)
         | 
| 42 44 | 
             
                end
         | 
| 43 45 |  | 
    
        data/lib/jira/version.rb
    CHANGED
    
    
    
        data/spec/jira/client_spec.rb
    CHANGED
    
    | @@ -59,6 +59,19 @@ RSpec.shared_examples 'Client Common Tests' do | |
| 59 59 | 
             
                  expect(subject.Project.find('123')).to eq(find_result)
         | 
| 60 60 | 
             
                end
         | 
| 61 61 | 
             
              end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
              describe 'SSL client options' do
         | 
| 64 | 
            +
                context 'without certificate and key' do
         | 
| 65 | 
            +
                  let(:options) { { use_client_cert: true } }
         | 
| 66 | 
            +
                  subject { JIRA::Client.new(options) }
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                  it 'raises an ArgumentError' do
         | 
| 69 | 
            +
                    expect { subject }.to raise_exception(ArgumentError, 'Options: :cert_path or :ssl_client_cert must be set when :use_client_cert is true')
         | 
| 70 | 
            +
                    options[:ssl_client_cert] = '<cert></cert>'
         | 
| 71 | 
            +
                    expect { subject }.to raise_exception(ArgumentError, 'Options: :key_path or :ssl_client_key must be set when :use_client_cert is true')
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
              end
         | 
| 62 75 | 
             
            end
         | 
| 63 76 |  | 
| 64 77 | 
             
            RSpec.shared_examples 'HttpClient tests' do
         | 
| @@ -280,8 +280,8 @@ describe JIRA::HttpClient do | |
| 280 280 | 
             
                expect(http_conn).to receive(:use_ssl=).with(basic_client.options[:use_ssl])
         | 
| 281 281 | 
             
                expect(http_conn).to receive(:verify_mode=).with(basic_client.options[:ssl_verify_mode])
         | 
| 282 282 | 
             
                expect(http_conn).to receive(:read_timeout=).with(basic_client.options[:read_timeout])
         | 
| 283 | 
            -
                expect(http_conn).to receive(:cert=).with(basic_client_cert_client.options[: | 
| 284 | 
            -
                expect(http_conn).to receive(:key=).with(basic_client_cert_client.options[: | 
| 283 | 
            +
                expect(http_conn).to receive(:cert=).with(basic_client_cert_client.options[:ssl_client_cert])
         | 
| 284 | 
            +
                expect(http_conn).to receive(:key=).with(basic_client_cert_client.options[:ssl_client_key])
         | 
| 285 285 | 
             
                expect(basic_client_cert_client.http_conn(uri)).to eq(http_conn)
         | 
| 286 286 | 
             
              end
         | 
| 287 287 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jira-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.1. | 
| 4 | 
            +
              version: 2.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - SUMO Heavy Industries
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2020-07- | 
| 12 | 
            +
            date: 2020-07-21 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: activesupport
         |