Class: KlaviyoAPI::Profile
Class Method Summary
collapse
Instance Method Summary
collapse
count
Methods inherited from Base
activate_session, headers, reset_session, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_symbol, *arguments) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/klaviyo_api/resources/profile.rb', line 48
def method_missing(method_symbol, *arguments)
method_name = method_symbol.to_s
if attributes.keys.any? { |attribute| attribute == "$#{method_name.sub(/\?|=$/, '')}" }
method_symbol = "$#{method_name}".to_sym
end
super
end
|
Class Method Details
.collection_path(prefix_options = {}, query_options = {}) ⇒ Object
13
14
15
|
# File 'lib/klaviyo_api/resources/profile.rb', line 13
def collection_path(prefix_options = {}, query_options = {})
super prefix_options, query_options.deep_merge({ api_key: ['api-key'] })
end
|
.element_path(id, prefix_options = {}, query_options = {}) ⇒ Object
17
18
19
|
# File 'lib/klaviyo_api/resources/profile.rb', line 17
def element_path(id, prefix_options = {}, query_options = {})
super id, prefix_options, query_options.deep_merge({ api_key: ['api-key'] })
end
|
Instance Method Details
#create ⇒ Object
26
27
28
|
# File 'lib/klaviyo_api/resources/profile.rb', line 26
def create
raise KlaviyoAPI::InvalidOperation, 'Cannot create Profiles via API.'
end
|
#destroy ⇒ Object
22
23
24
|
# File 'lib/klaviyo_api/resources/profile.rb', line 22
def destroy
raise KlaviyoAPI::InvalidOperation, 'Cannot delete Profiles via API.'
end
|
#update ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/klaviyo_api/resources/profile.rb', line 30
def update
run_callbacks :update do
path = self.class.element_path(id, prefix_options, attributes)
connection.put(path, nil, self.class.).tap do |response|
load_attributes_from_response(response)
end
end
end
|