active_campaign 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/lib/active_campaign/client.rb +6 -4
- data/lib/active_campaign/error.rb +27 -25
- data/lib/active_campaign/version.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 773816e174638b5fa75102b031ac13ed726e9112
|
4
|
+
data.tar.gz: 005d17ce9301bcadb204018be4154fb9990916ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4facfd3b06ece6db14864a65124cb96e8fe73bd670544bdef32ff0f07982de5ce37ef6d78f48a6b37f83e6f8d11d4817d9b729f0e2c3aa6f09fe659a79c5ccde
|
7
|
+
data.tar.gz: 640e94884732f0f66605c9777b29b1356d16d3178d4d699f7b6b572f2c4ba9a42ebf78a3a02da071cbce0afaae14003960d5bae35cbad8331764f212dc3aa913
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.0
|
data/Gemfile
CHANGED
@@ -57,10 +57,12 @@ module ActiveCampaign
|
|
57
57
|
|
58
58
|
|
59
59
|
def create_request(method, api_method, options = {})
|
60
|
-
request = HTTPI::Request.new :
|
61
|
-
|
62
|
-
request.
|
63
|
-
request.
|
60
|
+
request = HTTPI::Request.new url: File.join(api_endpoint, api_path)
|
61
|
+
|
62
|
+
request.headers = { "User-Agent" => user_agent }
|
63
|
+
request.auth.ssl.verify_mode = :none
|
64
|
+
request.query = query(method, api_method, options)
|
65
|
+
request.body = body(method, api_method, options)
|
64
66
|
|
65
67
|
request
|
66
68
|
end
|
@@ -42,19 +42,21 @@ module ActiveCampaign
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def data
|
45
|
-
@data ||=
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
45
|
+
@data ||= parse_body
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_body
|
49
|
+
body = @response[:body]
|
50
|
+
|
51
|
+
if body.present? && body.is_a?(String)
|
52
|
+
return Sawyer::Agent.serializer.decode(body) if is_json?
|
53
|
+
end
|
54
|
+
|
55
|
+
body
|
56
|
+
end
|
57
|
+
|
58
|
+
def is_json?
|
59
|
+
@response[:response_headers] && @response[:response_headers][:content_type] =~ /json/
|
58
60
|
end
|
59
61
|
|
60
62
|
def response_message
|
@@ -94,41 +96,41 @@ module ActiveCampaign
|
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
97
|
-
# Raised when
|
99
|
+
# Raised when ActiveCampaign returns a 400 HTTP status code
|
98
100
|
class BadRequest < Error; end
|
99
101
|
|
100
|
-
# Raised when
|
102
|
+
# Raised when ActiveCampaign returns a 401 HTTP status code
|
101
103
|
class Unauthorized < Error; end
|
102
104
|
|
103
|
-
# Raised when
|
105
|
+
# Raised when ActiveCampaign returns a 403 HTTP status code
|
104
106
|
class Forbidden < Error; end
|
105
107
|
|
106
|
-
# Raised when
|
108
|
+
# Raised when ActiveCampaign returns a 403 HTTP status code
|
107
109
|
# and body matches 'rate limit exceeded'
|
108
110
|
class TooManyRequests < Forbidden; end
|
109
111
|
|
110
|
-
# Raised when
|
112
|
+
# Raised when ActiveCampaign returns a 403 HTTP status code
|
111
113
|
# and body matches 'login attempts exceeded'
|
112
114
|
class TooManyLoginAttempts < Forbidden; end
|
113
115
|
|
114
|
-
# Raised when
|
116
|
+
# Raised when ActiveCampaign returns a 404 HTTP status code
|
115
117
|
class NotFound < Error; end
|
116
118
|
|
117
|
-
# Raised when
|
119
|
+
# Raised when ActiveCampaign returns a 406 HTTP status code
|
118
120
|
class NotAcceptable < Error; end
|
119
121
|
|
120
|
-
# Raised when
|
122
|
+
# Raised when ActiveCampaign returns a 422 HTTP status code
|
121
123
|
class UnprocessableEntity < Error; end
|
122
124
|
|
123
|
-
# Raised when
|
125
|
+
# Raised when ActiveCampaign returns a 500 HTTP status code
|
124
126
|
class InternalServerError < Error; end
|
125
127
|
|
126
|
-
# Raised when
|
128
|
+
# Raised when ActiveCampaign returns a 501 HTTP status code
|
127
129
|
class NotImplemented < Error; end
|
128
130
|
|
129
|
-
# Raised when
|
131
|
+
# Raised when ActiveCampaign returns a 502 HTTP status code
|
130
132
|
class BadGateway < Error; end
|
131
133
|
|
132
|
-
# Raised when
|
134
|
+
# Raised when ActiveCampaign returns a 503 HTTP status code
|
133
135
|
class ServiceUnavailable < Error; end
|
134
136
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -41,7 +41,7 @@ VCR.configure do |c|
|
|
41
41
|
|
42
42
|
c.default_cassette_options = {
|
43
43
|
serialize_with: :json,
|
44
|
-
|
44
|
+
|
45
45
|
preserve_exact_body_bytes: true,
|
46
46
|
decode_compressed_response: true,
|
47
47
|
record: ENV['CI'] ? :none : :once
|
@@ -61,14 +61,14 @@ end
|
|
61
61
|
|
62
62
|
def initialize_new_client
|
63
63
|
before do
|
64
|
-
@client = ActiveCampaign::Client.new(
|
64
|
+
@client = ActiveCampaign::Client.new(
|
65
65
|
mash: true,
|
66
66
|
debug: true,
|
67
67
|
api_endpoint: test_api_endpoint,
|
68
68
|
api_key: test_api_key,
|
69
69
|
log_level: :debug,
|
70
70
|
log: true
|
71
|
-
|
71
|
+
)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
metadata
CHANGED
@@ -1,22 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_campaign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
prerelease: false
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
14
|
name: httpi
|
21
15
|
requirement: !ruby/object:Gem::Requirement
|
22
16
|
requirements:
|
@@ -24,13 +18,13 @@ dependencies:
|
|
24
18
|
- !ruby/object:Gem::Version
|
25
19
|
version: '0'
|
26
20
|
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
21
|
prerelease: false
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
24
|
- - ">="
|
32
25
|
- !ruby/object:Gem::Version
|
33
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
34
28
|
name: hashie
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
@@ -38,6 +32,12 @@ dependencies:
|
|
38
32
|
- !ruby/object:Gem::Version
|
39
33
|
version: '0'
|
40
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
41
|
description: A simple ruby wrapper for the ActiveCampaign API
|
42
42
|
email:
|
43
43
|
- mikael@zoolutions.se
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.1
|
101
|
+
rubygems_version: 2.2.0.rc.1
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: See http://www.activecampaign.com/api/overview.php for more information
|