parallel588-klaviyo 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/klaviyo.gemspec +1 -0
- data/lib/klaviyo/client.rb +7 -2
- data/lib/klaviyo/errors.rb +1 -5
- data/lib/klaviyo/version.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76ed78477b7ec3a369b9105402afcb2a358d7e6c
|
4
|
+
data.tar.gz: c28a9bf6b61d8ae6ba59d53705ede5490d73e7b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 935a312c7c982b553a3ea97e9c02c436fbb177fe04d48661e8a50f9e87a32cfd73357e22612c2310de09d55386cf75c951b3db484056fb804456820abb949c80
|
7
|
+
data.tar.gz: 2a9515fb81e97c69e4caad16ff545fe7956d0064c14c382d54a875cded8f77481b9c6ff0f18665d2e5d6ed21f6ea65ff93204d174e348e6e5ed3c7216038bcd8
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Klaviyo
|
2
2
|
|
3
|
-
|
3
|
+
https://www.klaviyo.com/docs/http-api
|
4
|
+
|
4
5
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,11 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
klaviyo_client = Klaviyo::Client.new(ENV['secret_key'], ENV['public_key'])
|
27
|
+
klaviyo_client.people.find(id: user_id)
|
28
|
+
|
29
|
+
```
|
26
30
|
|
27
31
|
## Development
|
28
32
|
|
@@ -33,4 +37,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
33
37
|
## Contributing
|
34
38
|
|
35
39
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/klaviyo.
|
36
|
-
|
data/klaviyo.gemspec
CHANGED
data/lib/klaviyo/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'client_dsl'
|
2
2
|
require_relative 'errors'
|
3
3
|
module Klaviyo
|
4
|
-
API_ENDPOINT = 'https://a.klaviyo.com'
|
4
|
+
API_ENDPOINT = 'https://a.klaviyo.com'.freeze
|
5
5
|
|
6
6
|
class Client
|
7
7
|
extend ClientDSL
|
@@ -10,6 +10,11 @@ module Klaviyo
|
|
10
10
|
def initialize(api_key, token)
|
11
11
|
@api_key = api_key
|
12
12
|
@token = token
|
13
|
+
|
14
|
+
raise Errors::AuthenticationError, 'No API key provided.' unless @api_key
|
15
|
+
raise Errors::AuthenticationError, 'No Token provided.' unless @token
|
16
|
+
|
17
|
+
|
13
18
|
@conn = Faraday.new(
|
14
19
|
url: API_ENDPOINT,
|
15
20
|
ssl: { ca_path: Klaviyo::DEFAULT_CA_BUNDLE_PATH }
|
@@ -30,7 +35,7 @@ module Klaviyo
|
|
30
35
|
)
|
31
36
|
|
32
37
|
{
|
33
|
-
data: Base64.encode64(JSON.generate(options)).delete("\n")
|
38
|
+
data: CGI.escape(Base64.encode64(JSON.generate(options)).delete("\n"))
|
34
39
|
}
|
35
40
|
end
|
36
41
|
|
data/lib/klaviyo/errors.rb
CHANGED
@@ -5,6 +5,7 @@ module Klaviyo
|
|
5
5
|
class UnprocessableEntity < KlaviyoError; end
|
6
6
|
class InternalServerError < KlaviyoError; end
|
7
7
|
class NotAuthorized < KlaviyoError; end
|
8
|
+
class AuthenticationError < KlaviyoError; end
|
8
9
|
|
9
10
|
class RequestError < Faraday::Response::Middleware
|
10
11
|
|
@@ -31,8 +32,3 @@ module Klaviyo
|
|
31
32
|
|
32
33
|
end
|
33
34
|
end
|
34
|
-
|
35
|
-
#400 Bad request - Request is missing or has a bad parameter.
|
36
|
-
#401 Not Authorized - Request is missing or has an invalid API key.
|
37
|
-
#404 Not Found - The requested resource doesn't exist.
|
38
|
-
#500 Server errors - Something is wrong on Klaviyo's end.
|
data/lib/klaviyo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel588-klaviyo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Pechnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
@@ -148,6 +148,26 @@ dependencies:
|
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: 0.10.3
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: webmock
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '2.0'
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 2.0.3
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '2.0'
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 2.0.3
|
151
171
|
description: Ruby wrapper for the Klaviyo API
|
152
172
|
email:
|
153
173
|
- parallel588@gmail.com
|