Sha256: c0d2cbe0bf77df961abb52411ac49fff9ab4fac146c5e08c42e1b39ea7d3be30
Contents?: true
Size: 642 Bytes
Versions: 1
Compression:
Stored size: 642 Bytes
Contents
module Macaco class Api def self.post(args = {}) request = request_instance(args) request.body = args[:data].to_json JSON.parse(http_response(request, args).body) end private def self.http_response(request, args) http_instance(args).start { |http| http.request(request) } end def self.request_instance(args) Net::HTTP::Post.new(args[:mail].api_path, initheader = { 'Content-Type' => 'application/json' }) end def self.http_instance(args) http = Net::HTTP.new(args[:mail].api_root, 443) http.use_ssl = true http end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
macaco-0.0.2 | lib/macaco/api.rb |