Class: SBF::Client::ConfigEndpoint

Inherits:
EntityEndpoint show all
Defined in:
lib/stbaldricks/endpoints/config.rb

Instance Attribute Summary

Attributes inherited from EntityEndpoint

#orig_target_class

Instance Method Summary collapse

Methods inherited from EntityEndpoint

#aggregate, #create, #delete, #find, #find_first, #get, #initialize, #save, #update

Constructor Details

This class inherits a constructor from SBF::Client::EntityEndpoint

Instance Method Details

#reload(entity) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/stbaldricks/endpoints/config.rb', line 7

def reload(entity)
  response = SBF::Client::Api::Request.get_request("#{base_uri}/get")
  parsed_response_body = JSON.parse(response.body).symbolize!

  raise SBF::Client::StandardError, 'Unable to retrieve settings from the api' unless ok?(response)

  # re-call initalize with the new api data. This should re-set all of the instance variables on the instance
  entity.send(:initialize, parsed_response_body)
end