lib/portatext/command/base.rb in portatext-0.0.2 vs lib/portatext/command/base.rb in portatext-1.0.0.pre
- old
+ new
@@ -6,10 +6,12 @@
#
# 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
@@ -32,19 +34,20 @@
@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(client)
- @client = client
+ def initialize
@args = {}
end
private