Class: ConstructorIO::Client
- Inherits:
-
Object
- Object
- ConstructorIO::Client
- Defined in:
- lib/constructorio/client.rb
Instance Attribute Summary collapse
-
#local_configuration ⇒ Object
Returns the value of attribute local_configuration.
Instance Method Summary collapse
- #add(params) ⇒ Object
- #add_batch(params) ⇒ Object
- #add_or_update(params) ⇒ Object
- #add_or_update_batch(params) ⇒ Object
-
#initialize(config = nil) ⇒ Client
constructor
A new instance of Client.
- #modify(params) ⇒ Object
- #remove(params) ⇒ Object
- #track_click_through(params) ⇒ Object
- #track_conversion(params) ⇒ Object
- #track_search(params) ⇒ Object
- #verify ⇒ Object
Constructor Details
#initialize(config = nil) ⇒ Client
8 9 10 11 12 13 14 |
# File 'lib/constructorio/client.rb', line 8 def initialize(config = nil) @local_configuration = config || ConstructorIO::Configuration.new( api_token: ConstructorIO.configuration.api_token, api_url: ConstructorIO.configuration.api_url || "https://ac.cnstrc.com/", autocomplete_key: ConstructorIO.configuration.autocomplete_key ) end |
Instance Attribute Details
#local_configuration ⇒ Object
Returns the value of attribute local_configuration.
6 7 8 |
# File 'lib/constructorio/client.rb', line 6 def local_configuration @local_configuration end |
Instance Method Details
#add(params) ⇒ Object
16 17 18 |
# File 'lib/constructorio/client.rb', line 16 def add(params) call_api("item", "post", params) end |
#add_batch(params) ⇒ Object
48 49 50 |
# File 'lib/constructorio/client.rb', line 48 def add_batch(params) call_api("batch_items", "post", params) end |
#add_or_update(params) ⇒ Object
20 21 22 |
# File 'lib/constructorio/client.rb', line 20 def add_or_update(params) call_api("item", "put", params, {force: 1}) end |
#add_or_update_batch(params) ⇒ Object
52 53 54 |
# File 'lib/constructorio/client.rb', line 52 def add_or_update_batch(params) call_api("batch_items", "put", params, {force: 1}) end |
#modify(params) ⇒ Object
28 29 30 |
# File 'lib/constructorio/client.rb', line 28 def modify(params) call_api("item", "put", params) end |
#remove(params) ⇒ Object
24 25 26 |
# File 'lib/constructorio/client.rb', line 24 def remove(params) call_api("item", "delete", params) end |
#track_click_through(params) ⇒ Object
36 37 38 |
# File 'lib/constructorio/client.rb', line 36 def track_click_through(params) call_api("click_through", "post", params) end |
#track_conversion(params) ⇒ Object
40 41 42 |
# File 'lib/constructorio/client.rb', line 40 def track_conversion(params) call_api("conversion", "post", params) end |
#track_search(params) ⇒ Object
32 33 34 |
# File 'lib/constructorio/client.rb', line 32 def track_search(params) call_api("search", "post", params) end |
#verify ⇒ Object
44 45 46 |
# File 'lib/constructorio/client.rb', line 44 def verify call_api("verify", "get") end |