Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/axiom/types/token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Axiom::Types::Token < Axiom::Types::String
def self.infer(object)
if object == Axiom::Types::Token
self
end
end
end
1 change: 1 addition & 0 deletions lib/cc/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Service
require "cc/service/formatter"
require "cc/service/invocation"
require "axiom/types/password"
require "axiom/types/token"

dir = File.expand_path "../helpers", __FILE__
Dir["#{dir}/*_helper.rb"].sort.each do |helper|
Expand Down
4 changes: 2 additions & 2 deletions lib/cc/services/asana.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CC::Service::Asana < CC::Service
class Config < CC::Service::Config
attribute :personal_access_token, Axiom::Types::String, label: "Personal Access Token"
attribute :api_key, Axiom::Types::String, label: "API key (Deprecated)"
attribute :personal_access_token, Axiom::Types::Token, label: "Personal Access Token"
attribute :api_key, Axiom::Types::Token, label: "API key (Deprecated)"

attribute :workspace_id, Axiom::Types::String, label: "Workspace ID"

Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/campfire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class CC::Service::Campfire < CC::Service
class Config < CC::Service::Config
attribute :subdomain, Axiom::Types::String,
description: "The Campfire subdomain for the account"
attribute :token, Axiom::Types::String,
attribute :token, Axiom::Types::Token,
description: "Your Campfire API auth token"
attribute :room_id, Axiom::Types::String,
description: "Check your campfire URL for a room ID. Usually 6 digits."
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/flowdock.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CC::Service::Flowdock < CC::Service
class Config < CC::Service::Config
attribute :api_token, Axiom::Types::String,
attribute :api_token, Axiom::Types::Token,
label: "API Token",
description: "The API token of the Flow to send notifications to",
link: "https://www.flowdock.com/account/tokens"
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/github_issues.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CC::Service::GitHubIssues < CC::Service
class Config < CC::Service::Config
attribute :oauth_token, Axiom::Types::String,
attribute :oauth_token, Axiom::Types::Token,
label: "OAuth Token",
description: "A personal OAuth token with permissions for the repo"
attribute :project, Axiom::Types::String,
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/github_pull_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CC::Service::GitHubPullRequests < CC::PullRequests
class Config < CC::Service::Config
attribute :oauth_token, Axiom::Types::String,
attribute :oauth_token, Axiom::Types::Token,
label: "OAuth Token",
description: "A personal OAuth token with permissions for the repo."
attribute :base_url, Axiom::Types::String,
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/gitlab_merge_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class CC::Service::GitlabMergeRequests < CC::PullRequests
class Config < CC::Service::Config
CONTEXT = "codeclimate".freeze

attribute :access_token, Axiom::Types::String,
attribute :access_token, Axiom::Types::Token,
label: "Access Token",
description: "A personal access token with permissions for the repo."
attribute :base_url, Axiom::Types::String,
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/hipchat.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CC::Service::HipChat < CC::Service
class Config < CC::Service::Config
attribute :auth_token, Axiom::Types::String,
attribute :auth_token, Axiom::Types::Token,
description: "Your HipChat API auth token"

attribute :room_id, Axiom::Types::String,
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/lighthouse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Config < CC::Service::Config
attribute :subdomain, Axiom::Types::String,
description: "Your Lighthouse subdomain"

attribute :api_token, Axiom::Types::String,
attribute :api_token, Axiom::Types::Token,
label: "API Token",
description: "Your Lighthouse API Key (http://help.lighthouseapp.com/kb/api/how-do-i-get-an-api-token)"

Expand Down
2 changes: 1 addition & 1 deletion lib/cc/services/pivotal_tracker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CC::Service::PivotalTracker < CC::Service
class Config < CC::Service::Config
attribute :api_token, Axiom::Types::String,
attribute :api_token, Axiom::Types::Token,
description: "Your Pivotal Tracker API Token, from your profile page"

attribute :project_id, Axiom::Types::String,
Expand Down
14 changes: 14 additions & 0 deletions spec/axiom/types/token_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe Axiom::Types::Token do
class TestConfiguration < CC::Service::Config
attribute :token_attribute, Token
attribute :str_attribute, String
end

it "token type inference" do
expect(Axiom::Types::Token).to eq(TestConfiguration.attribute_set[:token_attribute].type)
end

it "string type inference" do
expect(Axiom::Types::String).to eq(TestConfiguration.attribute_set[:str_attribute].type)
end
end