Class: Hubspot::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Hubspot::Base
- Defined in:
- app/models/hubspot/base.rb
Direct Known Subclasses
Blog, Hubspot::Blogs::BlogAssociation, Hubspot::Blogs::Posts::Comment, Event, Keyword, Lead
Class Method Summary collapse
- .collection_path(prefix_options = {}, query_options = nil) ⇒ Object
-
.connection(refresh = false) ⇒ Object
Use our own connection class.
-
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
Set paths ====.
Instance Method Summary collapse
-
#to_json(options = {}) ⇒ Object
Only serialize the attributes listed in the schema.
Class Method Details
.collection_path(prefix_options = {}, query_options = nil) ⇒ Object
32 33 34 35 |
# File 'app/models/hubspot/base.rb', line 32 def collection_path( = {}, = nil) , = () if .nil? "#{prefix()}list.#{format.extension}#{query_string()}" end |
.connection(refresh = false) ⇒ Object
Use our own connection class
20 21 22 23 |
# File 'app/models/hubspot/base.rb', line 20 def connection(refresh = false) @connection = Hubspot::Connection.new(site, format) if @connection.nil? || refresh return @connection end |
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
Set paths ====
27 28 29 30 |
# File 'app/models/hubspot/base.rb', line 27 def element_path(id, = {}, = nil) , = () if .nil? "#{prefix()}#{collection_name.singularize}/#{URI.escape id.to_s}.#{format.extension}#{query_string()}" end |
Instance Method Details
#to_json(options = {}) ⇒ Object
Only serialize the attributes listed in the schema. Leads can contain much more information than can be passed back to Hubspot, therefore we need to ensure they are not serialized on save.
13 14 15 |
# File 'app/models/hubspot/base.rb', line 13 def to_json(={}) super(.reverse_merge(:root => nil, :only => schema.keys)) end |