Sha256: 055c4ee7241cbde926850d083fe6b4aed84b19e0430e1ee2d96ae042ddecce37
Contents?: true
Size: 627 Bytes
Versions: 2
Compression:
Stored size: 627 Bytes
Contents
module Macaco class Api def self.post(args = {}) request = request_instance(args) request.body = args[:data] 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, { 'Content-Type' => args[:mail].content_type }) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
macaco-0.0.4 | lib/macaco/api.rb |
macaco-0.0.3 | lib/macaco/api.rb |