Class: Line::Bot::HTTPClient
- Inherits:
-
Object
- Object
- Line::Bot::HTTPClient
- Defined in:
- lib/line/bot/httpclient.rb
Instance Method Summary collapse
Instance Method Details
#get(url, header = {}) ⇒ Object
34 35 36 37 |
# File 'lib/line/bot/httpclient.rb', line 34 def get(url, header = {}) uri = URI(url) http(uri).get(uri.request_uri, header) end |
#http(uri) ⇒ Net::HTTP
25 26 27 28 29 30 31 32 |
# File 'lib/line/bot/httpclient.rb', line 25 def http(uri) http = Net::HTTP.new(uri.host, uri.port) if uri.scheme == "https" http.use_ssl = true end http end |
#post(url, payload, header = {}) ⇒ Object
39 40 41 42 |
# File 'lib/line/bot/httpclient.rb', line 39 def post(url, payload, header = {}) uri = URI(url) http(uri).post(uri.request_uri, payload, header) end |