infusionsoft 1.1.8 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +9 -0
- data/Gemfile +12 -0
- data/LICENSE.md +0 -2
- data/README.md +17 -21
- data/Rakefile +12 -2
- data/infusionsoft.gemspec +2 -2
- data/lib/infusionsoft/client.rb +2 -0
- data/lib/infusionsoft/client/contact.rb +15 -5
- data/lib/infusionsoft/client/email.rb +1 -1
- data/lib/infusionsoft/client/funnel.rb +18 -0
- data/lib/infusionsoft/client/invoice.rb +1 -1
- data/lib/infusionsoft/connection.rb +1 -1
- data/lib/infusionsoft/request.rb +1 -0
- data/lib/infusionsoft/version.rb +1 -1
- data/test/client/contact_test.rb +79 -0
- data/test/client/data_test.rb +102 -0
- data/test/client/email_test.rb +89 -0
- data/test/exceptions_test.rb +131 -0
- data/test/test_helper.rb +47 -0
- data/test/vcr_cassettes/add_to_group.yml +49 -0
- data/test/vcr_cassettes/contact_add.yml +93 -0
- data/test/vcr_cassettes/contact_add_dup_check_no_dup.yml +93 -0
- data/test/vcr_cassettes/contact_add_dup_check_with_dup.yml +186 -0
- data/test/vcr_cassettes/contact_load.yml +49 -0
- data/test/vcr_cassettes/contact_merge.yml +49 -0
- data/test/vcr_cassettes/contact_update.yml +95 -0
- data/test/vcr_cassettes/data_add.yml +49 -0
- data/test/vcr_cassettes/data_add_custom_field.yml +49 -0
- data/test/vcr_cassettes/data_auth_user_failure.yml +50 -0
- data/test/vcr_cassettes/data_auth_user_success.yml +49 -0
- data/test/vcr_cassettes/data_delete.yml +49 -0
- data/test/vcr_cassettes/data_find_by_field.yml +51 -0
- data/test/vcr_cassettes/data_get_app_setting.yml +50 -0
- data/test/vcr_cassettes/data_load.yml +51 -0
- data/test/vcr_cassettes/data_query.yml +51 -0
- data/test/vcr_cassettes/data_query_order_by.yml +51 -0
- data/test/vcr_cassettes/data_update.yml +96 -0
- data/test/vcr_cassettes/data_update_custom_field.yml +49 -0
- data/test/vcr_cassettes/email_add.yml +50 -0
- data/test/vcr_cassettes/email_attach.yml +50 -0
- data/test/vcr_cassettes/email_get_available_merge_fields.yml +52 -0
- data/test/vcr_cassettes/email_get_opt_status.yml +50 -0
- data/test/vcr_cassettes/email_get_template.yml +118 -0
- data/test/vcr_cassettes/email_optin.yml +50 -0
- data/test/vcr_cassettes/email_optout.yml +50 -0
- data/test/vcr_cassettes/email_send.yml +50 -0
- data/test/vcr_cassettes/email_send_template.yml +50 -0
- data/test/vcr_cassettes/email_update_template.yml +50 -0
- data/test/vcr_cassettes/find_by_email.yml +49 -0
- data/test/vcr_cassettes/remove_from_group.yml +49 -0
- metadata +50 -17
- data/test/api_infusion_test.rb +0 -8
- data/test/test_exceptions.rb +0 -113
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://test.infusionsoft.com/api/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>APIEmailService.sendEmail</methodName><params><param><value><string>not_a_real_key</string></value></param><param><value><array><data><value><i4>304</i4></value></data></array></value></param><param><value><string>the_dude@lebowski.com</string></value></param><param><value><string>hagglundized@gmail.com</string></value></param><param><value><string>hagglundized+cc@gmail.com</string></value></param><param><value><string>hagglundized+bcc@gmail.com</string></value></param><param><value><string>Multipart</string></value></param><param><value><string>Question</string></value></param><param><value><string><em>Where's the money?</em></string></value></param><param><value><string>Where's the money?</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Infusionsoft-1.1.9 (RubyGem)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '823'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- "*/*"
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Apache-Coyote/1.1
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache, no-store
|
34
|
+
Expires:
|
35
|
+
- Sun, 26 Jul 2015 18:12:41 GMT
|
36
|
+
Content-Type:
|
37
|
+
- text/xml;charset=UTF-8
|
38
|
+
Content-Length:
|
39
|
+
- '138'
|
40
|
+
Date:
|
41
|
+
- Sun, 26 Jul 2015 06:12:41 GMT
|
42
|
+
Set-Cookie:
|
43
|
+
- app-lb=!oBOEXJjuJBkLy25gcOos6QUUDc5trTU8mWclXgkxITEmdEgR2ryRhepGolGaYggEokUho52K+zQFJRY=;
|
44
|
+
path=/
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: <?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><boolean>0</boolean></value></param></params></methodResponse>
|
48
|
+
http_version:
|
49
|
+
recorded_at: Sun, 26 Jul 2015 06:12:46 GMT
|
50
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://test.infusionsoft.com/api/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>APIEmailService.sendEmail</methodName><params><param><value><string>not_a_real_key</string></value></param><param><value><array><data><value><i4>304</i4></value></data></array></value></param><param><value><string>3649</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Infusionsoft-1.1.9 (RubyGem)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '330'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- "*/*"
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Apache-Coyote/1.1
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache, no-store
|
34
|
+
Expires:
|
35
|
+
- Sun, 26 Jul 2015 18:21:45 GMT
|
36
|
+
Content-Type:
|
37
|
+
- text/xml;charset=UTF-8
|
38
|
+
Content-Length:
|
39
|
+
- '138'
|
40
|
+
Date:
|
41
|
+
- Sun, 26 Jul 2015 06:21:45 GMT
|
42
|
+
Set-Cookie:
|
43
|
+
- app-lb=!DgCMPFLPwsRrJ7FgcOos6QUUDc5trW40eacyVJiXX9ivZvIUPj3Z1Vq2QHpBKKIGpIHZuWRMPAxjDss=;
|
44
|
+
path=/
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: <?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><boolean>1</boolean></value></param></params></methodResponse>
|
48
|
+
http_version:
|
49
|
+
recorded_at: Sun, 26 Jul 2015 06:21:50 GMT
|
50
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://test.infusionsoft.com/api/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>APIEmailService.updateEmailTemplate</methodName><params><param><value><string>not_a_real_key</string></value></param><param><value><i4>3649</i4></value></param><param><value><string>Testingness Testagram</string></value></param><param><value><string></string></value></param><param><value><string></string></value></param><param><value><string>hagglundized@gmail.com</string></value></param><param><value><string>hagglundized+cc@gmail.com</string></value></param><param><value><string>hagglundized+bcc@gmail.com</string></value></param><param><value><string>Testingness Testagrams</string></value></param><param><value><string>Stuff</string></value></param><param><value><string><em>Stuff</em></string></value></param><param><value><string>Multipart</string></value></param><param><value><string>Contact</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Infusionsoft-1.1.9 (RubyGem)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '927'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- "*/*"
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Apache-Coyote/1.1
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache, no-store
|
34
|
+
Expires:
|
35
|
+
- Sun, 26 Jul 2015 18:34:08 GMT
|
36
|
+
Content-Type:
|
37
|
+
- text/xml;charset=UTF-8
|
38
|
+
Content-Length:
|
39
|
+
- '138'
|
40
|
+
Date:
|
41
|
+
- Sun, 26 Jul 2015 06:34:08 GMT
|
42
|
+
Set-Cookie:
|
43
|
+
- app-lb=!NORea5udHdc0/nBgcOos6QUUDc5trboDiqGn/2sseBn/yrXkGUYRZI/tjRKQhFWGZqtX4qFzm40307M=;
|
44
|
+
path=/
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: <?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><boolean>1</boolean></value></param></params></methodResponse>
|
48
|
+
http_version:
|
49
|
+
recorded_at: Sun, 26 Jul 2015 06:34:13 GMT
|
50
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://test.infusionsoft.com/api/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>ContactService.findByEmail</methodName><params><param><value><string>not_a_real_key</string></value></param><param><value><string>test@tester.com</string></value></param><param><value><array><data><value><string>Id</string></value></data></array></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Infusionsoft-1.1.8 (RubyGem)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '349'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- "*/*"
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Apache-Coyote/1.1
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache, no-store
|
34
|
+
Expires:
|
35
|
+
- Fri, 10 Apr 2015 20:18:59 GMT
|
36
|
+
Content-Type:
|
37
|
+
- text/xml;charset=UTF-8
|
38
|
+
Content-Length:
|
39
|
+
- '330'
|
40
|
+
Date:
|
41
|
+
- Fri, 10 Apr 2015 08:18:59 GMT
|
42
|
+
Set-Cookie:
|
43
|
+
- app-lb=2466578442.20480.0000; path=/
|
44
|
+
body:
|
45
|
+
encoding: UTF-8
|
46
|
+
string: <?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><array><data><value><struct><member><name>Id</name><value><i4>3606</i4></value></member></struct></value><value><struct><member><name>Id</name><value><i4>3610</i4></value></member></struct></value></data></array></value></param></params></methodResponse>
|
47
|
+
http_version:
|
48
|
+
recorded_at: Fri, 10 Apr 2015 08:18:59 GMT
|
49
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://test.infusionsoft.com/api/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>ContactService.removeFromGroup</methodName><params><param><value><string>not_a_real_key</string></value></param><param><value><i4>3794</i4></value></param><param><value><i4>382</i4></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Infusionsoft-1.1.8 (RubyGem)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '284'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- "*/*"
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Apache-Coyote/1.1
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache, no-store
|
34
|
+
Expires:
|
35
|
+
- Sat, 30 May 2015 19:31:42 GMT
|
36
|
+
Content-Type:
|
37
|
+
- text/xml;charset=UTF-8
|
38
|
+
Content-Length:
|
39
|
+
- '138'
|
40
|
+
Date:
|
41
|
+
- Sat, 30 May 2015 07:31:42 GMT
|
42
|
+
Set-Cookie:
|
43
|
+
- app-lb=2466578442.20480.0000; path=/
|
44
|
+
body:
|
45
|
+
encoding: UTF-8
|
46
|
+
string: <?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><boolean>1</boolean></value></param></params></methodResponse>
|
47
|
+
http_version:
|
48
|
+
recorded_at: Sat, 30 May 2015 07:31:42 GMT
|
49
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,40 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infusionsoft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nathan Leavitt
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: A Ruby wrapper written for the Infusionsoft API
|
31
28
|
email:
|
32
|
-
-
|
29
|
+
- nateleavitt@gmail.com
|
33
30
|
executables: []
|
34
31
|
extensions: []
|
35
32
|
extra_rdoc_files: []
|
36
33
|
files:
|
37
|
-
- .gitignore
|
34
|
+
- ".gitignore"
|
35
|
+
- ".travis.yml"
|
36
|
+
- Gemfile
|
38
37
|
- LICENSE.md
|
39
38
|
- README.md
|
40
39
|
- Rakefile
|
@@ -49,6 +48,7 @@ files:
|
|
49
48
|
- lib/infusionsoft/client/data.rb
|
50
49
|
- lib/infusionsoft/client/email.rb
|
51
50
|
- lib/infusionsoft/client/file.rb
|
51
|
+
- lib/infusionsoft/client/funnel.rb
|
52
52
|
- lib/infusionsoft/client/invoice.rb
|
53
53
|
- lib/infusionsoft/client/search.rb
|
54
54
|
- lib/infusionsoft/client/ticket.rb
|
@@ -59,30 +59,63 @@ files:
|
|
59
59
|
- lib/infusionsoft/exceptions.rb
|
60
60
|
- lib/infusionsoft/request.rb
|
61
61
|
- lib/infusionsoft/version.rb
|
62
|
-
- test/
|
63
|
-
- test/
|
62
|
+
- test/client/contact_test.rb
|
63
|
+
- test/client/data_test.rb
|
64
|
+
- test/client/email_test.rb
|
65
|
+
- test/exceptions_test.rb
|
66
|
+
- test/test_helper.rb
|
67
|
+
- test/vcr_cassettes/add_to_group.yml
|
68
|
+
- test/vcr_cassettes/contact_add.yml
|
69
|
+
- test/vcr_cassettes/contact_add_dup_check_no_dup.yml
|
70
|
+
- test/vcr_cassettes/contact_add_dup_check_with_dup.yml
|
71
|
+
- test/vcr_cassettes/contact_load.yml
|
72
|
+
- test/vcr_cassettes/contact_merge.yml
|
73
|
+
- test/vcr_cassettes/contact_update.yml
|
74
|
+
- test/vcr_cassettes/data_add.yml
|
75
|
+
- test/vcr_cassettes/data_add_custom_field.yml
|
76
|
+
- test/vcr_cassettes/data_auth_user_failure.yml
|
77
|
+
- test/vcr_cassettes/data_auth_user_success.yml
|
78
|
+
- test/vcr_cassettes/data_delete.yml
|
79
|
+
- test/vcr_cassettes/data_find_by_field.yml
|
80
|
+
- test/vcr_cassettes/data_get_app_setting.yml
|
81
|
+
- test/vcr_cassettes/data_load.yml
|
82
|
+
- test/vcr_cassettes/data_query.yml
|
83
|
+
- test/vcr_cassettes/data_query_order_by.yml
|
84
|
+
- test/vcr_cassettes/data_update.yml
|
85
|
+
- test/vcr_cassettes/data_update_custom_field.yml
|
86
|
+
- test/vcr_cassettes/email_add.yml
|
87
|
+
- test/vcr_cassettes/email_attach.yml
|
88
|
+
- test/vcr_cassettes/email_get_available_merge_fields.yml
|
89
|
+
- test/vcr_cassettes/email_get_opt_status.yml
|
90
|
+
- test/vcr_cassettes/email_get_template.yml
|
91
|
+
- test/vcr_cassettes/email_optin.yml
|
92
|
+
- test/vcr_cassettes/email_optout.yml
|
93
|
+
- test/vcr_cassettes/email_send.yml
|
94
|
+
- test/vcr_cassettes/email_send_template.yml
|
95
|
+
- test/vcr_cassettes/email_update_template.yml
|
96
|
+
- test/vcr_cassettes/find_by_email.yml
|
97
|
+
- test/vcr_cassettes/remove_from_group.yml
|
64
98
|
homepage: https://github.com/nateleavitt/infusionsoft
|
65
99
|
licenses: []
|
100
|
+
metadata: {}
|
66
101
|
post_install_message:
|
67
102
|
rdoc_options: []
|
68
103
|
require_paths:
|
69
104
|
- lib
|
70
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
106
|
requirements:
|
73
|
-
- -
|
107
|
+
- - ">="
|
74
108
|
- !ruby/object:Gem::Version
|
75
109
|
version: '0'
|
76
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
111
|
requirements:
|
79
|
-
- -
|
112
|
+
- - ">="
|
80
113
|
- !ruby/object:Gem::Version
|
81
114
|
version: 1.3.6
|
82
115
|
requirements: []
|
83
116
|
rubyforge_project:
|
84
|
-
rubygems_version:
|
117
|
+
rubygems_version: 2.4.5
|
85
118
|
signing_key:
|
86
|
-
specification_version:
|
119
|
+
specification_version: 4
|
87
120
|
summary: Ruby wrapper for the Infusionsoft API
|
88
121
|
test_files: []
|
data/test/api_infusion_test.rb
DELETED
data/test/test_exceptions.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'infusionsoft'
|
3
|
-
|
4
|
-
|
5
|
-
# override XMLRPC call method
|
6
|
-
class XMLRPC::Client
|
7
|
-
|
8
|
-
def call(method, *args)
|
9
|
-
raise XMLRPC::FaultException.new(@@code, @@message)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.set_fault_response(code, message)
|
13
|
-
@@code = code
|
14
|
-
@@message = message
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class TestLogger
|
19
|
-
def info(msg); end
|
20
|
-
def warn(msg); end
|
21
|
-
def error(msg); end
|
22
|
-
def debug(msg); end
|
23
|
-
def fatal(msg); end
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
class TestExceptions < Test::Unit::TestCase
|
28
|
-
|
29
|
-
def setup
|
30
|
-
Infusionsoft.configure do |c|
|
31
|
-
c.api_logger = TestLogger.new()
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_should_raise_invalid_config
|
36
|
-
exception_test(Infusionsoft::InvalidConfigError, 1, 'The configuration for the application is invalid. Usually this is because there has not been a passphrase entered to generate an encrypted key.')
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_should_raise_invalid_key
|
40
|
-
exception_test(Infusionsoft::InvalidKeyError, 2, "The key passed up for authentication was not valid. It was either empty or didn't match.")
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_should_raise_unexpected_error
|
44
|
-
exception_test(Infusionsoft::UnexpectedError, 3, "An unexpected error has occurred. There was either an error in the data you passed up or there was an unknown error on")
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_should_raise_database_error
|
48
|
-
exception_test(Infusionsoft::DatabaseError, 4, "There was an error in the database access")
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_should_raise_record_not_found
|
52
|
-
exception_test(Infusionsoft::RecordNotFoundError, 5, "A requested record was not found in the database.")
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_should_raise_loading_error
|
56
|
-
exception_test(Infusionsoft::LoadingError, 6, "There was a problem loading a record from the database.")
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_should_raise_no_table_access
|
60
|
-
exception_test(Infusionsoft::NoTableAccessError, 7, "A table was accessed without the proper permission")
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_should_raise_no_field_access
|
64
|
-
exception_test(Infusionsoft::NoFieldAccessError, 8, "A field was accessed without the proper permission.")
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_should_raise_no_table_found
|
68
|
-
exception_test(Infusionsoft::NoTableFoundError, 9, "A table was accessed that doesn't exist in the Data Spec.")
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_should_raise_no_field_found
|
72
|
-
exception_test(Infusionsoft::NoFieldFoundError, 10, "A field was accessed that doesn't exist in the Data Spec.")
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_should_raise_no_fields_error
|
76
|
-
exception_test(Infusionsoft::NoFieldsError, 11, "An update or add operation was attempted with no valid fields to update or add.")
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_should_raise_invalid_parameter_error
|
80
|
-
exception_test(Infusionsoft::InvalidParameterError, 12, "Data sent into the call was invalid.")
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_should_raise_failed_login_attempt
|
84
|
-
exception_test(Infusionsoft::FailedLoginAttemptError, 13, "Someone attempted to authenticate a user and failed.")
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_should_raise_no_access_error
|
88
|
-
exception_test(Infusionsoft::NoAccessError, 14, "Someone attempted to access a plugin they are not paying for.")
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_should_raise_failed_login_attempt_password_expired
|
92
|
-
exception_test(Infusionsoft::FailedLoginAttemptPasswordExpiredError, 15, "Someone attempted to authenticate a user and the password is expired.")
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_should_raise_infusionapierror_when_fault_code_unknown
|
96
|
-
exception_test(InfusionAPIError, 42, "Some random error occurred")
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
private
|
101
|
-
def exception_test(exception, code, message)
|
102
|
-
XMLRPC::Client.set_fault_response(code, message)
|
103
|
-
caught = false
|
104
|
-
begin
|
105
|
-
Infusionsoft.data_query(:Contact, 1, 0, {}, [:BlahdyDah])
|
106
|
-
rescue exception => e
|
107
|
-
caught = true
|
108
|
-
assert_equal message, e.message
|
109
|
-
end
|
110
|
-
assert_equal true, caught
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|