Class: Line::Bot::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/line/bot/http.rb

Class Method Summary collapse

Class Method Details

.get(url, header = {}) ⇒ Object



12
13
14
15
# File 'lib/line/bot/http.rb', line 12

def self.get(url, header = {})
  uri = URI(url)
  self.http(uri).get(uri.request_uri, header)
end

.http(uri) ⇒ Object



6
7
8
9
10
# File 'lib/line/bot/http.rb', line 6

def self.http(uri)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true if uri.scheme == "https"
  http
end

.post(url, payload, header = {}) ⇒ Object



17
18
19
20
# File 'lib/line/bot/http.rb', line 17

def self.post(url, payload, header = {})
  uri = URI(url)
  self.http(uri).post(uri.request_uri, payload, header)
end