Skip to content

Commit c1bda3d

Browse files
committed
follow hound rule: prefer single-quoted strings
1 parent 0baceca commit c1bda3d

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

lib/fcm.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ def send_notification_v1(message)
5252

5353
post_body = { 'message': message }
5454
extra_headers = {
55-
"Authorization" => "Bearer #{jwt_token}"
55+
'Authorization' => "Bearer #{jwt_token}"
5656
}
5757
for_uri(BASE_URI_V1, extra_headers) do |connection|
58-
response = connection.post("#{@project_name}/messages:send", post_body.to_json)
58+
response = connection.post(
59+
"#{@project_name}/messages:send", post_body.to_json
60+
)
5961
build_response(response)
6062
end
6163
end
@@ -224,7 +226,7 @@ def for_uri(uri, extra_headers = {})
224226
) do |faraday|
225227
faraday.adapter Faraday.default_adapter
226228
faraday.headers["Content-Type"] = "application/json"
227-
faraday.headers["Authorization"] = "key=#{@api_key}"
229+
faraday.headers['Authorization'] = "key=#{@api_key}"
228230
extra_headers.each do |key, value|
229231
faraday.headers[key] = value
230232
end

spec/fcm_spec.rb

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,38 @@
3636

3737
let(:send_v1_params) do
3838
{
39-
"token" => "4sdsx",
40-
"notification" => {
41-
"title" => "Breaking News",
42-
"body" => "New news story available."
39+
'token' => '4sdsx',
40+
'notification' => {
41+
'title' => 'Breaking News',
42+
'body' => 'New news story available.'
4343
},
44-
"data" => {
45-
"story_id" => "story_12345"
44+
'data' => {
45+
'story_id' => 'story_12345'
4646
},
47-
"android" => {
48-
"notification" => {
49-
"click_action": "TOP_STORY_ACTIVITY",
50-
"body" => "Check out the Top Story"
47+
'android' => {
48+
'notification' => {
49+
'click_action' => 'TOP_STORY_ACTIVITY',
50+
'body' => 'Check out the Top Story'
5151
}
5252
},
53-
"apns" => {
54-
"payload" => {
55-
"aps" => {
56-
"category" => "NEW_MESSAGE_CATEGORY"
53+
'apns' => {
54+
'payload' => {
55+
'aps' => {
56+
'category' => 'NEW_MESSAGE_CATEGORY'
5757
}
5858
}
5959
}
6060
}
6161
end
6262

6363
let(:valid_request_v1_body) do
64-
{ "message" => send_v1_params }
64+
{ 'message' => send_v1_params }
6565
end
6666

6767
let(:stub_fcm_send_v1_request) do
6868
stub_request(:post, send_v1_url).with(
6969
body: valid_request_v1_body.to_json,
70-
headers: valid_request_v1_headers,
70+
headers: valid_request_v1_headers
7171
).to_return(
7272
# ref: https://firebase.google.com/docs/cloud-messaging/http-server-ref#interpret-downstream
7373
body: "{}",
@@ -86,9 +86,11 @@
8686
stub_fcm_send_v1_request
8787
end
8888

89-
it "should send notification of HTTP V1 using POST to FCM server" do
89+
it 'should send notification of HTTP V1 using POST to FCM server' do
9090
fcm = FCM.new(api_key, json_key_path, project_name)
91-
fcm.send_v1(send_v1_params).should eq(response: "success", body: "{}", headers: {}, status_code: 200)
91+
fcm.send_v1(send_v1_params).should eq(
92+
response: 'success', body: '{}', headers: {}, status_code: 200
93+
)
9294
stub_fcm_send_v1_request.should have_been_made.times(1)
9395
end
9496
end

0 commit comments

Comments
 (0)