Class: ConfigCat::FetchResponse
- Inherits:
-
Object
- Object
- ConfigCat::FetchResponse
- Defined in:
- lib/configcat/configfetcher.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ FetchResponse
constructor
A new instance of FetchResponse.
-
#is_fetched ⇒ Object
Gets whether a new configuration value was fetched or not.
-
#is_not_modified ⇒ Object
Gets whether the fetch resulted a ‘304 Not Modified’ or not.
-
#json ⇒ Object
Returns the json-encoded content of a response, if any.
Constructor Details
#initialize(response) ⇒ FetchResponse
Returns a new instance of FetchResponse.
22 23 24 |
# File 'lib/configcat/configfetcher.rb', line 22 def initialize(response) @_response = response end |
Instance Method Details
#is_fetched ⇒ Object
Gets whether a new configuration value was fetched or not
32 33 34 35 |
# File 'lib/configcat/configfetcher.rb', line 32 def is_fetched() code = @_response.code.to_i return 200 <= code && code < 300 end |
#is_not_modified ⇒ Object
Gets whether the fetch resulted a ‘304 Not Modified’ or not
38 39 40 |
# File 'lib/configcat/configfetcher.rb', line 38 def is_not_modified() return @_response.code == "304" end |
#json ⇒ Object
Returns the json-encoded content of a response, if any
27 28 29 |
# File 'lib/configcat/configfetcher.rb', line 27 def json() return JSON.parse(@_response.body) end |