Class: Scim::Kit::Http
- Inherits:
-
Object
- Object
- Scim::Kit::Http
- Defined in:
- lib/scim/kit/http.rb
Instance Attribute Summary collapse
- #driver ⇒ Object readonly
- #retries ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #get(uri) ⇒ Object
-
#initialize(driver: Http.default_driver, retries: 3) ⇒ Http
constructor
A new instance of Http.
Constructor Details
#initialize(driver: Http.default_driver, retries: 3) ⇒ Http
Returns a new instance of Http.
8 9 10 11 |
# File 'lib/scim/kit/http.rb', line 8 def initialize(driver: Http.default_driver, retries: 3) @driver = driver @retries = retries end |
Instance Attribute Details
#driver ⇒ Object (readonly)
6 7 8 |
# File 'lib/scim/kit/http.rb', line 6 def driver @driver end |
#retries ⇒ Object (readonly)
6 7 8 |
# File 'lib/scim/kit/http.rb', line 6 def retries @retries end |
Class Method Details
Instance Method Details
#get(uri) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/scim/kit/http.rb', line 13 def get(uri) driver.with_retry(retries: retries) do |client| response = client.get(uri) ok?(response) ? JSON.parse(response.body, symbolize_names: true) : {} end rescue *Net::Hippie::CONNECTION_ERRORS => error Scim::Kit.logger.error(error) {} end |