conjur-api 4.12.0 → 4.13.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/CHANGELOG.md +4 -0
- data/conjur-api.gemspec +1 -0
- data/lib/conjur-api/version.rb +2 -2
- data/lib/conjur/api/groups.rb +14 -3
- data/lib/conjur/group.rb +11 -2
- data/spec/api/groups_spec.rb +16 -0
- data/spec/lib/group_spec.rb +18 -0
- metadata +18 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 30c179935696f866037eeb767bc75a37fa852d2f
         | 
| 4 | 
            +
              data.tar.gz: dbb483606b3f77c0340e4fd46c97ac954cb72920
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3b328c7fc9790246d738f07f9983c787d5024643fd41655430992d4526fd07106ddaae791572c4581a6f222b2bff370e6954125de91fa6f56382f7d93d93eed1
         | 
| 7 | 
            +
              data.tar.gz: d754a280ea0ad20a031d1b0561ca1338bc08bcff3df5d99b4992e605106c18b2c02b66d5207e3fe108d5b76fba7ed91e3096f04a74e6d2c002a9ec97482504aa
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/conjur-api.gemspec
    CHANGED
    
    | @@ -29,6 +29,7 @@ Gem::Specification.new do |gem| | |
| 29 29 | 
             
              gem.add_development_dependency 'ci_reporter_rspec'
         | 
| 30 30 | 
             
              gem.add_development_dependency 'simplecov'
         | 
| 31 31 | 
             
              gem.add_development_dependency 'io-grab'
         | 
| 32 | 
            +
              gem.add_development_dependency 'rdoc'
         | 
| 32 33 | 
             
              gem.add_development_dependency 'yard'
         | 
| 33 34 | 
             
              gem.add_development_dependency 'redcarpet'
         | 
| 34 35 | 
             
              gem.add_development_dependency 'timecop'
         | 
    
        data/lib/conjur-api/version.rb
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            # Copyright (C) 2013- | 
| 1 | 
            +
            # Copyright (C) 2013-2015 Conjur Inc.
         | 
| 2 2 | 
             
            #
         | 
| 3 3 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 4 4 | 
             
            # this software and associated documentation files (the "Software"), to deal in
         | 
| @@ -19,6 +19,6 @@ | |
| 19 19 |  | 
| 20 20 | 
             
            module Conjur
         | 
| 21 21 | 
             
              class API
         | 
| 22 | 
            -
                VERSION = "4. | 
| 22 | 
            +
                VERSION = "4.13.0"
         | 
| 23 23 | 
             
              end
         | 
| 24 24 | 
             
            end
         | 
    
        data/lib/conjur/api/groups.rb
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 | 
            -
            #
         | 
| 2 | 
            -
            # Copyright (C) 2013 Conjur Inc
         | 
| 1 | 
            +
            # Copyright (C) 2013-2015 Conjur Inc.
         | 
| 3 2 | 
             
            #
         | 
| 4 3 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 4 | 
             
            # this software and associated documentation files (the "Software"), to deal in
         | 
| @@ -33,5 +32,17 @@ module Conjur | |
| 33 32 | 
             
                def group id
         | 
| 34 33 | 
             
                  standard_show Conjur::Core::API.host, :group, id
         | 
| 35 34 | 
             
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                # Find groups by GID.
         | 
| 37 | 
            +
                #
         | 
| 38 | 
            +
                # @param [Hash] options search criteria
         | 
| 39 | 
            +
                # @option options [Integer] :gidnumber GID number
         | 
| 40 | 
            +
                # @return [Array<String>] group names matching the criteria
         | 
| 41 | 
            +
                #
         | 
| 42 | 
            +
                # @note You can get a {Conjur::Group} by calling {Conjur::API#group}, eg.:
         | 
| 43 | 
            +
                #   +api.find_groups(gidnumber: 12345).map(&api.method(:group))+
         | 
| 44 | 
            +
                def find_groups options
         | 
| 45 | 
            +
                  JSON.parse(RestClient::Resource.new(Conjur::Core::API.host, credentials)["groups/search?#{options.to_query}"].get)
         | 
| 46 | 
            +
                end
         | 
| 36 47 | 
             
              end
         | 
| 37 | 
            -
            end
         | 
| 48 | 
            +
            end
         | 
    
        data/lib/conjur/group.rb
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 | 
            -
            #
         | 
| 2 | 
            -
            # Copyright (C) 2013 Conjur Inc
         | 
| 1 | 
            +
            # Copyright (C) 2013-2015 Conjur Inc.
         | 
| 3 2 | 
             
            #
         | 
| 4 3 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy of
         | 
| 5 4 | 
             
            # this software and associated documentation files (the "Software"), to deal in
         | 
| @@ -32,5 +31,15 @@ module Conjur | |
| 32 31 | 
             
                def remove_member(member)
         | 
| 33 32 | 
             
                  role.revoke_from member
         | 
| 34 33 | 
             
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                # Update group properties
         | 
| 36 | 
            +
                #
         | 
| 37 | 
            +
                # @param [Hash] props new property values
         | 
| 38 | 
            +
                # @option props [Integer] :gidnumber new GID number
         | 
| 39 | 
            +
                # @return [void]
         | 
| 40 | 
            +
                def update props
         | 
| 41 | 
            +
                  # not an alias because doc
         | 
| 42 | 
            +
                  put props
         | 
| 43 | 
            +
                end
         | 
| 35 44 | 
             
              end
         | 
| 36 45 | 
             
            end
         | 
    
        data/spec/api/groups_spec.rb
    CHANGED
    
    | @@ -14,6 +14,10 @@ describe Conjur::API, api: :dummy do | |
| 14 14 | 
             
                it_should_behave_like 'standard_create with', :group, :id, :options do
         | 
| 15 15 | 
             
                  let(:invoke) { subject.create_group :id, :options }
         | 
| 16 16 | 
             
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                it_should_behave_like 'standard_create with', :group, :id, gidnumber: 371509 do
         | 
| 19 | 
            +
                  let(:invoke) { subject.create_group :id, gidnumber: 371509 }
         | 
| 20 | 
            +
                end
         | 
| 17 21 | 
             
              end
         | 
| 18 22 |  | 
| 19 23 | 
             
              describe '#group' do
         | 
| @@ -21,4 +25,16 @@ describe Conjur::API, api: :dummy do | |
| 21 25 | 
             
                  let(:invoke) { subject.group :id }
         | 
| 22 26 | 
             
                end
         | 
| 23 27 | 
             
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              describe '#find_groups' do
         | 
| 30 | 
            +
                it "searches the group by GID" do
         | 
| 31 | 
            +
                  expect(RestClient::Request).to receive(:execute).with(
         | 
| 32 | 
            +
                    method: :get,
         | 
| 33 | 
            +
                    url: "#{core_host}/groups/search?gidnumber=12345",
         | 
| 34 | 
            +
                    headers: credentials[:headers]
         | 
| 35 | 
            +
                  ).and_return ['foo'].to_json
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  expect(api.find_groups(gidnumber: 12345)).to eq(['foo'])
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
              end
         | 
| 24 40 | 
             
            end
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Conjur::Group, api: :dummy do
         | 
| 4 | 
            +
              let(:id) { 'the-anonymous' }
         | 
| 5 | 
            +
              subject { api.group id }
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              describe '#update' do
         | 
| 8 | 
            +
                it "PUTs to /groups/:id" do
         | 
| 9 | 
            +
                  expect(RestClient::Request).to receive(:execute).with(
         | 
| 10 | 
            +
                    method: :put,
         | 
| 11 | 
            +
                    url: "#{core_host}/groups/#{api.fully_escape(id)}",
         | 
| 12 | 
            +
                    headers: credentials[:headers],
         | 
| 13 | 
            +
                    payload: { gidnumber: 12345 }
         | 
| 14 | 
            +
                   )
         | 
| 15 | 
            +
                  api.group(id).update(gidnumber: 12345)
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: conjur-api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.13.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Rafal Rzepecki
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2015- | 
| 12 | 
            +
            date: 2015-02-11 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rest-client
         | 
| @@ -137,6 +137,20 @@ dependencies: | |
| 137 137 | 
             
                - - '>='
         | 
| 138 138 | 
             
                  - !ruby/object:Gem::Version
         | 
| 139 139 | 
             
                    version: '0'
         | 
| 140 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 141 | 
            +
              name: rdoc
         | 
| 142 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 143 | 
            +
                requirements:
         | 
| 144 | 
            +
                - - '>='
         | 
| 145 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 146 | 
            +
                    version: '0'
         | 
| 147 | 
            +
              type: :development
         | 
| 148 | 
            +
              prerelease: false
         | 
| 149 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 150 | 
            +
                requirements:
         | 
| 151 | 
            +
                - - '>='
         | 
| 152 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 153 | 
            +
                    version: '0'
         | 
| 140 154 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 141 155 | 
             
              name: yard
         | 
| 142 156 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -274,6 +288,7 @@ files: | |
| 274 288 | 
             
            - spec/lib/configuration_spec.rb
         | 
| 275 289 | 
             
            - spec/lib/deputy_spec.rb
         | 
| 276 290 | 
             
            - spec/lib/exists_spec.rb
         | 
| 291 | 
            +
            - spec/lib/group_spec.rb
         | 
| 277 292 | 
             
            - spec/lib/host_spec.rb
         | 
| 278 293 | 
             
            - spec/lib/log_source_spec.rb
         | 
| 279 294 | 
             
            - spec/lib/log_spec.rb
         | 
| @@ -338,6 +353,7 @@ test_files: | |
| 338 353 | 
             
            - spec/lib/configuration_spec.rb
         | 
| 339 354 | 
             
            - spec/lib/deputy_spec.rb
         | 
| 340 355 | 
             
            - spec/lib/exists_spec.rb
         | 
| 356 | 
            +
            - spec/lib/group_spec.rb
         | 
| 341 357 | 
             
            - spec/lib/host_spec.rb
         | 
| 342 358 | 
             
            - spec/lib/log_source_spec.rb
         | 
| 343 359 | 
             
            - spec/lib/log_spec.rb
         |