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.
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
#properties ⇒ Object (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 }
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 |
.list ⇒ Hubspot::Topic
Lists the topics {developers.hubspot.com/docs/methods/blogv2/get_topics)
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 |