Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit a58e91d

Browse files
author
Jon Yurek
committed
Change the name of the #post method
Stubbing `POST`s in the main codeclimate repo gets confused with stubbing the #post method here. So, change this method.
1 parent ad97e4c commit a58e91d

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

lib/cc/service/http.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def default_http_options
1515
end
1616
end
1717

18-
def get(url = nil, body = nil, headers = nil, &block)
18+
def service_get(url = nil, body = nil, headers = nil, &block)
1919
raw_get(url, body, headers, &block)
2020
end
2121

22-
def post(url, body = nil, headers = nil, &block)
22+
def service_post(url, body = nil, headers = nil, &block)
2323
block ||= lambda{|*args| Hash.new }
2424
response = raw_post(url, body, headers)
2525
{

lib/cc/services/asana.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def create_task(name)
5151
params = generate_params(name)
5252
authenticate_http
5353
http.headers["Content-Type"] = "application/json"
54-
post(ENDPOINT, params.to_json) do |response|
54+
service_post(ENDPOINT, params.to_json) do |response|
5555
body = JSON.parse(response.body)
5656
id = body['data']['id']
5757
url = "https://app.asana.com/0/#{config.workspace_id}/#{id}"

lib/cc/services/campfire.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def speak(line)
4343
params = { message: { body: line } }
4444

4545
http.basic_auth(config.token, "X")
46-
post(speak_uri, params.to_json)
46+
service_post(speak_uri, params.to_json)
4747
end
4848

4949
def speak_uri

lib/cc/services/flowdock.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ def notify(subject, project, content)
5656
url = "#{BASE_URL}/messages/team_inbox/#{config.api_token}"
5757
http.headers["User-Agent"] = "Code Climate"
5858

59-
post(url, params)
59+
service_post(url, params)
6060
end
6161
end

lib/cc/services/github_issues.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def create_issue(title, issue_body)
5959
http.headers["User-Agent"] = "Code Climate"
6060

6161
url = "#{BASE_URL}/repos/#{config.project}/issues"
62-
post(url, params.to_json) do |response|
62+
service_post(url, params.to_json) do |response|
6363
body = JSON.parse(response.body)
6464
{
6565
id: body["id"],

lib/cc/services/github_pull_requests.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def update_status(state, description)
9292
target_url: @payload["details_url"],
9393
context: "codeclimate"
9494
}
95-
post(status_url, params.to_json)
95+
service_post(status_url, params.to_json)
9696
end
9797
end
9898

@@ -102,7 +102,7 @@ def add_comment
102102
body: COMMENT_BODY % @payload["compare_url"]
103103
}.to_json
104104

105-
post(comments_url, body) do |response|
105+
service_post(comments_url, body) do |response|
106106
doc = JSON.parse(response.body)
107107
{ id: doc["id"] }
108108
end
@@ -128,7 +128,7 @@ def receive_test_status
128128
end
129129

130130
def receive_test_comment
131-
response = get(user_url)
131+
response = service_get(user_url)
132132
if response_includes_repo_scope?(response)
133133
{ ok: true, message: "OAuth token is valid" }
134134
else
@@ -139,7 +139,7 @@ def receive_test_comment
139139
end
140140

141141
def comment_present?
142-
response = get(comments_url)
142+
response = service_get(comments_url)
143143
comments = JSON.parse(response.body)
144144

145145
comments.any? { |comment| comment["body"] =~ BODY_REGEX }

lib/cc/services/hipchat.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def speak(message, color)
5151
notify: !!config.notify,
5252
color: color
5353
}
54-
post(url, params)
54+
service_post(url, params)
5555
end
5656

5757
end

lib/cc/services/jira.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def create_ticket(title, ticket_body)
7272

7373
url = "https://#{config.domain}/rest/api/2/issue/"
7474

75-
post(url, params.to_json) do |response|
75+
service_post(url, params.to_json) do |response|
7676
body = JSON.parse(response.body)
7777
{
7878
id: body["id"],

lib/cc/services/lighthouse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def create_ticket(title, ticket_body)
5959
base_url = "https://#{config.subdomain}.lighthouseapp.com"
6060
url = "#{base_url}/projects/#{config.project_id}/tickets.json"
6161

62-
post(url, params.to_json) do |response|
62+
service_post(url, params.to_json) do |response|
6363
body = JSON.parse(response.body)
6464
{
6565
id: body["ticket"]["number"],

lib/cc/services/pivotal_tracker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def create_story(name, description)
5858
http.headers["X-TrackerToken"] = config.api_token
5959
url = "#{BASE_URL}/projects/#{config.project_id}/stories"
6060

61-
post(url, params) do |response|
61+
service_post(url, params) do |response|
6262
body = Nokogiri::XML(response.body)
6363
{
6464
id: (body / "story/id").text,

0 commit comments

Comments
 (0)