Class: Dingding::Notifier::Util::HTTPClient
- Inherits:
-
Object
- Object
- Dingding::Notifier::Util::HTTPClient
- Defined in:
- lib/dingding-notifier/util/http_client.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Layout/IndentHeredoc.
-
#initialize(uri, params) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
Constructor Details
#initialize(uri, params) ⇒ HTTPClient
Returns a new instance of HTTPClient.
35 36 37 38 |
# File 'lib/dingding-notifier/util/http_client.rb', line 35 def initialize uri, params @uri = uri @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
33 34 35 |
# File 'lib/dingding-notifier/util/http_client.rb', line 33 def params @params end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
33 34 35 |
# File 'lib/dingding-notifier/util/http_client.rb', line 33 def uri @uri end |
Class Method Details
.post(uri, params) ⇒ Object
28 29 30 |
# File 'lib/dingding-notifier/util/http_client.rb', line 28 def post uri, params HTTPClient.new(uri, params).call end |
Instance Method Details
#call ⇒ Object
rubocop:disable Layout/IndentHeredoc
41 42 43 44 45 46 47 48 |
# File 'lib/dingding-notifier/util/http_client.rb', line 41 def call response = Faraday.post(uri, params,{"Content-Type" => "application/json"}) # http_obj.request(request_obj).tap do |response| # unless response.is_a?(Net::HTTPSuccess) # raise Dingding::Notifier::APIError.new(response) # end # end end |