class Bearychat::HttpClient
Attributes
conn[RW]
url[RW]
Public Class Methods
new(url)
click to toggle source
# File lib/bearychat/http_client.rb, line 7 def initialize(url) self.conn = build_conn(url) end
Public Instance Methods
post_json(body)
click to toggle source
# File lib/bearychat/http_client.rb, line 11 def post_json(body) conn.post do |req| req.headers['Content-Type'] = 'application/json' req.body = body end end
Private Instance Methods
build_conn(url)
click to toggle source
# File lib/bearychat/http_client.rb, line 19 def build_conn(url) Faraday.new(url, ssl: {}) do |faraday| faraday.request :url_encoded faraday.response :logger faraday.adapter Faraday.default_adapter end end