Class: Hubspot::Topic
- Inherits:
-
Object
- Object
- Hubspot::Topic
- 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
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Class Method Summary collapse
-
.find_by_topic_id(id) ⇒ Object
Finds the details for a specific topic_id {developers.hubspot.com/docs/methods/blogv2/get_topics_topic_id }.
-
.list ⇒ Hubspot::Topic
Lists the topics {developers.hubspot.com/docs/methods/blogv2/get_topics).
Instance Method Summary collapse
- #[](property) ⇒ Object
-
#initialize(response_hash) ⇒ Topic
constructor
A new instance of Topic.
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
#properties ⇒ Object (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 }
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 |
.list ⇒ Hubspot::Topic
Lists the topics {developers.hubspot.com/docs/methods/blogv2/get_topics)
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 |