Module: TestGemLineNotifier
- Defined in:
- lib/test_gem_line_notifier.rb,
lib/test_gem_line_notifier/version.rb
Overview
require “json”
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.send_notification(message) ⇒ Object
Your code goes here…
Class Method Details
.send_notification(message) ⇒ Object
Your code goes here… API_TOKEN = ENV || (raise(‘.envにLINE_NOTIFY_API_TOKENを設定してください’))
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/test_gem_line_notifier.rb', line 11 def self.send_notification() p 'test' # conn = Faraday.new(url: 'https://notify-api.line.me/api/notify') # response = conn.post do |req| # req.headers['Content-Type'] = 'application/x-www-form-urlencoded' # req.headers['Authorization'] = "Bearer #{API_TOKEN}" # req.params['message'] = message # end # # レスポンスの処理 # if response.success? # data = JSON.parse(response.body) # puts data # else # puts "Error: #{response.status}" # end end |