From 13f0cccbf6a3c5da9dc970eb1d660fd93d0c15a9 Mon Sep 17 00:00:00 2001 From: YuzuruS Date: Tue, 15 Oct 2019 14:16:57 +0900 Subject: [PATCH] fix method name send => ping --- Gemfile.lock | 2 +- README.md | 4 ++-- lib/line_notify/client.rb | 2 +- lib/line_notify/version.rb | 2 +- spec/line_notify_spec.rb | 14 +++++++------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e4fe4b0..b435924 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - line_notify (1.0.0) + line_notify (1.0.1) GEM remote: https://rubygems.org/ diff --git a/README.md b/README.md index 2713c28..21d0e9b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Or install it yourself as: ```ruby line_notify = LineNotify.new(YOUR_LINE_TOKEN) options = {message: 'hoge', stickerPackageId: 1, stickerId: 113} -line_notify.send(options) +line_notify.ping(options) ``` @@ -48,7 +48,7 @@ options = { imageFullsize: "https://www.pakutaso.com/shared/img/thumb/SAYAPAKU5347_TP_V4.jpg", imageThumbnail: "https://www.pakutaso.com/shared/img/thumb/SAYAPAKU5347_TP_V.jpg" } -line_notify.send(options) +line_notify.ping(options) ``` ![2018-02-16 0 53 38](https://user-images.githubusercontent.com/1485195/36266096-0ece0310-12b4-11e8-9b7e-67af11dadf9f.png) diff --git a/lib/line_notify/client.rb b/lib/line_notify/client.rb index d7d5344..62bd3cc 100644 --- a/lib/line_notify/client.rb +++ b/lib/line_notify/client.rb @@ -9,7 +9,7 @@ def initialize(access_token) @access_token = (access_token || ENV['LINE_ACCESS_TOKEN']) end - def send(options) + def ping(options) request = create_request(options) Net::HTTP.start(URI.hostname, URI.port, use_ssl: URI.scheme == "https") do |req| req.request(request) diff --git a/lib/line_notify/version.rb b/lib/line_notify/version.rb index 57100df..0024536 100644 --- a/lib/line_notify/version.rb +++ b/lib/line_notify/version.rb @@ -1,3 +1,3 @@ module LineNotify - VERSION = "1.0.0" + VERSION = "1.0.1" end diff --git a/spec/line_notify_spec.rb b/spec/line_notify_spec.rb index 1cc081c..fddd716 100644 --- a/spec/line_notify_spec.rb +++ b/spec/line_notify_spec.rb @@ -4,22 +4,22 @@ @cli = LineNotify.new end it "半角英数字メッセージが送信できること" do - res = @cli.send({message: "hoge123"}) + res = @cli.ping({message: "hoge123"}) expect(Net::HTTPSuccess === res).to eq true end it "日本語メッセージが送信できること" do - res = @cli.send({message: "ふが"}) + res = @cli.ping({message: "ふが"}) expect(Net::HTTPSuccess === res).to eq true end it "スタンプが送信できること" do - res = @cli.send({message: 'メッセージ', stickerPackageId: 1, stickerId: 113}) + res = @cli.ping({message: 'メッセージ', stickerPackageId: 1, stickerId: 113}) expect(Net::HTTPSuccess === res).to eq true end it "画像が送信できること" do - res = @cli.send({ + res = @cli.ping({ message: '可愛い画像', imageFullsize: "https://www.pakutaso.com/shared/img/thumb/SAYAPAKU5347_TP_V4.jpg", imageThumbnail: "https://www.pakutaso.com/shared/img/thumb/SAYAPAKU5347_TP_V.jpg" @@ -33,17 +33,17 @@ @cli = LineNotify.new end it "空メッセージ" do - res = @cli.send({message: ""}) + res = @cli.ping({message: ""}) expect(Net::HTTPSuccess === res).to eq false end it "stickerIdがたりない" do - res = @cli.send({message: 'メッセージ', stickerPackageId: 1}) + res = @cli.ping({message: 'メッセージ', stickerPackageId: 1}) expect(Net::HTTPSuccess === res).to eq false end it "サムネイルが足りない" do - res = @cli.send({ + res = @cli.ping({ message: 'メッセージ', imageFullsize: "https://www.pakutaso.com/shared/img/thumb/SAYAPAKU5347_TP_V4.jpg" })