Class: Bearychat::HttpClient
- Inherits:
-
Object
- Object
- Bearychat::HttpClient
- Defined in:
- lib/bearychat/http_client.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #post_json(body) ⇒ Object
Constructor Details
#initialize(url) ⇒ HttpClient
Returns a new instance of HttpClient.
7 8 9 |
# File 'lib/bearychat/http_client.rb', line 7 def initialize(url) self.conn = build_conn(url) end |
Instance Attribute Details
#conn ⇒ Object
Returns the value of attribute conn.
5 6 7 |
# File 'lib/bearychat/http_client.rb', line 5 def conn @conn end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/bearychat/http_client.rb', line 5 def url @url end |
Instance Method Details
#post_json(body) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/bearychat/http_client.rb', line 11 def post_json(body) conn.post do |req| req.headers['Content-Type'] = 'application/json' req.body = body end end |