Sha256: bd4bbaaf5f1d17663c0d814292b07088a0263832a40e2f3e013224f66a3f9282
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
module Hubspot # # HubSpot Owners API # # {http://developers.hubspot.com/docs/methods/owners/get_owners} # # TODO: Create an Owner # TODO: Update an Owner # TODO: Delete an Owner class Owner GET_OWNER_PATH = '/owners/v2/owners/:owner_id' # GET GET_OWNERS_PATH = '/owners/v2/owners' # GET CREATE_OWNER_PATH = '/owners/v2/owners' # POST UPDATE_OWNER_PATH = '/owners/v2/owners/:owner_id' # PUT DELETE_OWNER_PATH = '/owners/v2/owners/:owner_id' # DELETE attr_reader :properties, :owner_id, :email def initialize(property_hash) @properties = property_hash @owner_id = @properties['ownerId'] @email = @properties['email'] end def [](property) @properties[property] end class << self def all(include_inactive=false) path = GET_OWNERS_PATH params = { includeInactive: include_inactive } response = Hubspot::Connection.get_json(path, params) response.map { |r| new(r) } end def find(id, include_inactive=false) response = Hubspot::Connection.get_json(path, owner_id: id, include_inactive: include_inactive) new(response) end def find_by_email(email, include_inactive=false) path = GET_OWNERS_PATH params = { email: email, includeInactive: include_inactive } response = Hubspot::Connection.get_json(path, params) response.blank? ? nil : new(response.first) end def find_by_emails(emails, include_inactive=false) emails.map { |email| find_by_email(email, include_inactive) }.reject(&:blank?) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hubspot-ruby-0.8.0 | lib/hubspot/owner.rb |