Class: ConfigCat::FetchResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/configcat/configfetcher.rb

Instance Method Summary collapse

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_fetchedObject

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_modifiedObject

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

#jsonObject

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