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.



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

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.



27
28
29
# File 'lib/hubspot/topic.rb', line 27

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



21
22
23
24
# File 'lib/hubspot/topic.rb', line 21

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

.listHubspot::Topic

Returns:



13
14
15
16
# File 'lib/hubspot/topic.rb', line 13

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

Instance Method Details

#[](property) ⇒ Object



33
34
35
# File 'lib/hubspot/topic.rb', line 33

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