i_contact 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ module IContact
2
+ class Response
3
+ include ActiveAttr::BasicModel
4
+
5
+ attr_reader :errors
6
+ attr_reader :warnings
7
+ attr_reader :parsed_response
8
+
9
+ def initialize(resp)
10
+ @parsed_response = JSON.parse(resp.body)
11
+ if resp.status != 200
12
+ @errors = ["Server responded with a #{resp.status}: #{resp.body}"]
13
+ else
14
+ @errors = @parsed_response['errors'] || []
15
+ @warnings = @parsed_response['warnings'] || []
16
+ end
17
+ end
18
+
19
+ def valid?
20
+ errors.size == 0
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,10 @@
1
+ module IContact
2
+ class Subscription
3
+ include IContact::Model
4
+
5
+ key_attribute :subscription_id
6
+ attribute :contact_id, :type => Integer
7
+ attribute :list_id, :type => Integer
8
+ attribute :status, :type => String
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module IContact
2
+ VERSION = "0.1.0"
3
+ end
4
+
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://app.sandbox.icontact.com/icp/a
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Api-Appid:
11
+ - <APP_ID>
12
+ Api-Username:
13
+ - <USER_NAME>
14
+ Api-Password:
15
+ - <PASSWORD>
16
+ Api-Version:
17
+ - '2.2'
18
+ Accept:
19
+ - application/json
20
+ Content-Type:
21
+ - application/json
22
+ Accept-Encoding:
23
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Date:
32
+ - Sat, 09 Jun 2012 19:46:51 GMT
33
+ Server:
34
+ - Apache
35
+ Vary:
36
+ - Accept-Encoding
37
+ Content-Encoding:
38
+ - gzip
39
+ Content-Length:
40
+ - '313'
41
+ Connection:
42
+ - close
43
+ Content-Type:
44
+ - text/html; charset=utf-8
45
+ body:
46
+ encoding: ASCII-8BIT
47
+ string: !binary |-
48
+ H4sIAAAAAAAAA1WQUUvDMBSF/0rJk8KUtHWt25O1KAgqytyT+JC2txpIk5Hc
49
+ DMvYf/dmzYbL2z0n9zvJ2THRtsZrdGz5uWONVErq7xVaAGRLxmZHqZY4ngkr
50
+ FAhnyptxKFRtunO5Dngbl9sJ8+6lbkeaY/pTR+JNmudZHi6ZYSP0+CqGSGpP
51
+ iLWWCF1yCHfkwCCkIl3AFiwg3g2iE1tjr4kRbC0aBQGe0tSL34nXS+sw4ivf
52
+ WAhPUeKkPUwwEgevUNZKgsZHozqw5PKjvnanefNjdNi8KNLyMil5cbXgZRmM
53
+ /6XwLC0WJLrY3Ut1GGLZt/Nk6iWptqA9zJKVp98m93QJJapYRqzsY9xADHe+
54
+ ca2VDdhnOciAyuacDtt/0aahfLZM6YOTmfEZM33vQibf/wG+Ie9kAQIAAA==
55
+ http_version:
56
+ recorded_at: Sat, 09 Jun 2012 19:46:50 GMT
57
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Api-Appid:
11
+ - <APP_ID>
12
+ Api-Username:
13
+ - <USER_NAME>
14
+ Api-Password:
15
+ - <PASSWORD>
16
+ Api-Version:
17
+ - '2.2'
18
+ Accept:
19
+ - application/json
20
+ Content-Type:
21
+ - application/json
22
+ Accept-Encoding:
23
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Date:
32
+ - Sat, 09 Jun 2012 19:46:51 GMT
33
+ Server:
34
+ - Apache
35
+ Vary:
36
+ - Accept-Encoding
37
+ Content-Encoding:
38
+ - gzip
39
+ Content-Length:
40
+ - '122'
41
+ Connection:
42
+ - close
43
+ Content-Type:
44
+ - text/html; charset=utf-8
45
+ body:
46
+ encoding: ASCII-8BIT
47
+ string: !binary |-
48
+ H4sIAAAAAAAAAy3KsQqDQAwG4Hf550NQioWbOgldu5YOIZfWw3gRG3EQ3721
49
+ dP34NrBmKf40TTK/Ee/bX7qfXBMi6ubUtmcEqL3skLKoBshIWW/CeTr+9yUq
50
+ 1ZR5EPeL0lK4X2mWim3E/ghwc1LEev8A/cq3k3UAAAA=
51
+ http_version:
52
+ recorded_at: Sat, 09 Jun 2012 19:46:51 GMT
53
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,249 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/contacts
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"email":"user@example.com"}]'
9
+ headers:
10
+ Api-Appid:
11
+ - <APP_ID>
12
+ Api-Username:
13
+ - <USER_NAME>
14
+ Api-Password:
15
+ - <PASSWORD>
16
+ Api-Version:
17
+ - '2.2'
18
+ Accept:
19
+ - application/json
20
+ Content-Type:
21
+ - application/json
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Date:
30
+ - Sat, 09 Jun 2012 19:46:51 GMT
31
+ Server:
32
+ - Apache
33
+ Vary:
34
+ - Accept-Encoding
35
+ Content-Length:
36
+ - '285'
37
+ Connection:
38
+ - close
39
+ Content-Type:
40
+ - text/html; charset=utf-8
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"contacts":[{"contactId":"66674163","prefix":"","firstName":"","lastName":"","suffix":"","street":"","street2":"","city":"","state":"","postalCode":"","phone":"","fax":"","business":"","email":"user@example.com","createDate":"2012-06-09
44
+ 15:46:52","bounceCount":"","status":"normal"}]}'
45
+ http_version:
46
+ recorded_at: Sat, 09 Jun 2012 19:46:51 GMT
47
+ - request:
48
+ method: get
49
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/contacts?unlisted=true
50
+ body:
51
+ encoding: US-ASCII
52
+ string: ''
53
+ headers:
54
+ Api-Appid:
55
+ - <APP_ID>
56
+ Api-Username:
57
+ - <USER_NAME>
58
+ Api-Password:
59
+ - <PASSWORD>
60
+ Api-Version:
61
+ - '2.2'
62
+ Accept:
63
+ - application/json
64
+ Content-Type:
65
+ - application/json
66
+ Accept-Encoding:
67
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
68
+ User-Agent:
69
+ - Ruby
70
+ response:
71
+ status:
72
+ code: 200
73
+ message: OK
74
+ headers:
75
+ Date:
76
+ - Sat, 09 Jun 2012 19:46:52 GMT
77
+ Server:
78
+ - Apache
79
+ Vary:
80
+ - Accept-Encoding
81
+ Content-Encoding:
82
+ - gzip
83
+ Content-Length:
84
+ - '458'
85
+ Connection:
86
+ - close
87
+ Content-Type:
88
+ - text/html; charset=utf-8
89
+ body:
90
+ encoding: ASCII-8BIT
91
+ string: !binary |-
92
+ H4sIAAAAAAAAA81Su27bQBD8lcVVMUALFG3SECsbTgo3QQo3QeJidVyKB9+D
93
+ uYcoxdC/Z0nKVIJ0qdKQt7Nzs7NDvgnpbEQZg6i/vQkyqLSoBdKePMV4b7DB
94
+ vfMr6YzIRKt8iJ/REFMe0tbTkUGNC/ZpvsVg76lVB1HbpHUmQmp/q1pcjn3n
95
+ LC2s6Inin1XxXkoVj5cWxuVW77jUj65ZEOmJ+x8njijydXGdl9f5Boq8Lu7q
96
+ shSzQuKVhXXeoGZk65KV9MjPxcE5maeGeVVVldXmZiNO2SWlFMjf0wFNr+nv
97
+ hGaRSzpnu/9XMNUYzLqsb6u6LP4xmLvbdXUjTi+8rDKKWUWeCde2YfTMx+jY
98
+ B6OZGNBbZXfjvyaeO4IGI8LRJfAkSe2pAYNHsC7ClmDoME5NOvQkIzUreO5U
99
+ gA77nixztySRP8HI8azwI1GIMHlTYzuSN4FVlOwYTbp5F+ZhbmfVT+agbSA4
100
+ GPi3BbXjnRn7kKxWgeddrb7brzxfooXGAanYkQfXAr+hdVq7gZepzxcZZXPn
101
+ DSfh0YqyiTJwnhd7JUCwNCxWUxiZs815Iig7iT98eeKJMhniZaJydiVeTr8A
102
+ IJpg+KsDAAA=
103
+ http_version:
104
+ recorded_at: Sat, 09 Jun 2012 19:46:52 GMT
105
+ - request:
106
+ method: get
107
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/contacts?email=user@example.com&unlisted=true
108
+ body:
109
+ encoding: US-ASCII
110
+ string: ''
111
+ headers:
112
+ Api-Appid:
113
+ - <APP_ID>
114
+ Api-Username:
115
+ - <USER_NAME>
116
+ Api-Password:
117
+ - <PASSWORD>
118
+ Api-Version:
119
+ - '2.2'
120
+ Accept:
121
+ - application/json
122
+ Content-Type:
123
+ - application/json
124
+ Accept-Encoding:
125
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
126
+ User-Agent:
127
+ - Ruby
128
+ response:
129
+ status:
130
+ code: 200
131
+ message: OK
132
+ headers:
133
+ Date:
134
+ - Sat, 09 Jun 2012 19:46:52 GMT
135
+ Server:
136
+ - Apache
137
+ Vary:
138
+ - Accept-Encoding
139
+ Content-Encoding:
140
+ - gzip
141
+ Content-Length:
142
+ - '399'
143
+ Connection:
144
+ - close
145
+ Content-Type:
146
+ - text/html; charset=utf-8
147
+ body:
148
+ encoding: ASCII-8BIT
149
+ string: !binary |-
150
+ H4sIAAAAAAAAA1VRTU/bQBD9K6M5tZKJEgOu8AlEL1wqDlyqlsNkPY5XrHfc
151
+ /aiTIv57x05i4GL7zbx9H+tXNOITmRSx/vWK3JN1WGOOHG55T/3geGWkxwJb
152
+ G2L6QT1j7bNzBTr6jIfArd2fUcztB9TS8jl04pczMQXm9BmVZ2hsOryvKL07
153
+ iUJ3L80yMYF1/33mYLnelBfr6mJ9A5vr+qqqr0s8KmRtiV5CT04nW8ne8L0+
154
+ lwSny3holFdV1berTXWJb89a1vZWWeW6QGnbOGXWzySaA+tNgSMFb/1uukV8
155
+ 6hgaSgQHyRDYsP3LDfR0AC8JtgxjR2le8n5gk7hZwVNnI3Q0DOyVu2VD+gsm
156
+ TlCFP5ljgjmbndaJQx9VxZpOp9k1Z2E1k523/5RDvoEoMHJgsDvtrLMv2Tsb
157
+ 1e/r6rf/qf6GPDQCbFPHAaQFfUMrzsmoZerTQZ1quFPDWXiKYn3mAiRosRcG
158
+ As/jEjXHiXmMeXQE62fxu8cHdTS5Zy2TrPgVPr/9B7BnB/uFAgAA
159
+ http_version:
160
+ recorded_at: Sat, 09 Jun 2012 19:46:52 GMT
161
+ - request:
162
+ method: post
163
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/contacts/66674163
164
+ body:
165
+ encoding: UTF-8
166
+ string: ! '{"status":"deleted"}'
167
+ headers:
168
+ Api-Appid:
169
+ - <APP_ID>
170
+ Api-Username:
171
+ - <USER_NAME>
172
+ Api-Password:
173
+ - <PASSWORD>
174
+ Api-Version:
175
+ - '2.2'
176
+ Accept:
177
+ - application/json
178
+ Content-Type:
179
+ - application/json
180
+ User-Agent:
181
+ - Ruby
182
+ response:
183
+ status:
184
+ code: 400
185
+ message: Bad Request
186
+ headers:
187
+ Date:
188
+ - Sat, 09 Jun 2012 19:46:53 GMT
189
+ Server:
190
+ - Apache
191
+ Vary:
192
+ - Accept-Encoding
193
+ Content-Length:
194
+ - '134'
195
+ Connection:
196
+ - close
197
+ Content-Type:
198
+ - text/html; charset=utf-8
199
+ body:
200
+ encoding: US-ASCII
201
+ string: ! '{"errors":["The status value you provided was not valid. status can
202
+ be either donotcontact or normal. Please provide a valid status"]}'
203
+ http_version:
204
+ recorded_at: Sat, 09 Jun 2012 19:46:53 GMT
205
+ - request:
206
+ method: post
207
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/contacts
208
+ body:
209
+ encoding: UTF-8
210
+ string: ! '[{}]'
211
+ headers:
212
+ Api-Appid:
213
+ - <APP_ID>
214
+ Api-Username:
215
+ - <USER_NAME>
216
+ Api-Password:
217
+ - <PASSWORD>
218
+ Api-Version:
219
+ - '2.2'
220
+ Accept:
221
+ - application/json
222
+ Content-Type:
223
+ - application/json
224
+ User-Agent:
225
+ - Ruby
226
+ response:
227
+ status:
228
+ code: 200
229
+ message: OK
230
+ headers:
231
+ Date:
232
+ - Sat, 09 Jun 2012 20:12:11 GMT
233
+ Server:
234
+ - Apache
235
+ Vary:
236
+ - Accept-Encoding
237
+ Content-Length:
238
+ - '117'
239
+ Connection:
240
+ - close
241
+ Content-Type:
242
+ - text/html; charset=utf-8
243
+ body:
244
+ encoding: US-ASCII
245
+ string: ! '{"contacts":null,"warnings":["You did not provide an email field,
246
+ which is required. Please provide an email field"]}'
247
+ http_version:
248
+ recorded_at: Sat, 09 Jun 2012 20:12:11 GMT
249
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,89 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/lists
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"name":"Test List"}]'
9
+ headers:
10
+ Api-Appid:
11
+ - <APP_ID>
12
+ Api-Username:
13
+ - <USER_NAME>
14
+ Api-Password:
15
+ - <PASSWORD>
16
+ Api-Version:
17
+ - '2.2'
18
+ Accept:
19
+ - application/json
20
+ Content-Type:
21
+ - application/json
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Date:
30
+ - Sat, 09 Jun 2012 19:46:53 GMT
31
+ Server:
32
+ - Apache
33
+ Vary:
34
+ - Accept-Encoding
35
+ Content-Length:
36
+ - '174'
37
+ Connection:
38
+ - close
39
+ Content-Type:
40
+ - text/html; charset=utf-8
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"lists":[{"listId":"205303","name":"Test List","publicname":"","description":"","emailOwnerOnChange":1,"welcomeOnManualAdd":0,"welcomeOnSignupAdd":0,"welcomeMessageId":""}]}'
44
+ http_version:
45
+ recorded_at: Sat, 09 Jun 2012 19:46:53 GMT
46
+ - request:
47
+ method: delete
48
+ uri: https://app.sandbox.icontact.com/icp/a/413323/c/124667/lists/205303
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ Api-Appid:
54
+ - <APP_ID>
55
+ Api-Username:
56
+ - <USER_NAME>
57
+ Api-Password:
58
+ - <PASSWORD>
59
+ Api-Version:
60
+ - '2.2'
61
+ Accept:
62
+ - application/json
63
+ Content-Type:
64
+ - application/json
65
+ User-Agent:
66
+ - Ruby
67
+ response:
68
+ status:
69
+ code: 200
70
+ message: OK
71
+ headers:
72
+ Date:
73
+ - Sat, 09 Jun 2012 19:46:54 GMT
74
+ Server:
75
+ - Apache
76
+ Vary:
77
+ - Accept-Encoding
78
+ Content-Length:
79
+ - '2'
80
+ Connection:
81
+ - close
82
+ Content-Type:
83
+ - text/html; charset=utf-8
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ! '[]'
87
+ http_version:
88
+ recorded_at: Sat, 09 Jun 2012 19:46:54 GMT
89
+ recorded_with: VCR 2.1.1