Class: Juici::Callback
- Inherits:
-
Object
- Object
- Juici::Callback
- Defined in:
- lib/juici/callback.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(build, url) ⇒ Callback
constructor
A new instance of Callback.
- #process! ⇒ Object
Constructor Details
#initialize(build, url) ⇒ Callback
Returns a new instance of Callback.
7 8 9 10 |
# File 'lib/juici/callback.rb', line 7 def initialize(build, url) @build = build @url = URI(url) end |
Instance Attribute Details
#build ⇒ Object (readonly)
Returns the value of attribute build.
5 6 7 |
# File 'lib/juici/callback.rb', line 5 def build @build end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/juici/callback.rb', line 5 def url @url end |
Instance Method Details
#process! ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/juici/callback.rb', line 12 def process! Net::HTTP.start(url.host, url.port) do |http| request = Net::HTTP::Post.new(url.request_uri) request.body = build.to_callback_json response = http.request request # Net::HTTPResponse object end end |