Class: CurlAdapter::Invoker
- Inherits:
-
Object
- Object
- CurlAdapter::Invoker
- Defined in:
- lib/curl_adapter.rb
Instance Attribute Summary collapse
-
#db_url ⇒ Object
readonly
Returns the value of attribute db_url.
Instance Method Summary collapse
-
#initialize(db_url) ⇒ Invoker
constructor
A new instance of Invoker.
- #post(payload) ⇒ Object
Constructor Details
#initialize(db_url) ⇒ Invoker
Returns a new instance of Invoker.
20 21 22 |
# File 'lib/curl_adapter.rb', line 20 def initialize(db_url) @db_url = db_url end |
Instance Attribute Details
#db_url ⇒ Object (readonly)
Returns the value of attribute db_url.
18 19 20 |
# File 'lib/curl_adapter.rb', line 18 def db_url @db_url end |
Instance Method Details
#post(payload) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/curl_adapter.rb', line 24 def post(payload) cmd = "curl -T - -X POST #{@db_url}/_bulk_docs -w\"%{http_code}\ %{time_total}\" -o out.file 2> /dev/null" curl_io = IO.popen(cmd, "w+") curl_io.puts payload curl_io.close_write result = CurlAdapter::Response.new(*curl_io.gets.split(" ")) end |