From 5799e3491f501f22bc6a80432ea9b5e55fac45c0 Mon Sep 17 00:00:00 2001 From: Brandon Dunne Date: Thu, 23 Feb 2017 15:33:05 -0500 Subject: [PATCH] Expose the raw hash of the object `raw_body` was removed in #17 --- lib/ansible_tower_client/base_model.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)