octokit 1.9.4 → 1.10.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.
- data/CHANGELOG.md +2 -0
- data/lib/octokit/client/contents.rb +3 -3
- data/lib/octokit/client/markdown.rb +1 -1
- data/lib/octokit/client/repositories.rb +4 -0
- data/lib/octokit/request.rb +3 -2
- data/lib/octokit/version.rb +1 -1
- data/spec/fixtures/v3/repo_assignees.json +30 -0
- data/spec/octokit/client/repositories_spec.rb +11 -0
- metadata +4 -2
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            # CHANGELOG
         | 
| 2 2 |  | 
| 3 | 
            +
            * [1.10.0 - August 8,
         | 
| 4 | 
            +
            * 2012](https://github.com/pengwynn/octokit/compare/v1.9.4...v1.10.0)
         | 
| 3 5 | 
             
            * [1.9.4 - August 6, 2012](https://github.com/pengwynn/octokit/compare/v1.9.3...v1.9.4)
         | 
| 4 6 | 
             
            * [1.9.3 - July 27, 2012](https://github.com/pengwynn/octokit/compare/v1.9.2...v1.9.3)
         | 
| 5 7 | 
             
            * [1.9.2 - July 25, 2012](https://github.com/pengwynn/octokit/compare/v1.9.1...v1.9.2)
         | 
| @@ -12,7 +12,7 @@ module Octokit | |
| 12 12 | 
             
              # @example Get the readme file for a repo
         | 
| 13 13 | 
             
              #   Octokit.readme("pengwynn/octokit")
         | 
| 14 14 | 
             
              def readme(repo, options={})
         | 
| 15 | 
            -
                get(" | 
| 15 | 
            +
                get("repos/#{Repository.new repo}/readme", options, 3)
         | 
| 16 16 | 
             
              end
         | 
| 17 17 |  | 
| 18 18 | 
             
              # Receive a listing of a repository folder or the contents of a file
         | 
| @@ -26,7 +26,7 @@ module Octokit | |
| 26 26 | 
             
              #   Octokit.contents("pengwynn/octokit", :path => 'lib/octokit.rb')
         | 
| 27 27 | 
             
              def contents(repo, options={})
         | 
| 28 28 | 
             
                repo_path = options.delete :path
         | 
| 29 | 
            -
                url = " | 
| 29 | 
            +
                url = "repos/#{Repository.new repo}/contents/#{repo_path}"
         | 
| 30 30 | 
             
                get(url, options, 3)
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| @@ -42,7 +42,7 @@ module Octokit | |
| 42 42 | 
             
              def archive_link(repo, options={})
         | 
| 43 43 | 
             
                repo_ref = options.delete :ref
         | 
| 44 44 | 
             
                format = (options.delete :format) || 'tarball'
         | 
| 45 | 
            -
                url = " | 
| 45 | 
            +
                url = "repos/#{Repository.new repo}/#{format}/#{repo_ref}"
         | 
| 46 46 | 
             
                headers = get(url, options, 3, false, true).headers
         | 
| 47 47 | 
             
                return headers['location']
         | 
| 48 48 | 
             
              end
         | 
| @@ -181,6 +181,10 @@ module Octokit | |
| 181 181 | 
             
                  end
         | 
| 182 182 | 
             
                  alias :repo_issue_events :repository_issue_events
         | 
| 183 183 |  | 
| 184 | 
            +
                  def repository_assignees(repo, options={})
         | 
| 185 | 
            +
                    get "repos/#{Repository.new repo}/assignees", options, 3
         | 
| 186 | 
            +
                  end
         | 
| 187 | 
            +
                  alias :repo_assignees :repository_assignees
         | 
| 184 188 | 
             
                end
         | 
| 185 189 | 
             
              end
         | 
| 186 190 | 
             
            end
         | 
    
        data/lib/octokit/request.rb
    CHANGED
    
    | @@ -23,13 +23,13 @@ module Octokit | |
| 23 23 | 
             
                end
         | 
| 24 24 |  | 
| 25 25 | 
             
                def ratelimit
         | 
| 26 | 
            -
                  headers = get(" | 
| 26 | 
            +
                  headers = get("rate_limit",{}, api_version, true, true).headers
         | 
| 27 27 | 
             
                  return headers["X-RateLimit-Limit"].to_i
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
                alias rate_limit ratelimit
         | 
| 30 30 |  | 
| 31 31 | 
             
                def ratelimit_remaining
         | 
| 32 | 
            -
                  headers = get(" | 
| 32 | 
            +
                  headers = get("rate_limit",{}, api_version, true, true).headers
         | 
| 33 33 | 
             
                  return headers["X-RateLimit-Remaining"].to_i
         | 
| 34 34 | 
             
                end
         | 
| 35 35 | 
             
                alias rate_limit_remaining ratelimit_remaining
         | 
| @@ -37,6 +37,7 @@ module Octokit | |
| 37 37 | 
             
                private
         | 
| 38 38 |  | 
| 39 39 | 
             
                def request(method, path, options, version, authenticate, raw, force_urlencoded)
         | 
| 40 | 
            +
                  path.sub(%r{^/}, '') #leading slash in path fails in github:enterprise
         | 
| 40 41 | 
             
                  response = connection(authenticate, raw, version, force_urlencoded).send(method) do |request|
         | 
| 41 42 | 
             
                    case method
         | 
| 42 43 | 
             
                    when :delete, :get
         | 
    
        data/lib/octokit/version.rb
    CHANGED
    
    
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            [
         | 
| 2 | 
            +
              {
         | 
| 3 | 
            +
                "gravatar_id": "6490beb544d67d937dfb99a6b3ed6e44",
         | 
| 4 | 
            +
                "avatar_url": "https://secure.gravatar.com/avatar/6490beb544d67d937dfb99a6b3ed6e44?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
         | 
| 5 | 
            +
                "login": "adamstac",
         | 
| 6 | 
            +
                "url": "https://api.github.com/users/adamstac",
         | 
| 7 | 
            +
                "id": 2933
         | 
| 8 | 
            +
              },
         | 
| 9 | 
            +
              {
         | 
| 10 | 
            +
                "gravatar_id": "dfb3948650131e4f0385c3328187cfca",
         | 
| 11 | 
            +
                "avatar_url": "https://secure.gravatar.com/avatar/dfb3948650131e4f0385c3328187cfca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
         | 
| 12 | 
            +
                "login": "ctshryock",
         | 
| 13 | 
            +
                "url": "https://api.github.com/users/ctshryock",
         | 
| 14 | 
            +
                "id": 61721
         | 
| 15 | 
            +
              },
         | 
| 16 | 
            +
              {
         | 
| 17 | 
            +
                "gravatar_id": "7e19cd5486b5d6dc1ef90e671ba52ae0",
         | 
| 18 | 
            +
                "avatar_url": "https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
         | 
| 19 | 
            +
                "login": "pengwynn",
         | 
| 20 | 
            +
                "url": "https://api.github.com/users/pengwynn",
         | 
| 21 | 
            +
                "id": 865
         | 
| 22 | 
            +
              },
         | 
| 23 | 
            +
              {
         | 
| 24 | 
            +
                "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb",
         | 
| 25 | 
            +
                "avatar_url": "https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
         | 
| 26 | 
            +
                "login": "sferik",
         | 
| 27 | 
            +
                "url": "https://api.github.com/users/sferik",
         | 
| 28 | 
            +
                "id": 10308
         | 
| 29 | 
            +
              }
         | 
| 30 | 
            +
            ]
         | 
| @@ -405,4 +405,15 @@ describe Octokit::Client::Repositories do | |
| 405 405 |  | 
| 406 406 | 
             
              end
         | 
| 407 407 |  | 
| 408 | 
            +
              describe ".assignees" do
         | 
| 409 | 
            +
             | 
| 410 | 
            +
                it "should list all the available assignees (owner + collaborators)" do
         | 
| 411 | 
            +
                  stub_get("/repos/pengwynn/octokit/assignees").
         | 
| 412 | 
            +
                  to_return(:body => fixture("v3/repo_assignees.json"))
         | 
| 413 | 
            +
                  assignees = @client.repo_assignees("pengwynn/octokit") 
         | 
| 414 | 
            +
                  assignees.first.login.should == "adamstac"
         | 
| 415 | 
            +
                end
         | 
| 416 | 
            +
             | 
| 417 | 
            +
              end
         | 
| 418 | 
            +
             | 
| 408 419 | 
             
            end
         | 
    
        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: 1. | 
| 4 | 
            +
              version: 1.10.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -11,7 +11,7 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2012-08- | 
| 14 | 
            +
            date: 2012-08-09 00:00:00.000000000 Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: addressable
         | 
| @@ -320,6 +320,7 @@ files: | |
| 320 320 | 
             
            - spec/fixtures/v3/ref_update.json
         | 
| 321 321 | 
             
            - spec/fixtures/v3/refs.json
         | 
| 322 322 | 
             
            - spec/fixtures/v3/refs_tags.json
         | 
| 323 | 
            +
            - spec/fixtures/v3/repo_assignees.json
         | 
| 323 324 | 
             
            - spec/fixtures/v3/repo_events.json
         | 
| 324 325 | 
             
            - spec/fixtures/v3/repo_issues_events.json
         | 
| 325 326 | 
             
            - spec/fixtures/v3/repositories.json
         | 
| @@ -449,6 +450,7 @@ test_files: | |
| 449 450 | 
             
            - spec/fixtures/v3/ref_update.json
         | 
| 450 451 | 
             
            - spec/fixtures/v3/refs.json
         | 
| 451 452 | 
             
            - spec/fixtures/v3/refs_tags.json
         | 
| 453 | 
            +
            - spec/fixtures/v3/repo_assignees.json
         | 
| 452 454 | 
             
            - spec/fixtures/v3/repo_events.json
         | 
| 453 455 | 
             
            - spec/fixtures/v3/repo_issues_events.json
         | 
| 454 456 | 
             
            - spec/fixtures/v3/repositories.json
         |