Sha256: 2ca20ddfb77b926a67c8cf5193d3aa44215692366f75d1a1b73205e9e3f58cb3
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'json' module PortaText module Command # The base command class. # # Author:: Marcelo Gornstein (mailto:marcelog@portatext.com) # Copyright:: Copyright (c) 2015 PortaText # License:: Apache-2.0 class Base attr_writer :client def get run :get end def post run :post end def put run :put end def patch run :patch end def delete run :delete end def set(key, value) @args[key] = value self end def content_type(_method) return 'text/csv' unless @args[:file].nil? 'application/json' end def body(_method) return "file:#{@args[:file]}" unless @args[:file].nil? return '' if @args.size.eql? 0 @args.to_json end def initialize @args = {} end private def run(method) @client.run endpoint(method), method, content_type(method), body(method) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems