require 'outreach-ruby/model' module Outreach class Prospect extend Outreach::Model attr_accessor :id, :first_name, :last_name, :emails, :owner_id, :response def initialize(attrs) @id = attrs['id'] @first_name = attrs['first_name'] @last_name = attrs['last_name'] @emails = attrs['emails'] @owner_id = attrs['owner_id'] @response = attrs['response'] end def self.build_from_attributes_hash(data) result = {} result['first_name'] = nested_hash_value( data, %w[attributes firstName] ) result['last_name'] = nested_hash_value( data, %w[attributes lastName] ) result['emails'] = nested_hash_value( data, %w[attributes emails] ) result['id'] = data['id'] result['owner_id'] = nested_hash_value( data, %w[relationships owner data id] ) result['response'] = data new(result) end end end