klaviyo 2.0.9 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f20097f9b9538503cc8f541dd7e6d71c6c70904e51fdd59f636670f56d0b53c5
4
- data.tar.gz: 98032c0e8a4ac60b16501495b71d35ce09bd28bd62fce4c49392448929555ffa
3
+ metadata.gz: 637b6125081b06c6f8121a331e4bfaef0976a5293496a3f9fe5aaed3b8b96afc
4
+ data.tar.gz: 420103a5fec88c53524eeeeaf32826424feb3fe5bd4146b4127fc71059319512
5
5
  SHA512:
6
- metadata.gz: e4f99398385906828f37a4e1f25f05ca76493a905d526177da2cc189301fba84adc76551711213c85003337b0278d0cade9c8ba52e0c0726176465fd2c8132cd
7
- data.tar.gz: e109724a853cbf44a3546298fdfc04037a9cfb748b72a3edd96fab1475e209a3ea67c697ce940ff54d6aac57120f37aa853076398c016995b1b4b11f70279694
6
+ metadata.gz: 15ca790911f3306253271f36fe7e15da7c2e042a3a25614217aab530d52c4bfcfdf4cd675cd1bf4f761d7e4b9b126c07b87681def392daf9514d5ab072f016e2
7
+ data.tar.gz: 4eca152856c1ce76571c0745a6d437ed8ccea93e6fbf057f35d81771c80c11219f20198fb52cf561447554a939e8eea65fa0c2db041c54f426c7b70270d73a10
data/klaviyo.gemspec CHANGED
@@ -2,8 +2,8 @@ files = ['klaviyo.gemspec', '{lib}/**/**/*'].map {|f| Dir[f]}.flatten
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'klaviyo'
5
- s.version = '2.0.9'
6
- s.date = '2021-07-30'
5
+ s.version = '2.1.0'
6
+ s.date = '2021-10-01'
7
7
  s.summary = 'You heard us, a Ruby wrapper for the Klaviyo API'
8
8
  s.description = 'Ruby wrapper for the Klaviyo API'
9
9
  s.authors = ['Klaviyo Team']
@@ -4,6 +4,9 @@ module Klaviyo
4
4
  V1_API = 'v1'
5
5
  V2_API = 'v2'
6
6
 
7
+ KL_VERSION = '2.1.0'
8
+ KL_USER_AGENT = "Ruby_Klaviyo/#{KL_VERSION}"
9
+
7
10
  HTTP_DELETE = 'delete'
8
11
  HTTP_GET = 'get'
9
12
  HTTP_POST = 'post'
@@ -29,7 +32,8 @@ module Klaviyo
29
32
  connection = Faraday.new(
30
33
  url: url,
31
34
  headers: {
32
- 'Content-Type' => content_type
35
+ 'Content-Type' => content_type,
36
+ 'User-Agent' => KL_USER_AGENT
33
37
  })
34
38
  if content_type == CONTENT_JSON
35
39
  kwargs[:body] = kwargs[:body].to_json
@@ -44,12 +48,13 @@ module Klaviyo
44
48
  if method == HTTP_GET
45
49
  params = build_params(kwargs)
46
50
  url = "#{BASE_API_URL}/#{path}?#{params}"
47
- res = Faraday.get(url).body
51
+ res = Faraday.get(url, {}, { 'User-Agent' => KL_USER_AGENT }).body
48
52
  elsif method == HTTP_POST
49
53
  url = URI("#{BASE_API_URL}/#{path}")
50
54
  response = Faraday.post(url) do |req|
51
55
  req.headers['Content-Type'] = CONTENT_URL_FORM
52
56
  req.headers['Accept'] = 'text/html'
57
+ req.headers['User-Agent'] = KL_USER_AGENT
53
58
  req.body = {data: "#{kwargs.to_json}"}
54
59
  end
55
60
  else
@@ -112,9 +117,8 @@ module Klaviyo
112
117
  raise KlaviyoError.new(NO_PUBLIC_API_KEY_ERROR)
113
118
  end
114
119
  if ( Klaviyo.public_api_key =~ /pk_\w{34}$/ ) == 0
115
- raise KlaviyoError.new(PRIVATE_KEY_AS_PUBLIC)
116
- end
117
- if ( Klaviyo.public_api_key =~ /\w{6}$/ ) != 0
120
+ warn(PRIVATE_KEY_AS_PUBLIC)
121
+ elsif ( Klaviyo.public_api_key =~ /\w{6}$/ ) != 0
118
122
  raise KlaviyoError.new(INCORRECT_PUBLIC_API_KEY_LENGTH)
119
123
  end
120
124
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klaviyo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaviyo Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-30 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -87,7 +87,7 @@ files:
87
87
  homepage: https://www.klaviyo.com/
88
88
  licenses: []
89
89
  metadata: {}
90
- post_install_message:
90
+ post_install_message:
91
91
  rdoc_options: []
92
92
  require_paths:
93
93
  - lib
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubygems_version: 3.0.8
106
- signing_key:
105
+ rubygems_version: 3.0.3
106
+ signing_key:
107
107
  specification_version: 4
108
108
  summary: You heard us, a Ruby wrapper for the Klaviyo API
109
109
  test_files: []