lib/cts/mpx/registry.rb in cts-mpx-1.0.3 vs lib/cts/mpx/registry.rb in cts-mpx-1.1.0

- old
+ new

@@ -30,12 +30,12 @@ # @return [Hash] hash of the newly fetched domain def fetch_domain(user, account_id = 'urn:theplatform:auth:root') return domains['urn:theplatform:auth:root'] if account_id == 'urn:theplatform:auth:root' Driver::Exceptions.raise_unless_argument_error?(user, 'User') { !user.is_a? User } - Driver::Exceptions.raise_unless_argument_error?(account_id, 'account_id') { !Validators.account_id? account_id } user.token! + Driver::Exceptions.raise_unless_argument_error?(account_id, 'account_id') { !Validators.account_id? account_id } response = Services::Web.post user: user, service: 'Access Data Service', endpoint: 'Registry', method: 'resolveDomain', arguments: { 'accountId' => account_id } response.data['resolveDomainResponse'] end @@ -54,10 +54,11 @@ end # find and store the root registry from the US def initialize @domains = {} - store_domain(Driver.load_json_file("#{Driver.config_dir}/root_registry_sea1.json")['resolveDomainResponse'], 'urn:theplatform:auth:root') + content = File.read "#{Driver.config_dir}/root_registry_sea1.json" + store_domain(Driver.parse_json(content)['resolveDomainResponse'], 'urn:theplatform:auth:root') end end end end