responsys-api 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +3 -0
  3. data/.travis.yml +7 -0
  4. data/README.md +2 -2
  5. data/Rakefile +11 -0
  6. data/lib/responsys/api/campaign.rb +1 -1
  7. data/lib/responsys/api/client.rb +7 -10
  8. data/lib/responsys/api/object/email_format.rb +1 -1
  9. data/lib/responsys/api/object/field_type.rb +1 -1
  10. data/lib/responsys/api/object/optional_data.rb +1 -1
  11. data/lib/responsys/api/object/query_column.rb +1 -1
  12. data/lib/responsys/api/object/record.rb +1 -1
  13. data/lib/responsys/api/object/record_data.rb +1 -1
  14. data/lib/responsys/api/session.rb +16 -1
  15. data/lib/responsys/helper.rb +9 -1
  16. data/lib/responsys/i18n/en.yml +24 -19
  17. data/lib/responsys/i18n/fr.yml +21 -0
  18. data/lib/responsys_api.rb +1 -3
  19. data/responsys-api.gemspec +1 -1
  20. data/spec/api/campaign_spec.rb +3 -7
  21. data/spec/api/client_spec.rb +18 -48
  22. data/spec/api/list_spec.rb +7 -11
  23. data/spec/api/table_spec.rb +26 -31
  24. data/spec/api_credentials.sample.yml +3 -0
  25. data/spec/fixtures/vcr_cassettes/api/client/expired_session.yml +14 -953
  26. data/spec/fixtures/vcr_cassettes/api/list/merge.yml +9 -97
  27. data/spec/fixtures/vcr_cassettes/api/list/retrieve.yml +11 -11
  28. data/spec/fixtures/vcr_cassettes/api/list/retrieve_single.yml +9 -97
  29. data/spec/fixtures/vcr_cassettes/api/list/retrieve_single_single.yml +9 -9
  30. data/spec/fixtures/vcr_cassettes/api/profile_extension/merge_profile_extension_records.yml +10 -10
  31. data/spec/fixtures/vcr_cassettes/api/profile_extension/retrieve_profile_extension_records.yml +10 -10
  32. data/spec/fixtures/vcr_cassettes/api/table/create_with_pk.yml +8 -8
  33. data/spec/fixtures/vcr_cassettes/api/table/delete_with_pk.yml +8 -8
  34. data/spec/fixtures/vcr_cassettes/member/present1.yml +8 -945
  35. data/spec/fixtures/vcr_cassettes/member/present2.yml +8 -8
  36. data/spec/fixtures/vcr_cassettes/member/present3.yml +8 -8
  37. data/spec/fixtures/vcr_cassettes/member/present4.yml +8 -8
  38. data/spec/fixtures/vcr_cassettes/member/present5.yml +8 -8
  39. data/spec/fixtures/vcr_cassettes/member/retrieve_profile_extension.yml +19 -19
  40. data/spec/helper_spec.rb +31 -0
  41. data/spec/member_spec.rb +12 -21
  42. data/spec/spec_helper.rb +32 -15
  43. data/spec/test_data.yml +38 -0
  44. metadata +10 -12
  45. data/spec/fixtures/vcr_cassettes/api/campaign/login.yml +0 -940
  46. data/spec/fixtures/vcr_cassettes/api/list/login.yml +0 -982
  47. data/spec/fixtures/vcr_cassettes/api/profile_extension/login.yml +0 -982
  48. data/spec/fixtures/vcr_cassettes/api/table/create.yml +0 -45
  49. data/spec/fixtures/vcr_cassettes/api/table/delete.yml +0 -45
@@ -2,21 +2,21 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://wsxxxx.responsys.net/webservices/services/ResponsysWSService
5
+ uri: https://ws5.responsys.net/webservices/services/ResponsysWSService
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
9
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:ws.rsys.com"
10
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>bBvxPCXScxL40VhQx6JFG6ziO9</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>another_test_folder</tns:folderName><tns:objectName>test_list</tns:objectName></tns:list><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>1225</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>W1Qlwgd2Ysd7WOrfV45ddioFyh</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>rspec_tests</tns:folderName><tns:objectName>rspec_list1</tns:objectName></tns:list><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>48614925</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
11
11
  headers:
12
12
  Cookie:
13
- - JSESSIONID=EF4D2D3574EA896D10416D6FF9DE184E.ws01-ri5
13
+ - JSESSIONID=77DC067BAF16CCB4C50C44F50A95AE96.ws02-ri5
14
14
  Soapaction:
15
15
  - ! '"retrieveListMembers"'
16
16
  Content-Type:
17
17
  - text/xml;charset=UTF-8
18
18
  Content-Length:
19
- - '677'
19
+ - '675'
20
20
  Accept:
21
21
  - ! '*/*'
22
22
  User-Agent:
@@ -31,15 +31,15 @@ http_interactions:
31
31
  Content-Type:
32
32
  - text/xml; charset=UTF-8
33
33
  Date:
34
- - Fri, 29 Aug 2014 22:31:03 GMT
34
+ - Thu, 06 Nov 2014 07:37:16 GMT
35
35
  Server:
36
36
  - Apache
37
37
  Set-Cookie:
38
- - BIGipServerDC2-APIGEE-I5-9051-SSL=3617446922.23331.0000; path=/
38
+ - BIGipServerDC2-APIGEE-I5-9051-SSL=3600669706.23331.0000; path=/
39
39
  body:
40
40
  encoding: US-ASCII
41
41
  string: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><retrieveListMembersResponse
42
42
  xmlns="urn:ws.rsys.com"><result><recordData><fieldNames>EMAIL_PERMISSION_STATUS_</fieldNames><records><fieldValues>I</fieldValues></records></recordData></result></retrieveListMembersResponse></soapenv:Body></soapenv:Envelope>
43
43
  http_version:
44
- recorded_at: Fri, 29 Aug 2014 22:31:03 GMT
45
- recorded_with: VCR 2.5.0
44
+ recorded_at: Thu, 06 Nov 2014 07:37:19 GMT
45
+ recorded_with: VCR 2.9.3
@@ -2,21 +2,21 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://wsxxxx.responsys.net/webservices/services/ResponsysWSService
5
+ uri: https://ws5.responsys.net/webservices/services/ResponsysWSService
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
9
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:ws.rsys.com"
10
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>bBvxPCXScxL40VhQx6JFG6ziO9</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>another_test_folder</tns:folderName><tns:objectName>test_list</tns:objectName></tns:list><tns:queryColumn>EMAIL_ADDRESS</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>thisemailis@notpresent.com</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>W1Qlwgd2Ysd7WOrfV45ddioFyh</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>rspec_tests</tns:folderName><tns:objectName>rspec_list1</tns:objectName></tns:list><tns:queryColumn>EMAIL_ADDRESS</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>thisemailis@notpresent.com</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
11
11
  headers:
12
12
  Cookie:
13
- - JSESSIONID=EF4D2D3574EA896D10416D6FF9DE184E.ws01-ri5
13
+ - JSESSIONID=77DC067BAF16CCB4C50C44F50A95AE96.ws02-ri5
14
14
  Soapaction:
15
15
  - ! '"retrieveListMembers"'
16
16
  Content-Type:
17
17
  - text/xml;charset=UTF-8
18
18
  Content-Length:
19
- - '708'
19
+ - '702'
20
20
  Accept:
21
21
  - ! '*/*'
22
22
  User-Agent:
@@ -33,16 +33,16 @@ http_interactions:
33
33
  Content-Type:
34
34
  - text/xml;charset=UTF-8
35
35
  Date:
36
- - Fri, 29 Aug 2014 22:31:03 GMT
36
+ - Thu, 06 Nov 2014 07:37:17 GMT
37
37
  Server:
38
38
  - Apache
39
39
  Set-Cookie:
40
- - BIGipServerDC2-APIGEE-I5-9051-SSL=3617446922.23331.0000; path=/
40
+ - BIGipServerDC2-APIGEE-I5-9051-SSL=3600669706.23331.0000; path=/
41
41
  body:
42
42
  encoding: US-ASCII
43
43
  string: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>ListFault</faultstring><detail><ListFault
44
44
  xmlns="urn:fault.ws.rsys.com"><exceptionCode>RECORD_NOT_FOUND</exceptionCode><exceptionMessage>No
45
45
  records found in the list for given ids</exceptionMessage></ListFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
46
46
  http_version:
47
- recorded_at: Fri, 29 Aug 2014 22:31:03 GMT
48
- recorded_with: VCR 2.5.0
47
+ recorded_at: Thu, 06 Nov 2014 07:37:19 GMT
48
+ recorded_with: VCR 2.9.3
@@ -2,21 +2,21 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://wsxxxx.responsys.net/webservices/services/ResponsysWSService
5
+ uri: https://ws5.responsys.net/webservices/services/ResponsysWSService
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
9
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:ws.rsys.com"
10
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>bBvxPCXScxL40VhQx6JFG6ziO9</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>another_test_folder</tns:folderName><tns:objectName>test_list</tns:objectName></tns:list><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>000001</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>W1Qlwgd2Ysd7WOrfV45ddioFyh</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>rspec_tests</tns:folderName><tns:objectName>rspec_list1</tns:objectName></tns:list><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>000001</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
11
11
  headers:
12
12
  Cookie:
13
- - JSESSIONID=EF4D2D3574EA896D10416D6FF9DE184E.ws01-ri5
13
+ - JSESSIONID=77DC067BAF16CCB4C50C44F50A95AE96.ws02-ri5
14
14
  Soapaction:
15
15
  - ! '"retrieveListMembers"'
16
16
  Content-Type:
17
17
  - text/xml;charset=UTF-8
18
18
  Content-Length:
19
- - '679'
19
+ - '673'
20
20
  Accept:
21
21
  - ! '*/*'
22
22
  User-Agent:
@@ -33,16 +33,16 @@ http_interactions:
33
33
  Content-Type:
34
34
  - text/xml;charset=UTF-8
35
35
  Date:
36
- - Fri, 29 Aug 2014 22:31:04 GMT
36
+ - Thu, 06 Nov 2014 07:37:17 GMT
37
37
  Server:
38
38
  - Apache
39
39
  Set-Cookie:
40
- - BIGipServerDC2-APIGEE-I5-9051-SSL=3617446922.23331.0000; path=/
40
+ - BIGipServerDC2-APIGEE-I5-9051-SSL=3600669706.23331.0000; path=/
41
41
  body:
42
42
  encoding: US-ASCII
43
43
  string: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>ListFault</faultstring><detail><ListFault
44
44
  xmlns="urn:fault.ws.rsys.com"><exceptionCode>RECORD_NOT_FOUND</exceptionCode><exceptionMessage>No
45
45
  records found in the list for given ids</exceptionMessage></ListFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
46
46
  http_version:
47
- recorded_at: Fri, 29 Aug 2014 22:31:04 GMT
48
- recorded_with: VCR 2.5.0
47
+ recorded_at: Thu, 06 Nov 2014 07:37:19 GMT
48
+ recorded_with: VCR 2.9.3
@@ -2,21 +2,21 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://wsxxxx.responsys.net/webservices/services/ResponsysWSService
5
+ uri: https://ws5.responsys.net/webservices/services/ResponsysWSService
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
9
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:ws.rsys.com"
10
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>bBvxPCXScxL40VhQx6JFG6ziO9</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>another_test_folder</tns:folderName><tns:objectName>test_list</tns:objectName></tns:list><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>000001</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>W1Qlwgd2Ysd7WOrfV45ddioFyh</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveListMembers><tns:list><tns:folderName>rspec_tests</tns:folderName><tns:objectName>rspec_list1</tns:objectName></tns:list><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>EMAIL_PERMISSION_STATUS_</tns:fieldList><tns:idsToRetrieve>000001</tns:idsToRetrieve></tns:retrieveListMembers></env:Body></env:Envelope>
11
11
  headers:
12
12
  Cookie:
13
- - JSESSIONID=EF4D2D3574EA896D10416D6FF9DE184E.ws01-ri5
13
+ - JSESSIONID=77DC067BAF16CCB4C50C44F50A95AE96.ws02-ri5
14
14
  Soapaction:
15
15
  - ! '"retrieveListMembers"'
16
16
  Content-Type:
17
17
  - text/xml;charset=UTF-8
18
18
  Content-Length:
19
- - '679'
19
+ - '673'
20
20
  Accept:
21
21
  - ! '*/*'
22
22
  User-Agent:
@@ -33,16 +33,16 @@ http_interactions:
33
33
  Content-Type:
34
34
  - text/xml;charset=UTF-8
35
35
  Date:
36
- - Fri, 29 Aug 2014 22:31:04 GMT
36
+ - Thu, 06 Nov 2014 07:37:17 GMT
37
37
  Server:
38
38
  - Apache
39
39
  Set-Cookie:
40
- - BIGipServerDC2-APIGEE-I5-9051-SSL=3617446922.23331.0000; path=/
40
+ - BIGipServerDC2-APIGEE-I5-9051-SSL=3600669706.23331.0000; path=/
41
41
  body:
42
42
  encoding: US-ASCII
43
43
  string: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>ListFault</faultstring><detail><ListFault
44
44
  xmlns="urn:fault.ws.rsys.com"><exceptionCode>RECORD_NOT_FOUND</exceptionCode><exceptionMessage>No
45
45
  records found in the list for given ids</exceptionMessage></ListFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
46
46
  http_version:
47
- recorded_at: Fri, 29 Aug 2014 22:31:04 GMT
48
- recorded_with: VCR 2.5.0
47
+ recorded_at: Thu, 06 Nov 2014 07:37:19 GMT
48
+ recorded_with: VCR 2.9.3
@@ -2,21 +2,21 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://wsxxxx.responsys.net/webservices/services/ResponsysWSService
5
+ uri: https://ws5.responsys.net/webservices/services/ResponsysWSService
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
9
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:ws.rsys.com"
10
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>bBvxPCXScxL40VhQx6JFG6ziO9</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveProfileExtensionRecords><tns:profileExtension><tns:folderName>demo_folder2</tns:folderName><tns:objectName>customers_extension</tns:objectName></tns:profileExtension><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>RIID_</tns:fieldList><tns:idsToRetrieve>1125</tns:idsToRetrieve></tns:retrieveProfileExtensionRecords></env:Body></env:Envelope>
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>W1Qlwgd2Ysd7WOrfV45ddioFyh</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveProfileExtensionRecords><tns:profileExtension><tns:folderName>rspec_tests</tns:folderName><tns:objectName>rspec_pet1</tns:objectName></tns:profileExtension><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>RIID_</tns:fieldList><tns:idsToRetrieve>48614925</tns:idsToRetrieve></tns:retrieveProfileExtensionRecords></env:Body></env:Envelope>
11
11
  headers:
12
12
  Cookie:
13
- - JSESSIONID=EF4D2D3574EA896D10416D6FF9DE184E.ws01-ri5
13
+ - JSESSIONID=77DC067BAF16CCB4C50C44F50A95AE96.ws02-ri5
14
14
  Soapaction:
15
15
  - ! '"retrieveProfileExtensionRecords"'
16
16
  Content-Type:
17
17
  - text/xml;charset=UTF-8
18
18
  Content-Length:
19
- - '709'
19
+ - '703'
20
20
  Accept:
21
21
  - ! '*/*'
22
22
  User-Agent:
@@ -27,38 +27,38 @@ http_interactions:
27
27
  message: OK
28
28
  headers:
29
29
  Content-Length:
30
- - '391'
30
+ - '395'
31
31
  Content-Type:
32
32
  - text/xml; charset=UTF-8
33
33
  Date:
34
- - Fri, 29 Aug 2014 22:31:04 GMT
34
+ - Thu, 06 Nov 2014 07:37:18 GMT
35
35
  Server:
36
36
  - Apache
37
37
  Set-Cookie:
38
- - BIGipServerDC2-APIGEE-I5-9051-SSL=3617446922.23331.0000; path=/
38
+ - BIGipServerDC2-APIGEE-I5-9051-SSL=3600669706.23331.0000; path=/
39
39
  body:
40
40
  encoding: US-ASCII
41
41
  string: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><retrieveProfileExtensionRecordsResponse
42
- xmlns="urn:ws.rsys.com"><result><recordData><fieldNames>RIID_</fieldNames><records><fieldValues>1125</fieldValues></records></recordData></result></retrieveProfileExtensionRecordsResponse></soapenv:Body></soapenv:Envelope>
42
+ xmlns="urn:ws.rsys.com"><result><recordData><fieldNames>RIID_</fieldNames><records><fieldValues>48614925</fieldValues></records></recordData></result></retrieveProfileExtensionRecordsResponse></soapenv:Body></soapenv:Envelope>
43
43
  http_version:
44
- recorded_at: Fri, 29 Aug 2014 22:31:04 GMT
44
+ recorded_at: Thu, 06 Nov 2014 07:37:20 GMT
45
45
  - request:
46
46
  method: post
47
- uri: https://wsxxxx.responsys.net/webservices/services/ResponsysWSService
47
+ uri: https://ws5.responsys.net/webservices/services/ResponsysWSService
48
48
  body:
49
49
  encoding: US-ASCII
50
50
  string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
51
51
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:ws.rsys.com"
52
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>bBvxPCXScxL40VhQx6JFG6ziO9</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveProfileExtensionRecords><tns:profileExtension><tns:folderName>demo_folder2</tns:folderName><tns:objectName>customers_extension</tns:objectName></tns:profileExtension><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>RIID_</tns:fieldList><tns:fieldList>EMAIL_ADDRESS</tns:fieldList><tns:idsToRetrieve>1125</tns:idsToRetrieve></tns:retrieveProfileExtensionRecords></env:Body></env:Envelope>
52
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><sessionHeader><sessionId>W1Qlwgd2Ysd7WOrfV45ddioFyh</sessionId></sessionHeader></env:Header><env:Body><tns:retrieveProfileExtensionRecords><tns:profileExtension><tns:folderName>rspec_tests</tns:folderName><tns:objectName>rspec_pet1</tns:objectName></tns:profileExtension><tns:queryColumn>RIID</tns:queryColumn><tns:fieldList>RIID_</tns:fieldList><tns:fieldList>MONTHLY_PURCH</tns:fieldList><tns:idsToRetrieve>48614925</tns:idsToRetrieve></tns:retrieveProfileExtensionRecords></env:Body></env:Envelope>
53
53
  headers:
54
54
  Cookie:
55
- - JSESSIONID=EF4D2D3574EA896D10416D6FF9DE184E.ws01-ri5
55
+ - JSESSIONID=77DC067BAF16CCB4C50C44F50A95AE96.ws02-ri5
56
56
  Soapaction:
57
57
  - ! '"retrieveProfileExtensionRecords"'
58
58
  Content-Type:
59
59
  - text/xml;charset=UTF-8
60
60
  Content-Length:
61
- - '753'
61
+ - '747'
62
62
  Accept:
63
63
  - ! '*/*'
64
64
  User-Agent:
@@ -69,19 +69,19 @@ http_interactions:
69
69
  message: OK
70
70
  headers:
71
71
  Content-Length:
72
- - '471'
72
+ - '463'
73
73
  Content-Type:
74
74
  - text/xml; charset=UTF-8
75
75
  Date:
76
- - Fri, 29 Aug 2014 22:31:04 GMT
76
+ - Thu, 06 Nov 2014 07:37:18 GMT
77
77
  Server:
78
78
  - Apache
79
79
  Set-Cookie:
80
- - BIGipServerDC2-APIGEE-I5-9051-SSL=3617446922.23331.0000; path=/
80
+ - BIGipServerDC2-APIGEE-I5-9051-SSL=3600669706.23331.0000; path=/
81
81
  body:
82
82
  encoding: US-ASCII
83
83
  string: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><retrieveProfileExtensionRecordsResponse
84
- xmlns="urn:ws.rsys.com"><result><recordData><fieldNames>RIID_</fieldNames><fieldNames>EMAIL_ADDRESS</fieldNames><records><fieldValues>1125</fieldValues><fieldValues>user@email.com</fieldValues></records></recordData></result></retrieveProfileExtensionRecordsResponse></soapenv:Body></soapenv:Envelope>
84
+ xmlns="urn:ws.rsys.com"><result><recordData><fieldNames>RIID_</fieldNames><fieldNames>MONTHLY_PURCH</fieldNames><records><fieldValues>48614925</fieldValues><fieldValues>300</fieldValues></records></recordData></result></retrieveProfileExtensionRecordsResponse></soapenv:Body></soapenv:Envelope>
85
85
  http_version:
86
- recorded_at: Fri, 29 Aug 2014 22:31:04 GMT
87
- recorded_with: VCR 2.5.0
86
+ recorded_at: Thu, 06 Nov 2014 07:37:20 GMT
87
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+
3
+ require "spec_helper.rb"
4
+
5
+ describe Responsys::Helper do
6
+
7
+ context "Get i18n messages" do
8
+ let(:message_key) { "member.record_not_found" }
9
+ before(:each) {
10
+ I18n.locale = :en
11
+ }
12
+
13
+ it "should get a message present in the en yml file" do
14
+ expect(Responsys::Helper.get_message(message_key))
15
+ .to eq("The member has not been found in the list")
16
+ end
17
+
18
+ it "should get the default locale message if locale is not present" do
19
+ I18n.locale = :not_available_locale
20
+ expect(Responsys::Helper.get_message(message_key))
21
+ .to eq("The member has not been found in the list")
22
+ end
23
+
24
+ it "should get the message according to the active locale" do
25
+ I18n.locale = :fr
26
+ expect(Responsys::Helper.get_message(message_key))
27
+ .to eq("L'enregistrement n'a pas été trouvé dans la liste")
28
+ end
29
+
30
+ end
31
+ end
@@ -4,7 +4,9 @@ require "responsys/api/client"
4
4
  describe Responsys::Member do
5
5
 
6
6
  before(:all) do
7
- @email = "user@email.com"
7
+ @email = DATA[:users][:user1][:EMAIL_ADDRESS]
8
+ @riid = DATA[:users][:user1][:RIID]
9
+ @list = Responsys::Api::Object::InteractObject.new(DATA[:folder],DATA[:lists][:list1][:name])
8
10
  end
9
11
 
10
12
  context "New member" do
@@ -16,13 +18,10 @@ describe Responsys::Member do
16
18
 
17
19
  context "Subscribing" do
18
20
 
21
+ let(:connection) { double "connection" }
19
22
  before(:each) do
20
- @connection = double "connection"
21
-
22
- allow(Responsys::Api::Client).to receive(:instance).and_return(@connection)
23
-
23
+ allow(Responsys::Api::Client).to receive(:instance).and_return(connection)
24
24
  @member = Responsys::Member.new(@email)
25
- @list = Responsys::Api::Object::InteractObject.new("list_folder","list_object_name")
26
25
  @query_column = Responsys::Api::Object::QueryColumn.new("EMAIL_ADDRESS")
27
26
  end
28
27
 
@@ -35,7 +34,7 @@ describe Responsys::Member do
35
34
  it "should check the user has subscribed" do
36
35
  response_expected = { status: "ok", data: [{ EMAIL_PERMISSION_STATUS_: "I" }] }
37
36
 
38
- allow(@connection).to receive(:retrieve_list_members).with(@list, kind_of(Responsys::Api::Object::QueryColumn), %w(EMAIL_PERMISSION_STATUS_), %W(#{@member.email})).and_return(response_expected)
37
+ allow(connection).to receive(:retrieve_list_members).with(@list, kind_of(Responsys::Api::Object::QueryColumn), %w(EMAIL_PERMISSION_STATUS_), %W(#{@member.email})).and_return(response_expected)
39
38
 
40
39
  expect(@member.subscribed?(@list)).to eq(true)
41
40
  end
@@ -44,11 +43,6 @@ describe Responsys::Member do
44
43
 
45
44
  context "Existing member" do
46
45
 
47
- before(:all) do
48
- @list = Responsys::Api::Object::InteractObject.new("another_test_folder","test_list")
49
- @riid = 1225
50
- end
51
-
52
46
  it "should be ok, the email is present" do
53
47
  VCR.use_cassette("member/present1") do
54
48
  member_without_riid = Responsys::Member.new(@email)
@@ -98,14 +92,11 @@ describe Responsys::Member do
98
92
 
99
93
  context "Get profile extension data" do
100
94
 
101
- before(:each) do
102
- VCR.use_cassette("member/login") do
103
- @profile_extension = Responsys::Api::Object::InteractObject.new("demo_folder2", "customers_extension")
104
- @riid = 1125
105
- @member_without_riid = Responsys::Member.new(@email)
106
- @member_with_riid = Responsys::Member.new(@email, @riid)
107
- @fields = %w(RIID_ EMAIL_ADDRESS)
108
- end
95
+ before(:all) do
96
+ @profile_extension = Responsys::Api::Object::InteractObject.new(DATA[:folder], DATA[:pets][:pet1][:name])
97
+ @member_without_riid = Responsys::Member.new(@email)
98
+ @member_with_riid = Responsys::Member.new(@email, @riid)
99
+ @fields = %w(RIID_ MONTHLY_PURCH)
109
100
  end
110
101
 
111
102
  it "should set the status to failure if no riid provided" do
@@ -120,7 +111,7 @@ describe Responsys::Member do
120
111
  VCR.use_cassette("member/retrieve_profile_extension_fail") do
121
112
  response = @member_without_riid.retrieve_profile_extension(@profile_extension, @fields)
122
113
 
123
- expect(response[:error][:message]).to eq(I18n.t("member.riid_missing"))
114
+ expect(response[:error][:message]).to eq(Responsys::Helper.get_message("member.riid_missing"))
124
115
  end
125
116
  end
126
117
 
@@ -3,28 +3,45 @@ Bundler.setup
3
3
 
4
4
  require "responsys_api.rb"
5
5
  require "vcr"
6
+ require "yaml"
7
+
8
+ if File.exist?("#{File.dirname(__FILE__)}/api_credentials.yml")
9
+ CREDENTIALS = YAML.load_file("#{File.dirname(__FILE__)}/api_credentials.yml")
10
+ else
11
+ CREDENTIALS = YAML.load_file("#{File.dirname(__FILE__)}/api_credentials.sample.yml")
12
+ end
13
+
14
+ DATA = YAML.load_file("#{File.dirname(__FILE__)}/test_data.yml")
15
+ IGNORE_LOGIN_REQUEST = true
16
+ IGNORE_LOGOUT_REQUEST = true
6
17
 
7
18
  VCR.configure do |c|
8
19
  c.cassette_library_dir = "spec/fixtures/vcr_cassettes"
9
20
  c.hook_into :webmock
21
+ c.ignore_request do |request|
22
+ if request.to_hash["body"]["string"].empty?
23
+ true
24
+ else
25
+ ignoring = false
26
+
27
+ if IGNORE_LOGIN_REQUEST
28
+ ignoring |= !Nokogiri::XML(request.to_hash["body"]["string"]).remove_namespaces!.xpath('/Envelope/Body/login', ).empty?
29
+ end
30
+
31
+ if IGNORE_LOGOUT_REQUEST
32
+ ignoring |= !Nokogiri::XML(request.to_hash["body"]["string"]).remove_namespaces!.xpath('/Envelope/Body/logout', ).empty?
33
+ end
34
+
35
+ ignoring
36
+ end
37
+ end
10
38
  end
11
39
 
12
40
  Responsys.configure do |config|
13
41
  config.settings = {
14
- username: "your_responsys_username",
15
- password: "your_responsys_password",
16
- wsdl: "https://wsxxxx.responsys.net/webservices/wsdl/ResponsysWS_Level1.wsdl",
42
+ username: CREDENTIALS["username"],
43
+ password: CREDENTIALS["password"],
44
+ wsdl: CREDENTIALS["wsdl"],
17
45
  debug: false
18
46
  }
19
- end
20
-
21
- # Responsys.configure do |config|
22
- # config.settings = {
23
- # username: "your_responsys_username",
24
- # password: "your_responsys_password",
25
- # wsdl: "https://wsxxxx.responsys.net/webservices/wsdl/ResponsysWS_Level1.wsdl",
26
- # debug: false
27
- # }
28
- # end
29
-
30
- I18n.enforce_available_locales = false
47
+ end