Sha256: 39c881d164a6f2af8e0cd4033f1b58574be090af502865e2a6ef93ac6b0bf81d
Contents?: true
Size: 662 Bytes
Versions: 1
Compression:
Stored size: 662 Bytes
Contents
require 'line_notify/version' require 'net/https' module LineNotify class Client URI = URI.parse("https://notify-api.line.me/api/notify") def initialize(access_token) @access_token = (ENV['LINE_ACCESS_TOKEN'] || access_token) end def send(options) request = create_request(options) Net::HTTP.start(URI.hostname, URI.port, use_ssl: URI.scheme == "https") do |req| req.request(request) end end private def create_request(options) request = Net::HTTP::Post.new(URI) request["Authorization"] = "Bearer #{@access_token}" request.set_form_data(options) request end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
line_notify-0.1.0 | lib/line_notify/client.rb |