Class: Pechkin::Connector
- Inherits:
-
Object
- Object
- Pechkin::Connector
show all
- Defined in:
- lib/pechkin/connector.rb
Overview
Instance Method Summary
collapse
Instance Method Details
#post_data(url, data, headers: {}) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/pechkin/connector.rb', line 11
def post_data(url, data, headers: {})
uri = URI.parse(url)
= { 'Content-Type' => 'application/json' }.merge()
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = url.start_with?('https://')
request = Net::HTTP::Post.new(uri.request_uri, )
request.body = data.to_json
http.request(request)
end
|
#send_message(chat, message, options) ⇒ Object
9
|
# File 'lib/pechkin/connector.rb', line 9
def send_message(chat, message, options); end
|