Class: ConfigCat::FetchResponse
- Inherits:
-
Object
- Object
- ConfigCat::FetchResponse
- Defined in:
- lib/configcat/configfetcher.rb
Instance Attribute Summary collapse
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#is_transient_error ⇒ Object
readonly
Returns the value of attribute is_transient_error.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status, entry, error = nil, is_transient_error = false) ⇒ FetchResponse
constructor
A new instance of FetchResponse.
-
#is_failed ⇒ Object
Gets whether the fetch failed or not.
-
#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.
Constructor Details
#initialize(status, entry, error = nil, is_transient_error = false) ⇒ FetchResponse
Returns a new instance of FetchResponse.
31 32 33 34 35 36 |
# File 'lib/configcat/configfetcher.rb', line 31 def initialize(status, entry, error = nil, is_transient_error = false) @status = status @entry = entry @error = error @is_transient_error = is_transient_error end |
Instance Attribute Details
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
29 30 31 |
# File 'lib/configcat/configfetcher.rb', line 29 def entry @entry end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
29 30 31 |
# File 'lib/configcat/configfetcher.rb', line 29 def error @error end |
#is_transient_error ⇒ Object (readonly)
Returns the value of attribute is_transient_error.
29 30 31 |
# File 'lib/configcat/configfetcher.rb', line 29 def is_transient_error @is_transient_error end |
Class Method Details
.failure(error, is_transient_error) ⇒ Object
64 65 66 |
# File 'lib/configcat/configfetcher.rb', line 64 def self.failure(error, is_transient_error) FetchResponse.new(Status::FAILURE, ConfigEntry::EMPTY, error, is_transient_error) end |
.not_modified ⇒ Object
60 61 62 |
# File 'lib/configcat/configfetcher.rb', line 60 def self.not_modified FetchResponse.new(Status::NOT_MODIFIED, ConfigEntry::EMPTY) end |
.success(entry) ⇒ Object
56 57 58 |
# File 'lib/configcat/configfetcher.rb', line 56 def self.success(entry) FetchResponse.new(Status::FETCHED, entry) end |
Instance Method Details
#is_failed ⇒ Object
Gets whether the fetch failed or not. :return [Boolean] true if the fetch failed, otherwise false.
52 53 54 |
# File 'lib/configcat/configfetcher.rb', line 52 def is_failed @status == Status::FAILURE end |
#is_fetched ⇒ Object
Gets whether a new configuration value was fetched or not. :return [Boolean] true if a new configuration value was fetched, otherwise false.
40 41 42 |
# File 'lib/configcat/configfetcher.rb', line 40 def is_fetched @status == Status::FETCHED end |
#is_not_modified ⇒ Object
Gets whether the fetch resulted a ‘304 Not Modified’ or not. :return [Boolean] true if the fetch resulted a ‘304 Not Modified’ code, otherwise false.
46 47 48 |
# File 'lib/configcat/configfetcher.rb', line 46 def is_not_modified @status == Status::NOT_MODIFIED end |