octokit 3.2.0 → 3.3.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/lib/octokit/client/issues.rb +2 -2
 - data/lib/octokit/client/organizations.rb +77 -0
 - data/lib/octokit/version.rb +1 -1
 - metadata +6 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 50843d946bedec18101a1a6e8d891bd90300c10f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7d1676c589e378ccda28887ea873674bd22e5c8b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9dc114a9fd18130673eabe703a7f730690342b4b951ee48fe89a2aee0c055847e0a77eb621109ea6ba7db98a7bfe9bc0bfc82d7947c5877692df6123fe91d8fc
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a28fcc8ccdef9d3b8b84685e9d3d0365351cea24640420414abefaf310b02cee1642bea38ddc39f9ad9f3bba5af0bf80d5eb1b36a18318a15ba04f5905fd5179
         
     | 
| 
         @@ -24,7 +24,7 @@ module Octokit 
     | 
|
| 
       24 
24 
     | 
    
         
             
                  # @see https://developer.github.com/v3/issues/#list-issues
         
     | 
| 
       25 
25 
     | 
    
         
             
                  # @example List issues for a repository
         
     | 
| 
       26 
26 
     | 
    
         
             
                  #   Octokit.list_issues("sferik/rails_admin")
         
     | 
| 
       27 
     | 
    
         
            -
                  # @example List issues for the  
     | 
| 
      
 27 
     | 
    
         
            +
                  # @example List issues for the authenticated user across repositories
         
     | 
| 
       28 
28 
     | 
    
         
             
                  #   @client = Octokit::Client.new(:login => 'foo', :password => 'bar')
         
     | 
| 
       29 
29 
     | 
    
         
             
                  #   @client.list_issues
         
     | 
| 
       30 
30 
     | 
    
         
             
                  def list_issues(repository = nil, options = {})
         
     | 
| 
         @@ -45,7 +45,7 @@ module Octokit 
     | 
|
| 
       45 
45 
     | 
    
         
             
                  #   format: YYYY-MM-DDTHH:MM:SSZ
         
     | 
| 
       46 
46 
     | 
    
         
             
                  # @return [Array<Sawyer::Resource>] A list of issues for a repository.
         
     | 
| 
       47 
47 
     | 
    
         
             
                  # @see https://developer.github.com/v3/issues/#list-issues
         
     | 
| 
       48 
     | 
    
         
            -
                  # @example List issues for the  
     | 
| 
      
 48 
     | 
    
         
            +
                  # @example List issues for the authenticated user across owned and member repositories
         
     | 
| 
       49 
49 
     | 
    
         
             
                  #   @client = Octokit::Client.new(:login => 'foo', :password => 'bar')
         
     | 
| 
       50 
50 
     | 
    
         
             
                  #   @client.user_issues
         
     | 
| 
       51 
51 
     | 
    
         
             
                  def user_issues(options = {})
         
     | 
| 
         @@ -6,6 +6,8 @@ module Octokit 
     | 
|
| 
       6 
6 
     | 
    
         
             
                # @see https://developer.github.com/v3/orgs/
         
     | 
| 
       7 
7 
     | 
    
         
             
                module Organizations
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
                  ORG_INVITATIONS_PREVIEW_MEDIA_TYPE = "application/vnd.github.the-wasp-preview+json".freeze
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       9 
11 
     | 
    
         
             
                  # Get an organization
         
     | 
| 
       10 
12 
     | 
    
         
             
                  #
         
     | 
| 
       11 
13 
     | 
    
         
             
                  # @param org [String, Integer] Organization GitHub login or id.
         
     | 
| 
         @@ -302,6 +304,15 @@ module Octokit 
     | 
|
| 
       302 
304 
     | 
    
         
             
                  # @see https://developer.github.com/v3/orgs/teams/#add-team-member
         
     | 
| 
       303 
305 
     | 
    
         
             
                  # @example
         
     | 
| 
       304 
306 
     | 
    
         
             
                  #   @client.add_team_member(100000, 'pengwynn')
         
     | 
| 
      
 307 
     | 
    
         
            +
                  #
         
     | 
| 
      
 308 
     | 
    
         
            +
                  # @example
         
     | 
| 
      
 309 
     | 
    
         
            +
                  #   # Invite a member to a team. The user won't be added to the 
         
     | 
| 
      
 310 
     | 
    
         
            +
                  #   # team until he/she accepts the invite via email.
         
     | 
| 
      
 311 
     | 
    
         
            +
                  #   @client.add_team_member \
         
     | 
| 
      
 312 
     | 
    
         
            +
                  #     100000,
         
     | 
| 
      
 313 
     | 
    
         
            +
                  #     'pengwynn',
         
     | 
| 
      
 314 
     | 
    
         
            +
                  #     :accept => "application/vnd.github.the-wasp-preview+json"
         
     | 
| 
      
 315 
     | 
    
         
            +
                  # @see https://developer.github.com/changes/2014-08-05-team-memberships-api/
         
     | 
| 
       305 
316 
     | 
    
         
             
                  def add_team_member(team_id, user, options = {})
         
     | 
| 
       306 
317 
     | 
    
         
             
                    # There's a bug in this API call. The docs say to leave the body blank,
         
     | 
| 
       307 
318 
     | 
    
         
             
                    # but it fails if the body is both blank and the content-length header
         
     | 
| 
         @@ -473,6 +484,72 @@ module Octokit 
     | 
|
| 
       473 
484 
     | 
    
         
             
                  def user_teams(options = {})
         
     | 
| 
       474 
485 
     | 
    
         
             
                    paginate "/user/teams", options
         
     | 
| 
       475 
486 
     | 
    
         
             
                  end
         
     | 
| 
      
 487 
     | 
    
         
            +
             
     | 
| 
      
 488 
     | 
    
         
            +
                  # Check if a user has a team membership.
         
     | 
| 
      
 489 
     | 
    
         
            +
                  #
         
     | 
| 
      
 490 
     | 
    
         
            +
                  # @param team_id [Integer] Team id.
         
     | 
| 
      
 491 
     | 
    
         
            +
                  # @param user [String] GitHub username of the user to check.
         
     | 
| 
      
 492 
     | 
    
         
            +
                  #
         
     | 
| 
      
 493 
     | 
    
         
            +
                  # @return [Sawyer::Resource] Hash of team membership info
         
     | 
| 
      
 494 
     | 
    
         
            +
                  #
         
     | 
| 
      
 495 
     | 
    
         
            +
                  # @see https://developer.github.com/v3/orgs/teams/#get-team-membership
         
     | 
| 
      
 496 
     | 
    
         
            +
                  #
         
     | 
| 
      
 497 
     | 
    
         
            +
                  # @example Check if a user has a membership for a team
         
     | 
| 
      
 498 
     | 
    
         
            +
                  #   @client.team_membership(1234, 'pengwynn')
         
     | 
| 
      
 499 
     | 
    
         
            +
                  #   => false
         
     | 
| 
      
 500 
     | 
    
         
            +
                  def team_membership(team_id, user, options = {})
         
     | 
| 
      
 501 
     | 
    
         
            +
                    options = ensure_org_invitations_api_media_type(options)
         
     | 
| 
      
 502 
     | 
    
         
            +
                    get "teams/#{team_id}/memberships/#{user}", options
         
     | 
| 
      
 503 
     | 
    
         
            +
                  end
         
     | 
| 
      
 504 
     | 
    
         
            +
             
     | 
| 
      
 505 
     | 
    
         
            +
                  # Invite a user to a team
         
     | 
| 
      
 506 
     | 
    
         
            +
                  #
         
     | 
| 
      
 507 
     | 
    
         
            +
                  # @param team_id [Integer] Team id.
         
     | 
| 
      
 508 
     | 
    
         
            +
                  # @param user [String] GitHub username of the user to invite.
         
     | 
| 
      
 509 
     | 
    
         
            +
                  #
         
     | 
| 
      
 510 
     | 
    
         
            +
                  # @return [Sawyer::Resource] Hash of team membership info
         
     | 
| 
      
 511 
     | 
    
         
            +
                  #
         
     | 
| 
      
 512 
     | 
    
         
            +
                  # @see https://developer.github.com/v3/orgs/teams/#add-team-membership
         
     | 
| 
      
 513 
     | 
    
         
            +
                  #
         
     | 
| 
      
 514 
     | 
    
         
            +
                  # @example Check if a user has a membership for a team
         
     | 
| 
      
 515 
     | 
    
         
            +
                  #   @client.add_team_membership(1234, 'pengwynn')
         
     | 
| 
      
 516 
     | 
    
         
            +
                  #   => false
         
     | 
| 
      
 517 
     | 
    
         
            +
                  def add_team_membership(team_id, user, options = {})
         
     | 
| 
      
 518 
     | 
    
         
            +
                    options = ensure_org_invitations_api_media_type(options)
         
     | 
| 
      
 519 
     | 
    
         
            +
                    put "teams/#{team_id}/memberships/#{user}", options
         
     | 
| 
      
 520 
     | 
    
         
            +
                  end
         
     | 
| 
      
 521 
     | 
    
         
            +
             
     | 
| 
      
 522 
     | 
    
         
            +
                  # Remove team membership
         
     | 
| 
      
 523 
     | 
    
         
            +
                  #
         
     | 
| 
      
 524 
     | 
    
         
            +
                  # @param team_id [Integer] Team id.
         
     | 
| 
      
 525 
     | 
    
         
            +
                  # @param user [String] GitHub username of the user to boot.
         
     | 
| 
      
 526 
     | 
    
         
            +
                  # @return [Boolean] True if user removed, false otherwise.
         
     | 
| 
      
 527 
     | 
    
         
            +
                  # @see https://developer.github.com/v3/orgs/teams/#remove-team-membership
         
     | 
| 
      
 528 
     | 
    
         
            +
                  # @example
         
     | 
| 
      
 529 
     | 
    
         
            +
                  #   @client.remove_team_membership(100000, 'pengwynn')
         
     | 
| 
      
 530 
     | 
    
         
            +
                  def remove_team_membership(team_id, user, options = {})
         
     | 
| 
      
 531 
     | 
    
         
            +
                    options = ensure_org_invitations_api_media_type(options)
         
     | 
| 
      
 532 
     | 
    
         
            +
                    boolean_from_response :delete, "teams/#{team_id}/memberships/#{user}", options
         
     | 
| 
      
 533 
     | 
    
         
            +
                  end
         
     | 
| 
      
 534 
     | 
    
         
            +
             
     | 
| 
      
 535 
     | 
    
         
            +
                  private
         
     | 
| 
      
 536 
     | 
    
         
            +
             
     | 
| 
      
 537 
     | 
    
         
            +
                  def ensure_org_invitations_api_media_type(options = {})
         
     | 
| 
      
 538 
     | 
    
         
            +
                    if options[:accept].nil?
         
     | 
| 
      
 539 
     | 
    
         
            +
                      options[:accept] = ORG_INVITATIONS_PREVIEW_MEDIA_TYPE
         
     | 
| 
      
 540 
     | 
    
         
            +
                      warn_org_invitations_preview
         
     | 
| 
      
 541 
     | 
    
         
            +
                    end
         
     | 
| 
      
 542 
     | 
    
         
            +
             
     | 
| 
      
 543 
     | 
    
         
            +
                    options
         
     | 
| 
      
 544 
     | 
    
         
            +
                  end
         
     | 
| 
      
 545 
     | 
    
         
            +
             
     | 
| 
      
 546 
     | 
    
         
            +
                  def warn_org_invitations_preview
         
     | 
| 
      
 547 
     | 
    
         
            +
                    octokit_warn \
         
     | 
| 
      
 548 
     | 
    
         
            +
                      "WARNING: The preview version of the Organization Team Memberships API " \
         
     | 
| 
      
 549 
     | 
    
         
            +
                      "is not yet suitable for production use. You can avoid this message by " \
         
     | 
| 
      
 550 
     | 
    
         
            +
                      "supplying an appropriate media type in the 'Accept' request header. " \
         
     | 
| 
      
 551 
     | 
    
         
            +
                      "See the blog post for details: http://git.io/a9jglQ"
         
     | 
| 
      
 552 
     | 
    
         
            +
                  end
         
     | 
| 
       476 
553 
     | 
    
         
             
                end
         
     | 
| 
       477 
554 
     | 
    
         
             
              end
         
     | 
| 
       478 
555 
     | 
    
         
             
            end
         
     | 
    
        data/lib/octokit/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: octokit
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Wynn Netherland
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2014-06 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2014-08-06 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -54,10 +54,11 @@ files: 
     | 
|
| 
       54 
54 
     | 
    
         
             
            - LICENSE.md
         
     | 
| 
       55 
55 
     | 
    
         
             
            - README.md
         
     | 
| 
       56 
56 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       57 
     | 
    
         
            -
            - octokit. 
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/octokit.rb
         
     | 
| 
       58 
58 
     | 
    
         
             
            - lib/octokit/arguments.rb
         
     | 
| 
       59 
59 
     | 
    
         
             
            - lib/octokit/authentication.rb
         
     | 
| 
       60 
60 
     | 
    
         
             
            - lib/octokit/backports/uri.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/octokit/client.rb
         
     | 
| 
       61 
62 
     | 
    
         
             
            - lib/octokit/client/authorizations.rb
         
     | 
| 
       62 
63 
     | 
    
         
             
            - lib/octokit/client/commit_comments.rb
         
     | 
| 
       63 
64 
     | 
    
         
             
            - lib/octokit/client/commits.rb
         
     | 
| 
         @@ -92,7 +93,6 @@ files: 
     | 
|
| 
       92 
93 
     | 
    
         
             
            - lib/octokit/client/stats.rb
         
     | 
| 
       93 
94 
     | 
    
         
             
            - lib/octokit/client/statuses.rb
         
     | 
| 
       94 
95 
     | 
    
         
             
            - lib/octokit/client/users.rb
         
     | 
| 
       95 
     | 
    
         
            -
            - lib/octokit/client.rb
         
     | 
| 
       96 
96 
     | 
    
         
             
            - lib/octokit/configurable.rb
         
     | 
| 
       97 
97 
     | 
    
         
             
            - lib/octokit/default.rb
         
     | 
| 
       98 
98 
     | 
    
         
             
            - lib/octokit/error.rb
         
     | 
| 
         @@ -105,7 +105,7 @@ files: 
     | 
|
| 
       105 
105 
     | 
    
         
             
            - lib/octokit/response/raise_error.rb
         
     | 
| 
       106 
106 
     | 
    
         
             
            - lib/octokit/user.rb
         
     | 
| 
       107 
107 
     | 
    
         
             
            - lib/octokit/version.rb
         
     | 
| 
       108 
     | 
    
         
            -
            -  
     | 
| 
      
 108 
     | 
    
         
            +
            - octokit.gemspec
         
     | 
| 
       109 
109 
     | 
    
         
             
            homepage: https://github.com/octokit/octokit.rb
         
     | 
| 
       110 
110 
     | 
    
         
             
            licenses:
         
     | 
| 
       111 
111 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       126 
126 
     | 
    
         
             
                  version: 1.3.5
         
     | 
| 
       127 
127 
     | 
    
         
             
            requirements: []
         
     | 
| 
       128 
128 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       129 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 129 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       130 
130 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       131 
131 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       132 
132 
     | 
    
         
             
            summary: Ruby toolkit for working with the GitHub API
         
     |