fuelsdk 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +4 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/fuelsdk.gemspec +3 -1
- data/lib/fuelsdk/client.rb +8 -7
- data/lib/fuelsdk/soap.rb +20 -15
- data/lib/fuelsdk/version.rb +1 -1
- data/samples/sample_helper.rb +2 -2
- data/spec/client_spec.rb +2 -2
- data/spec/fixtures/webmock/client/endpoint.txt +17 -0
- data/spec/fixtures/webmock/client/tokens.txt +19 -0
- data/spec/fixtures/webmock/client/wsdl.txt +4355 -0
- data/spec/fixtures/webmock/subscriber/created.xml +42 -0
- data/spec/fixtures/webmock/subscriber/deleted.xml +26 -0
- data/spec/fixtures/webmock/subscriber/description.xml +475 -0
- data/spec/fixtures/webmock/subscriber/subscriber.xml +66 -0
- data/spec/fixtures/webmock/subscriber/subscribers.xml +98 -0
- data/spec/fixtures/webmock/subscriber/subscribers_with_all_properties.xml +111 -0
- data/spec/fixtures/webmock/subscriber/updated.xml +40 -0
- data/spec/soap/cud_spec.rb +32 -31
- data/spec/soap/get_spec.rb +12 -9
- data/spec/soap/perform_spec.rb +10 -10
- data/spec/soap/soap_spec.rb +26 -18
- data/spec/spec_helper.rb +16 -0
- data/spec/subscriber_spec.rb +322 -0
- metadata +60 -29
@@ -0,0 +1,66 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>
|
3
|
+
<soap:Header>
|
4
|
+
<wsa:Action>RetrieveResponse</wsa:Action>
|
5
|
+
<wsa:MessageID>urn:uuid:a37b6a75-e52e-45d0-a6be-faaf036aa85c</wsa:MessageID>
|
6
|
+
<wsa:RelatesTo>urn:uuid:bdbcaa62-51ea-4c5c-8afa-f0adec46db6c</wsa:RelatesTo>
|
7
|
+
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
8
|
+
<wsse:Security>
|
9
|
+
<wsu:Timestamp wsu:Id='Timestamp-f6dd959a-56fe-4435-b32e-1f59ec0f39a8'>
|
10
|
+
<wsu:Created>2014-03-13T16:03:28Z</wsu:Created>
|
11
|
+
<wsu:Expires>2014-03-13T16:08:28Z</wsu:Expires>
|
12
|
+
</wsu:Timestamp>
|
13
|
+
</wsse:Security>
|
14
|
+
</soap:Header>
|
15
|
+
<soap:Body>
|
16
|
+
<RetrieveResponseMsg xmlns='http://exacttarget.com/wsdl/partnerAPI'>
|
17
|
+
<OverallStatus>OK</OverallStatus>
|
18
|
+
<RequestID>d4358fcd-24f4-415c-895e-08cfe10623e6</RequestID>
|
19
|
+
<Results xsi:type='Subscriber'>
|
20
|
+
<Client>
|
21
|
+
<ID>6173122</ID>
|
22
|
+
</Client>
|
23
|
+
<PartnerKey/>
|
24
|
+
<CreatedDate>2013-10-08T09:38:00</CreatedDate>
|
25
|
+
<ID>16234076</ID>
|
26
|
+
<ObjectID xsi:nil='true'/>
|
27
|
+
<EmailAddress>first_sub@kevy.com</EmailAddress>
|
28
|
+
<Attributes>
|
29
|
+
<Name>Available Weekends</Name>
|
30
|
+
<Value>False</Value>
|
31
|
+
</Attributes>
|
32
|
+
<Attributes>
|
33
|
+
<Name>First Name</Name>
|
34
|
+
<Value>First</Value>
|
35
|
+
</Attributes>
|
36
|
+
<Attributes>
|
37
|
+
<Name>Last Name</Name>
|
38
|
+
<Value>Last</Value>
|
39
|
+
</Attributes>
|
40
|
+
<Attributes>
|
41
|
+
<Name>Company</Name>
|
42
|
+
<Value/>
|
43
|
+
</Attributes>
|
44
|
+
<Attributes>
|
45
|
+
<Name>Phone Number</Name>
|
46
|
+
<Value/>
|
47
|
+
</Attributes>
|
48
|
+
<Attributes>
|
49
|
+
<Name>Email Address</Name>
|
50
|
+
<Value>first_sub@kevy.com</Value>
|
51
|
+
</Attributes>
|
52
|
+
<Attributes>
|
53
|
+
<Name>Gender</Name>
|
54
|
+
<Value/>
|
55
|
+
</Attributes>
|
56
|
+
<Attributes>
|
57
|
+
<Name>Birthday</Name>
|
58
|
+
<Value/>
|
59
|
+
</Attributes>
|
60
|
+
<SubscriberKey>first_sub@kevy.com</SubscriberKey>
|
61
|
+
<Status>Active</Status>
|
62
|
+
<EmailTypePreference>HTML</EmailTypePreference>
|
63
|
+
</Results>
|
64
|
+
</RetrieveResponseMsg>
|
65
|
+
</soap:Body>
|
66
|
+
</soap:Envelope>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>
|
3
|
+
<soap:Header>
|
4
|
+
<wsa:Action>RetrieveResponse</wsa:Action>
|
5
|
+
<wsa:MessageID>urn:uuid:9c5a00ad-d1e1-44d9-9591-c1008f409ce7
|
6
|
+
</wsa:MessageID>
|
7
|
+
<wsa:RelatesTo>urn:uuid:fee312d2-dd08-4aee-a577-0737486295ef</wsa:RelatesTo>
|
8
|
+
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
9
|
+
<wsse:Security>
|
10
|
+
<wsu:Timestamp wsu:Id='Timestamp-edbd1784-0e29-4b43-af49-f988d660ce1e'>
|
11
|
+
<wsu:Created>2014-03-13T15:46:50Z</wsu:Created>
|
12
|
+
<wsu:Expires>2014-03-13T15:51:50Z</wsu:Expires>
|
13
|
+
</wsu:Timestamp>
|
14
|
+
</wsse:Security>
|
15
|
+
</soap:Header>
|
16
|
+
<soap:Body>
|
17
|
+
<RetrieveResponseMsg xmlns='http://exacttarget.com/wsdl/partnerAPI'>
|
18
|
+
<OverallStatus>OK</OverallStatus>
|
19
|
+
<RequestID>effdbf48-773c-46ea-8a4b-fab50ce3dd6a</RequestID>
|
20
|
+
<Results xsi:type='Subscriber'>
|
21
|
+
<PartnerKey xsi:nil='true'/>
|
22
|
+
<ID>16234076</ID>
|
23
|
+
<ObjectID xsi:nil='true'/>
|
24
|
+
<EmailAddress>first_sub@kevy.com</EmailAddress>
|
25
|
+
<Attributes>
|
26
|
+
<Name>Available Weekends</Name>
|
27
|
+
<Value>False</Value>
|
28
|
+
</Attributes>
|
29
|
+
<Attributes>
|
30
|
+
<Name>First Name</Name>
|
31
|
+
<Value>First</Value>
|
32
|
+
</Attributes>
|
33
|
+
<Attributes>
|
34
|
+
<Name>Last Name</Name>
|
35
|
+
<Value>Last</Value>
|
36
|
+
</Attributes>
|
37
|
+
<Attributes>
|
38
|
+
<Name>Company</Name>
|
39
|
+
<Value/>
|
40
|
+
</Attributes>
|
41
|
+
<Attributes>
|
42
|
+
<Name>Phone Number</Name>
|
43
|
+
<Value/>
|
44
|
+
</Attributes>
|
45
|
+
<Attributes>
|
46
|
+
<Name>Email Address</Name>
|
47
|
+
<Value>first_sub@kevy.com</Value>
|
48
|
+
</Attributes>
|
49
|
+
<Attributes>
|
50
|
+
<Name>Gender</Name>
|
51
|
+
<Value/>
|
52
|
+
</Attributes>
|
53
|
+
<Attributes>
|
54
|
+
<Name>Birthday</Name>
|
55
|
+
<Value/>
|
56
|
+
</Attributes>
|
57
|
+
</Results>
|
58
|
+
<Results xsi:type='Subscriber'>
|
59
|
+
<PartnerKey xsi:nil='true'/>
|
60
|
+
<ID>16234077</ID>
|
61
|
+
<ObjectID xsi:nil='true'/>
|
62
|
+
<EmailAddress>second_sub@kevy.com</EmailAddress>
|
63
|
+
<Attributes>
|
64
|
+
<Name>Available Weekends</Name>
|
65
|
+
<Value>True</Value>
|
66
|
+
</Attributes>
|
67
|
+
<Attributes>
|
68
|
+
<Name>First Name</Name>
|
69
|
+
<Value>FName</Value>
|
70
|
+
</Attributes>
|
71
|
+
<Attributes>
|
72
|
+
<Name>Last Name</Name>
|
73
|
+
<Value>LName</Value>
|
74
|
+
</Attributes>
|
75
|
+
<Attributes>
|
76
|
+
<Name>Company</Name>
|
77
|
+
<Value/>
|
78
|
+
</Attributes>
|
79
|
+
<Attributes>
|
80
|
+
<Name>Phone Number</Name>
|
81
|
+
<Value/>
|
82
|
+
</Attributes>
|
83
|
+
<Attributes>
|
84
|
+
<Name>Email Address</Name>
|
85
|
+
<Value>first_sub@kevy.com</Value>
|
86
|
+
</Attributes>
|
87
|
+
<Attributes>
|
88
|
+
<Name>Gender</Name>
|
89
|
+
<Value>M</Value>
|
90
|
+
</Attributes>
|
91
|
+
<Attributes>
|
92
|
+
<Name>Birthday</Name>
|
93
|
+
<Value/>
|
94
|
+
</Attributes>
|
95
|
+
</Results>
|
96
|
+
</RetrieveResponseMsg>
|
97
|
+
</soap:Body>
|
98
|
+
</soap:Envelope>
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>
|
3
|
+
<soap:Header>
|
4
|
+
<wsa:Action>RetrieveResponse</wsa:Action>
|
5
|
+
<wsa:MessageID>urn:uuid:a37b6a75-e52e-45d0-a6be-faaf036aa85c</wsa:MessageID>
|
6
|
+
<wsa:RelatesTo>urn:uuid:bdbcaa62-51ea-4c5c-8afa-f0adec46db6c</wsa:RelatesTo>
|
7
|
+
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
8
|
+
<wsse:Security>
|
9
|
+
<wsu:Timestamp wsu:Id='Timestamp-f6dd959a-56fe-4435-b32e-1f59ec0f39a8'>
|
10
|
+
<wsu:Created>2014-03-13T16:03:28Z</wsu:Created>
|
11
|
+
<wsu:Expires>2014-03-13T16:08:28Z</wsu:Expires>
|
12
|
+
</wsu:Timestamp>
|
13
|
+
</wsse:Security>
|
14
|
+
</soap:Header>
|
15
|
+
<soap:Body>
|
16
|
+
<RetrieveResponseMsg xmlns='http://exacttarget.com/wsdl/partnerAPI'>
|
17
|
+
<OverallStatus>OK</OverallStatus>
|
18
|
+
<RequestID>d4358fcd-24f4-415c-895e-08cfe10623e6</RequestID>
|
19
|
+
<Results xsi:type='Subscriber'>
|
20
|
+
<Client>
|
21
|
+
<ID>6173122</ID>
|
22
|
+
</Client>
|
23
|
+
<PartnerKey/>
|
24
|
+
<CreatedDate>2013-10-08T09:38:00</CreatedDate>
|
25
|
+
<ID>16234076</ID>
|
26
|
+
<ObjectID xsi:nil='true'/>
|
27
|
+
<EmailAddress>first_sub@kevy.com</EmailAddress>
|
28
|
+
<Attributes>
|
29
|
+
<Name>Available Weekends</Name>
|
30
|
+
<Value>False</Value>
|
31
|
+
</Attributes>
|
32
|
+
<Attributes>
|
33
|
+
<Name>First Name</Name>
|
34
|
+
<Value>First</Value>
|
35
|
+
</Attributes>
|
36
|
+
<Attributes>
|
37
|
+
<Name>Last Name</Name>
|
38
|
+
<Value>Last</Value>
|
39
|
+
</Attributes>
|
40
|
+
<Attributes>
|
41
|
+
<Name>Company</Name>
|
42
|
+
<Value/>
|
43
|
+
</Attributes>
|
44
|
+
<Attributes>
|
45
|
+
<Name>Phone Number</Name>
|
46
|
+
<Value/>
|
47
|
+
</Attributes>
|
48
|
+
<Attributes>
|
49
|
+
<Name>Email Address</Name>
|
50
|
+
<Value>first_sub@kevy.com</Value>
|
51
|
+
</Attributes>
|
52
|
+
<Attributes>
|
53
|
+
<Name>Gender</Name>
|
54
|
+
<Value/>
|
55
|
+
</Attributes>
|
56
|
+
<Attributes>
|
57
|
+
<Name>Birthday</Name>
|
58
|
+
<Value/>
|
59
|
+
</Attributes>
|
60
|
+
<SubscriberKey>first_sub@kevy.com</SubscriberKey>
|
61
|
+
<Status>Active</Status>
|
62
|
+
<EmailTypePreference>HTML</EmailTypePreference>
|
63
|
+
</Results>
|
64
|
+
<Results xsi:type='Subscriber'>
|
65
|
+
<Client>
|
66
|
+
<ID>6173122</ID>
|
67
|
+
</Client>
|
68
|
+
<PartnerKey/>
|
69
|
+
<CreatedDate>2013-10-08T09:38:00</CreatedDate>
|
70
|
+
<ID>16234077</ID>
|
71
|
+
<ObjectID xsi:nil='true'/>
|
72
|
+
<EmailAddress>second_sub@kevy.com</EmailAddress>
|
73
|
+
<Attributes>
|
74
|
+
<Name>Available Weekends</Name>
|
75
|
+
<Value>True</Value>
|
76
|
+
</Attributes>
|
77
|
+
<Attributes>
|
78
|
+
<Name>First Name</Name>
|
79
|
+
<Value>FName</Value>
|
80
|
+
</Attributes>
|
81
|
+
<Attributes>
|
82
|
+
<Name>Last Name</Name>
|
83
|
+
<Value>LName</Value>
|
84
|
+
</Attributes>
|
85
|
+
<Attributes>
|
86
|
+
<Name>Company</Name>
|
87
|
+
<Value/>
|
88
|
+
</Attributes>
|
89
|
+
<Attributes>
|
90
|
+
<Name>Phone Number</Name>
|
91
|
+
<Value/>
|
92
|
+
</Attributes>
|
93
|
+
<Attributes>
|
94
|
+
<Name>Email Address</Name>
|
95
|
+
<Value>second_sub@kevy.com</Value>
|
96
|
+
</Attributes>
|
97
|
+
<Attributes>
|
98
|
+
<Name>Gender</Name>
|
99
|
+
<Value>M</Value>
|
100
|
+
</Attributes>
|
101
|
+
<Attributes>
|
102
|
+
<Name>Birthday</Name>
|
103
|
+
<Value/>
|
104
|
+
</Attributes>
|
105
|
+
<SubscriberKey>first_sub@kevy.com</SubscriberKey>
|
106
|
+
<Status>Unsubscribed</Status>
|
107
|
+
<EmailTypePreference>Text</EmailTypePreference>
|
108
|
+
</Results>
|
109
|
+
</RetrieveResponseMsg>
|
110
|
+
</soap:Body>
|
111
|
+
</soap:Envelope>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>
|
3
|
+
<soap:Header>
|
4
|
+
<wsa:Action>UpdateResponse</wsa:Action>
|
5
|
+
<wsa:MessageID>urn:uuid:f9c8b39a-c715-4f51-98dc-d662f0945c1f</wsa:MessageID>
|
6
|
+
<wsa:RelatesTo>urn:uuid:bf235005-a69a-4ec0-8ab8-ea12c7243695</wsa:RelatesTo>
|
7
|
+
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
8
|
+
<wsse:Security>
|
9
|
+
<wsu:Timestamp wsu:Id='Timestamp-35d62156-b6a0-4635-91af-62b84c6eceb7'>
|
10
|
+
<wsu:Created>2014-03-14T00:18:30Z</wsu:Created>
|
11
|
+
<wsu:Expires>2014-03-14T00:23:30Z</wsu:Expires>
|
12
|
+
</wsu:Timestamp>
|
13
|
+
</wsse:Security>
|
14
|
+
</soap:Header>
|
15
|
+
<soap:Body>
|
16
|
+
<UpdateResponse xmlns='http://exacttarget.com/wsdl/partnerAPI'>
|
17
|
+
<Results>
|
18
|
+
<StatusCode>OK</StatusCode>
|
19
|
+
<StatusMessage>Updated Subscriber.</StatusMessage>
|
20
|
+
<OrdinalID>0</OrdinalID>
|
21
|
+
<Object xsi:type='Subscriber'>
|
22
|
+
<PartnerKey xsi:nil='true'/>
|
23
|
+
<ID>16234076</ID>
|
24
|
+
<ObjectID xsi:nil='true'/>
|
25
|
+
<EmailAddress>1394756310RubySDKExample@jb.kevy.com</EmailAddress>
|
26
|
+
<Attributes>
|
27
|
+
<Name>Gender</Name>
|
28
|
+
<Value>M</Value>
|
29
|
+
</Attributes>
|
30
|
+
<Attributes>
|
31
|
+
<Name>Available Weekends</Name>
|
32
|
+
<Value>true</Value>
|
33
|
+
</Attributes>
|
34
|
+
</Object>
|
35
|
+
</Results>
|
36
|
+
<RequestID>98712a7f-6a6a-48a1-8393-545a6bbbe711</RequestID>
|
37
|
+
<OverallStatus>OK</OverallStatus>
|
38
|
+
</UpdateResponse>
|
39
|
+
</soap:Body>
|
40
|
+
</soap:Envelope>
|
data/spec/soap/cud_spec.rb
CHANGED
@@ -4,56 +4,54 @@ describe FuelSDK::Soap do
|
|
4
4
|
|
5
5
|
let(:client) { FuelSDK::Client.new }
|
6
6
|
|
7
|
-
subject { client }
|
8
|
-
|
9
7
|
describe '#editable_properties_cached?' do
|
10
8
|
it 'returns a list of editable properties for the object' do
|
11
|
-
|
9
|
+
client.should_receive(:cached_properties?)
|
12
10
|
.with(:editable, 'item')
|
13
11
|
.and_return(['prop'])
|
14
12
|
|
15
|
-
expect(
|
13
|
+
expect(client.editable_properties_cached? 'item').to eq(['prop'])
|
16
14
|
end
|
17
15
|
|
18
16
|
it 'returns nil if not cached' do
|
19
|
-
expect(
|
17
|
+
expect(client.editable_properties_cached? 'missing').to be_nil
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
23
21
|
describe '#get_editable_properties' do
|
24
22
|
it 'returns cached properties' do
|
25
|
-
|
23
|
+
client.should_receive(:editable_properties_cached?)
|
26
24
|
.with('object')
|
27
25
|
.and_return(['prop'])
|
28
26
|
|
29
|
-
|
30
|
-
|
27
|
+
client.should_not_receive(:get_all_object_properties)
|
28
|
+
client.should_not_receive(:cache_editable)
|
31
29
|
|
32
|
-
expect(
|
30
|
+
expect(client.get_editable_properties('object')).to eq ['prop']
|
33
31
|
end
|
34
32
|
|
35
33
|
it 'requests and caches properties when not in cache' do
|
36
|
-
|
34
|
+
client.should_receive(:editable_properties_cached?)
|
37
35
|
.with('object')
|
38
36
|
.and_return(nil)
|
39
37
|
|
40
38
|
response = double(FuelSDK::DescribeResponse)
|
41
39
|
response.stub(:editable).and_return(['prop'])
|
42
|
-
|
40
|
+
client.should_receive(:get_all_object_properties)
|
43
41
|
.and_return(response)
|
44
42
|
|
45
|
-
|
43
|
+
client.should_receive(:cache_editable)
|
46
44
|
.with('object', ['prop'])
|
47
45
|
.and_return(['prop'])
|
48
46
|
|
49
|
-
expect(
|
47
|
+
expect(client.get_editable_properties('object')).to eq ['prop']
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
53
51
|
describe '#cache_editable' do
|
54
52
|
it 'caches object properties to :editable' do
|
55
|
-
|
56
|
-
expect(
|
53
|
+
client.cache_editable('Subscriber', ['Email'])
|
54
|
+
expect(client.cache[:editable]).to eq 'Subscriber' => ['Email']
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
@@ -62,11 +60,11 @@ describe FuelSDK::Soap do
|
|
62
60
|
it 'creates soap objects properties hash putting ' \
|
63
61
|
'custom attributes into name value pairs' do
|
64
62
|
|
65
|
-
|
63
|
+
client.should_receive(:get_editable_properties)
|
66
64
|
.with('Subscriber')
|
67
65
|
.and_return(['FirstName'])
|
68
66
|
|
69
|
-
expect(
|
67
|
+
expect(client.normalize_properties_for_cud(
|
70
68
|
'Subscriber',
|
71
69
|
[{'Email' => 'dev@exacttarget.com', 'FirstName' => 'Devy'}]
|
72
70
|
)).to eq(
|
@@ -78,11 +76,11 @@ describe FuelSDK::Soap do
|
|
78
76
|
end
|
79
77
|
|
80
78
|
it 'converts properties into an array' do
|
81
|
-
|
79
|
+
client.should_receive(:get_editable_properties)
|
82
80
|
.with('Subscriber')
|
83
81
|
.and_return(['FirstName'])
|
84
82
|
|
85
|
-
expect(
|
83
|
+
expect(client.normalize_properties_for_cud(
|
86
84
|
'Subscriber',
|
87
85
|
{'Email' => 'dev@exacttarget.com', 'FirstName' => 'Devy'}
|
88
86
|
)).to eq(
|
@@ -94,7 +92,7 @@ describe FuelSDK::Soap do
|
|
94
92
|
end
|
95
93
|
|
96
94
|
it 'raises an exception if properties are not a hash' do
|
97
|
-
expect {
|
95
|
+
expect { client.normalize_properties_for_cud('Subscriber', 'Email') }
|
98
96
|
.to raise_error
|
99
97
|
end
|
100
98
|
end
|
@@ -102,31 +100,34 @@ describe FuelSDK::Soap do
|
|
102
100
|
describe '#create_objects_message' do
|
103
101
|
it 'creates hash for soap message' do
|
104
102
|
obj_attributes = [{'Name' => 'First Name', 'Value' => 'Justin'}]
|
105
|
-
expect(
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
103
|
+
expect(client.create_objects_message('object', obj_attributes)).to eq(
|
104
|
+
{
|
105
|
+
'Objects' => [{
|
106
|
+
'Name' => 'First Name',
|
107
|
+
'Value' => 'Justin',
|
108
|
+
'@xsi:type' => 'tns:object'
|
109
|
+
}]
|
110
|
+
}
|
110
111
|
)
|
111
112
|
end
|
112
113
|
|
113
114
|
it 'raises an exception if object attributes is not an Array' do
|
114
|
-
expect{
|
115
|
+
expect{ client.create_objects_message('object', '1') }.to raise_error
|
115
116
|
end
|
116
117
|
|
117
118
|
it 'raises an exception if object attributes are not stored in a hash' do
|
118
|
-
expect{
|
119
|
+
expect{ client.create_objects_message('object', ['1']) }.to raise_error
|
119
120
|
end
|
120
121
|
end
|
121
122
|
|
122
123
|
describe '#soap_cud' do
|
123
124
|
it 'request with message created with normalized properties' do
|
124
125
|
|
125
|
-
|
126
|
-
|
127
|
-
|
126
|
+
client.should_receive(:normalize_properties_for_cud)
|
127
|
+
client.should_receive(:create_objects_message)
|
128
|
+
client.should_receive(:soap_request)
|
128
129
|
|
129
|
-
|
130
|
+
client.send :soap_cud, :post, 'Subscriber', [{'EmailAddress' => 'dev@exacttarget.com'}]
|
130
131
|
end
|
131
132
|
end
|
132
133
|
end
|