Class: FrCable::HTTPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/fr_cable/http_client.rb

Class Method Summary collapse

Class Method Details

.post(url, params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/fr_cable/http_client.rb', line 3

def self.post url, params
  body = params[:body]
  header = { 'Content-Type' => 'application/json',
    'Accept' => 'application/json' }
  uri = URI.parse(url)
  http = Net::HTTP.new(uri.host, uri.port)
  req = Net::HTTP::Post.new(uri.path, header)
  req.body = body
  http.request(req)
end