diff --git a/lib/ansible_tower_client/base_model.rb b/lib/ansible_tower_client/base_model.rb index 042742e..33b37e1 100644 --- a/lib/ansible_tower_client/base_model.rb +++ b/lib/ansible_tower_client/base_model.rb @@ -1,6 +1,6 @@ module AnsibleTowerClient class BaseModel < HashModel - attr_reader :api + attr_reader :api, :raw_hash def self.base_class superclass == AnsibleTowerClient::BaseModel ? self : superclass.base_class @@ -35,7 +35,7 @@ def self.endpoint def initialize(api, json_or_hash) @api = api - raw_hash = json_or_hash.kind_of?(Hash) ? json_or_hash : JSON.parse(json_or_hash) + @raw_hash = json_or_hash.kind_of?(Hash) ? json_or_hash : JSON.parse(json_or_hash) self.class.send(:id_attr, *raw_hash['related'].keys) if raw_hash.key?('related') super(raw_hash)