class Hubspot::Owner

HubSpot Owners API

{developers.hubspot.com/docs/methods/owners/get_owners}

TODO: Create an Owner TODO: Update an Owner TODO: Delete an Owner

Constants

CREATE_OWNER_PATH
DELETE_OWNER_PATH
GET_OWNERS_PATH
GET_OWNER_PATH
UPDATE_OWNER_PATH

Attributes

email[R]
owner_id[R]
properties[R]

Public Class Methods

all(include_inactive=false) click to toggle source
# File lib/hubspot/owner.rb, line 31
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
find(id, include_inactive=false) click to toggle source
# File lib/hubspot/owner.rb, line 38
def find(id, include_inactive=false)
  path     = GET_OWNER_PATH
  response = Hubspot::Connection.get_json(path, owner_id: id,
    include_inactive: include_inactive)
  new(response)
end
find_by_email(email, include_inactive=false) click to toggle source
# File lib/hubspot/owner.rb, line 45
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
find_by_emails(emails, include_inactive=false) click to toggle source
# File lib/hubspot/owner.rb, line 52
def find_by_emails(emails, include_inactive=false)
  emails.map { |email| find_by_email(email, include_inactive) }.reject(&:blank?)
end
new(property_hash) click to toggle source
# File lib/hubspot/owner.rb, line 20
def initialize(property_hash)
  @properties = property_hash
  @owner_id   = @properties['ownerId']
  @email      = @properties['email']
end

Public Instance Methods

[](property) click to toggle source
# File lib/hubspot/owner.rb, line 26
def [](property)
  @properties[property]
end