Sha256: d08f6a5c691fc94d7868777d525c78219bb65263902d1ae9aca9a46aaddf99ac
Contents?: true
Size: 684 Bytes
Versions: 1
Compression:
Stored size: 684 Bytes
Contents
module Outreach class Prospect attr_accessor :first_name, :last_name, :company, :contact, :tags, :id def initialize(attrs) @first_name = attrs['attributes']['personal']['name']['first'] @last_name = attrs['attributes']['personal']['name']['last'] @company = to_ostruct(attrs['attributes']['company']) @contact = to_ostruct(attrs['attributes']['contact']) @tags = attrs['attributes']['metadata']['tags'] @id = attrs['id'] end private def to_ostruct(hash) o = OpenStruct.new(hash) hash.each.with_object(o) do |(k,v), o| o.send(:"#{k}=", to_ostruct(v)) if v.is_a? Hash end o end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outreach-0.1.0 | lib/outreach/prospect.rb |