Class: KlaviyoAPI::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- KlaviyoAPI::Base
show all
- Defined in:
- lib/klaviyo_api/resources/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.activate_session(session) ⇒ Object
15
16
17
18
19
|
# File 'lib/klaviyo_api/resources/base.rb', line 15
def activate_session(session)
self.['api-key'] = session.api_key.to_s
KlaviyoAPI::Base.site = KlaviyoAPI.configuration.url
end
|
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/klaviyo_api/resources/base.rb', line 34
def element_path(id, prefix_options = {}, query_options = nil)
check_prefix_options(prefix_options)
id = URI.parser.escape id.to_s
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{element_name}#{'/' + id if id.present?}#{format_extension}#{query_string(query_options)}"
end
|
27
28
29
30
31
32
|
# File 'lib/klaviyo_api/resources/base.rb', line 27
def
return if
return superclass. if superclass != Object && superclass.
|| {}
end
|
Instance Method Details
#to_h ⇒ Object
44
45
46
|
# File 'lib/klaviyo_api/resources/base.rb', line 44
def to_h
JSON.parse(attributes.to_json).symbolize_keys
end
|