Class: Hubspot::Topic

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/topic.rb

Overview

HubSpot Topics API

Constant Summary collapse

TOPICS_PATH =
"/blogs/v3/topics"
TOPIC_PATH =
"/blogs/v3/topics/:topic_id"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_hash) ⇒ Topic

Returns a new instance of Topic.



31
32
33
# File 'lib/hubspot/topic.rb', line 31

def initialize(response_hash)
  @properties = response_hash #no need to parse anything, we have properties
end

Instance Attribute Details

#propertiesObject (readonly)

Returns the value of attribute properties.



29
30
31
# File 'lib/hubspot/topic.rb', line 29

def properties
  @properties
end

Class Method Details

.find_by_topic_id(id) ⇒ Object

Finds the details for a specific topic_id {developers.hubspot.com/docs/methods/blogv2/get_topics_topic_id }

Returns:

  • Hubspot::Topic



23
24
25
26
# File 'lib/hubspot/topic.rb', line 23

def find_by_topic_id(id)
  response = Hubspot::Connection.get_json(TOPIC_PATH, { topic_id: id })
  new(response)
end

.listHubspot::Topic

Returns:



15
16
17
18
# File 'lib/hubspot/topic.rb', line 15

def list
  response = Hubspot::Connection.get_json(TOPICS_PATH, {})
  response['objects'].map { |t| new(t) }
end

Instance Method Details

#[](property) ⇒ Object



35
36
37
# File 'lib/hubspot/topic.rb', line 35

def [](property)
  @properties[property]
end