diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d837bd..15b957d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## CHANGELOG +### 2.4.0 +* Update Rack install documentation +* Update Lists API endpoint for checking list subscriptions + ### 2.3.0 * Added ability to set API key in request without setting Klaviyo.private_api_key diff --git a/README.md b/README.md index f9bb493..54230c7 100644 --- a/README.md +++ b/README.md @@ -414,7 +414,7 @@ To automatically insert the Klaviyo script in your Rails app, add this to your e ```ruby require 'rack/klaviyo' -config.middleware.use "Klaviyo::Client::Middleware", "YOUR_PUBLIC_KLAVIYO_API_TOKEN" +config.middleware.use Rack::Klaviyo, "YOUR_PUBLIC_KLAVIYO_API_TOKEN" ``` This will automatically insert the Klaviyo script at the bottom on your HTML page, right before the closing `body` tag. diff --git a/klaviyo.gemspec b/klaviyo.gemspec index 48ee04a..e7a5329 100644 --- a/klaviyo.gemspec +++ b/klaviyo.gemspec @@ -2,8 +2,8 @@ files = ['klaviyo.gemspec', '{lib}/**/**/*'].map {|f| Dir[f]}.flatten Gem::Specification.new do |s| s.name = 'klaviyo' - s.version = '2.3.0' - s.date = '2021-10-28' + s.version = '2.4.0' + s.date = '2021-12-06' s.summary = 'You heard us, a Ruby wrapper for the Klaviyo API' s.description = 'Ruby wrapper for the Klaviyo API' s.authors = ['Klaviyo Team'] diff --git a/lib/klaviyo/apis/lists.rb b/lib/klaviyo/apis/lists.rb index 62f55c4..7a0a2cd 100644 --- a/lib/klaviyo/apis/lists.rb +++ b/lib/klaviyo/apis/lists.rb @@ -6,6 +6,7 @@ class Lists < Client LISTS = 'lists' MEMBERS = 'members' SUBSCRIBE = 'subscribe' + GET_LIST_SUBSCRIPTIONS = 'get-list-subscriptions' # Creates a new list # @param list_name [String] the list name @@ -65,13 +66,13 @@ def self.delete_list(list_id, api_key: nil) # @return A list of JSON objects of the profiles. Profiles that are # supressed or not found are not included. def self.check_list_subscriptions(list_id, api_key: nil, emails: [], phone_numbers: [], push_tokens: []) - path = "#{LIST}/#{list_id}/#{SUBSCRIBE}" + path = "#{LIST}/#{list_id}/#{GET_LIST_SUBSCRIPTIONS}" params = { :emails => emails, :phone_numbers => phone_numbers, :push_tokens => push_tokens } - v2_request(HTTP_GET, path, api_key: api_key, **params) + v2_request(HTTP_POST, path, api_key: api_key, **params) end # Subscribe profiles to a list. diff --git a/lib/klaviyo/client.rb b/lib/klaviyo/client.rb index 07000bb..61a26c4 100644 --- a/lib/klaviyo/client.rb +++ b/lib/klaviyo/client.rb @@ -4,7 +4,7 @@ class Client V1_API = 'v1' V2_API = 'v2' - KL_VERSION = '2.3.0' + KL_VERSION = '2.4.0' KL_USER_AGENT = "Ruby_Klaviyo/#{KL_VERSION}" HTTP_DELETE = 'delete' diff --git a/lib/rack/klaviyo.rb b/lib/rack/klaviyo.rb index 2ac9309..cd70c75 100644 --- a/lib/rack/klaviyo.rb +++ b/lib/rack/klaviyo.rb @@ -26,8 +26,8 @@ def call(env) def update_response! @response.each do |part| insert_at = part.index(@options[:insert_js_last] ? '