Module: Opener::Client::Processor
- Defined in:
- lib/opener/client/processor.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Class Method Summary collapse
Instance Method Summary collapse
- #endpoint ⇒ Object
- #initialize(host) ⇒ Object
- #options ⇒ Object
- #process(input, callbacks = nil) ⇒ Object
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/opener/client/processor.rb', line 4 def host @host end |
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/opener/client/processor.rb', line 6 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#endpoint ⇒ Object
34 35 36 |
# File 'lib/opener/client/processor.rb', line 34 def endpoint [host, processor].join("/") end |
#initialize(host) ⇒ Object
18 19 20 |
# File 'lib/opener/client/processor.rb', line 18 def initialize(host) @host = host end |
#options ⇒ Object
38 39 40 |
# File 'lib/opener/client/processor.rb', line 38 def {} end |
#process(input, callbacks = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/opener/client/processor.rb', line 22 def process(input, callbacks=nil) opts = {:input=>input}.merge() opts[:'callbacks[]'] = callbacks unless callbacks.nil? response = HTTPClient.post(endpoint, opts) if response.status == 500 raise "Internal Server error in: #{self.class.name}, #{response.body}" else return response.body end end |