Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #74 from bdunne/expose_raw_hash
Browse files Browse the repository at this point in the history
Expose the raw hash of the object
  • Loading branch information
bdunne authored Feb 23, 2017
2 parents f3604e2 + 5799e34 commit a2aa626
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ansible_tower_client/base_model.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a2aa626

Please sign in to comment.