Skip to content

Commit

Permalink
Make default GitHub API version a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
BanzaiMan committed Jan 7, 2016
1 parent 1ef843a commit 3a2178f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/dpl/provider/releases.rb
Expand Up @@ -3,6 +3,8 @@ class Provider
class Releases < Provider
require 'pathname'

DEFAULT_GITHUB_API_VERSION = '3'

requires 'octokit'
requires 'mime-types', version: '~> 2.0'

Expand Down Expand Up @@ -128,7 +130,7 @@ def push_app
def api_endpoint
if options[:host]
host = options[:host]
api_version = options[:api_version] || '3'
api_version = options[:api_version] || DEFAULT_GITHUB_API_VERSION
"https://#{host}/api/v#{api_version}"
else
"https://api.github.com"
Expand Down
2 changes: 1 addition & 1 deletion spec/provider/releases_spec.rb
Expand Up @@ -272,7 +272,7 @@
end

it "returns 'https://example.com/api/v3'" do
expect(provider.api_endpoint).to eq('https://example.com/api/v3')
expect(provider.api_endpoint).to eq("https://example.com/api/v#{DPL::Provider::Releases::DEFAULT_GITHUB_API_VERSION}")
end

context "and api_version '4' is given" do
Expand Down

0 comments on commit 3a2178f

Please sign in to comment.