fuelsdk 0.0.3 → 0.0.4
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.
- data/README.md +35 -37
- data/lib/fuelsdk.rb +16 -0
- data/lib/fuelsdk/client.rb +2 -3
- data/lib/fuelsdk/http_request.rb +1 -1
- data/lib/fuelsdk/objects.rb +89 -77
- data/lib/fuelsdk/soap.rb +79 -33
- data/lib/fuelsdk/version.rb +1 -1
- data/samples/sample-bounceevent.rb +3 -3
- data/samples/sample-campaign.rb +14 -14
- data/samples/sample-clickevent.rb +3 -3
- data/samples/sample-contentarea.rb +8 -8
- data/samples/sample-email.rb +8 -8
- data/samples/sample-folder.rb +9 -9
- data/samples/sample-list.rb +7 -7
- data/samples/sample-list.subscriber.rb +6 -6
- data/samples/sample-openevent.rb +3 -3
- data/samples/sample-sentevent.rb +3 -3
- data/samples/sample-subscriber.rb +8 -8
- data/samples/sample-triggeredsend.rb +9 -9
- data/samples/sample-unsubevent.rb +3 -3
- data/spec/{fuelsdk_spec.rb → client_spec.rb} +16 -16
- data/spec/objects_helper_spec.rb +25 -0
- data/spec/objects_spec.rb +111 -0
- data/spec/rest_spec.rb +2 -2
- data/spec/soap_spec.rb +92 -1
- metadata +8 -6
- data/spec/fuelsdk/client_spec.rb +0 -21
data/spec/rest_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe FuelSDK::Rest do
|
3
|
-
let(:client) { FuelSDK::
|
3
|
+
let(:client) { FuelSDK::Client.new }
|
4
4
|
|
5
5
|
subject { client }
|
6
6
|
it { should respond_to(:rest_get) }
|
@@ -38,7 +38,7 @@ describe FuelSDK::Rest do
|
|
38
38
|
expect( client.get_url_properties "some_url/%{parent}/%{child}", {'parent'=> 1, 'other' => 1} ).to eq({'parent' => 1})
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'filters url properties from properties leaving query params' do
|
42
42
|
properties = {'parent'=> 1, 'other' => 1}
|
43
43
|
client.get_url_properties "some_url/%{parent}/%{child}", properties
|
44
44
|
expect(properties).to eq 'other' => 1
|
data/spec/soap_spec.rb
CHANGED
@@ -2,12 +2,15 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FuelSDK::Soap do
|
4
4
|
|
5
|
-
let(:client) { FuelSDK::
|
5
|
+
let(:client) { FuelSDK::Client.new }
|
6
6
|
|
7
7
|
subject { client }
|
8
8
|
|
9
9
|
it { should respond_to(:soap_get) }
|
10
10
|
it { should respond_to(:soap_post) }
|
11
|
+
it { should respond_to(:soap_patch) }
|
12
|
+
it { should respond_to(:soap_delete) }
|
13
|
+
it { should respond_to(:soap_describe) }
|
11
14
|
|
12
15
|
it { should respond_to(:header) }
|
13
16
|
it { should_not respond_to(:header=) }
|
@@ -39,6 +42,94 @@ describe FuelSDK::Soap do
|
|
39
42
|
}
|
40
43
|
)
|
41
44
|
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'requests' do
|
48
|
+
subject {
|
49
|
+
client.stub(:soap_request) do |action, message|
|
50
|
+
[action, message]
|
51
|
+
end
|
52
|
+
client
|
53
|
+
}
|
54
|
+
|
55
|
+
it '#soap_describe calls client with :describe and DescribeRequests message' do
|
56
|
+
expect(subject.soap_describe 'Subscriber').to eq([:describe,
|
57
|
+
{'DescribeRequests' => {'ObjectDefinitionRequest' => {'ObjectType' => 'Subscriber' }}}])
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#soap_post' do
|
61
|
+
subject {
|
62
|
+
client.stub(:soap_request) do |action, message|
|
63
|
+
[action, message]
|
64
|
+
end
|
42
65
|
|
66
|
+
client.stub_chain(:soap_describe,:editable)
|
67
|
+
.and_return(['First Name', 'Last Name', 'Gender'])
|
68
|
+
client
|
69
|
+
}
|
70
|
+
it 'formats soap :create message for single object' do
|
71
|
+
expect(subject.soap_post 'Subscriber', 'EmailAddress' => 'test@fuelsdk.com' ).to eq([:create,
|
72
|
+
{
|
73
|
+
'Objects' => [{'EmailAddress' => 'test@fuelsdk.com'}],
|
74
|
+
:attributes! => {'Objects' => {'xsi:type' => ('tns:Subscriber')}}
|
75
|
+
}])
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'formats soap :create message for multiple objects' do
|
79
|
+
expect(subject.soap_post 'Subscriber', [{'EmailAddress' => 'first@fuelsdk.com'}, {'EmailAddress' => 'second@fuelsdk.com'}] ).to eq([:create,
|
80
|
+
{
|
81
|
+
'Objects' => [{'EmailAddress' => 'first@fuelsdk.com'}, {'EmailAddress' => 'second@fuelsdk.com'}],
|
82
|
+
:attributes! => {'Objects' => {'xsi:type' => ('tns:Subscriber')}}
|
83
|
+
}])
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'formats soap :create message for single object with an attribute' do
|
87
|
+
expect(subject.soap_post 'Subscriber', {'EmailAddress' => 'test@fuelsdk.com',
|
88
|
+
"First Name" => "first"}).to eq([:create,
|
89
|
+
{
|
90
|
+
'Objects' => [{
|
91
|
+
'EmailAddress' => 'test@fuelsdk.com',
|
92
|
+
'Attributes' => [{'Name' => 'First Name', 'Value' => 'first'}],
|
93
|
+
}],
|
94
|
+
:attributes! => {'Objects' => {'xsi:type' => ('tns:Subscriber')}}
|
95
|
+
}])
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'formats soap :create message for single object with multiple attributes' do
|
99
|
+
expect(subject.soap_post 'Subscriber', {'EmailAddress' => 'test@fuelsdk.com',
|
100
|
+
"First Name" => "first", "Last Name" => "subscriber"}).to eq([:create,
|
101
|
+
{
|
102
|
+
'Objects' => [{
|
103
|
+
'EmailAddress' => 'test@fuelsdk.com',
|
104
|
+
'Attributes' => [
|
105
|
+
{'Name' => 'First Name', 'Value' => 'first'},
|
106
|
+
{'Name' => 'Last Name', 'Value' => 'subscriber'},
|
107
|
+
],
|
108
|
+
}],
|
109
|
+
:attributes! => {'Objects' => {'xsi:type' => ('tns:Subscriber')}}
|
110
|
+
}])
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'formats soap :create message for multiple objects with multiple attributes' do
|
114
|
+
expect(subject.soap_post 'Subscriber', [{'EmailAddress' => 'first@fuelsdk.com', "First Name" => "first", "Last Name" => "subscriber"},
|
115
|
+
{'EmailAddress' => 'second@fuelsdk.com', "First Name" => "second", "Last Name" => "subscriber"}]).to eq([:create,
|
116
|
+
{
|
117
|
+
'Objects' => [
|
118
|
+
{'EmailAddress' => 'first@fuelsdk.com',
|
119
|
+
'Attributes' => [
|
120
|
+
{'Name' => 'First Name', 'Value' => 'first'},
|
121
|
+
{'Name' => 'Last Name', 'Value' => 'subscriber'},
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{'EmailAddress' => 'second@fuelsdk.com',
|
125
|
+
'Attributes' => [
|
126
|
+
{'Name' => 'First Name', 'Value' => 'second'},
|
127
|
+
{'Name' => 'Last Name', 'Value' => 'subscriber'},
|
128
|
+
]
|
129
|
+
}],
|
130
|
+
:attributes! => {'Objects' => {'xsi:type' => ('tns:Subscriber')}}
|
131
|
+
}])
|
132
|
+
end
|
133
|
+
end
|
43
134
|
end
|
44
135
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuelsdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-06-
|
13
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -178,10 +178,11 @@ files:
|
|
178
178
|
- samples/sample-triggeredsend.rb
|
179
179
|
- samples/sample-unsubevent.rb
|
180
180
|
- samples/sample_helper.rb
|
181
|
-
- spec/
|
182
|
-
- spec/fuelsdk_spec.rb
|
181
|
+
- spec/client_spec.rb
|
183
182
|
- spec/helper_funcs_spec.rb
|
184
183
|
- spec/http_request_spec.rb
|
184
|
+
- spec/objects_helper_spec.rb
|
185
|
+
- spec/objects_spec.rb
|
185
186
|
- spec/rest_spec.rb
|
186
187
|
- spec/soap_spec.rb
|
187
188
|
- spec/spec_helper.rb
|
@@ -229,10 +230,11 @@ test_files:
|
|
229
230
|
- samples/sample-triggeredsend.rb
|
230
231
|
- samples/sample-unsubevent.rb
|
231
232
|
- samples/sample_helper.rb
|
232
|
-
- spec/
|
233
|
-
- spec/fuelsdk_spec.rb
|
233
|
+
- spec/client_spec.rb
|
234
234
|
- spec/helper_funcs_spec.rb
|
235
235
|
- spec/http_request_spec.rb
|
236
|
+
- spec/objects_helper_spec.rb
|
237
|
+
- spec/objects_spec.rb
|
236
238
|
- spec/rest_spec.rb
|
237
239
|
- spec/soap_spec.rb
|
238
240
|
- spec/spec_helper.rb
|
data/spec/fuelsdk/client_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#require 'spec_helper'
|
2
|
-
#
|
3
|
-
#describe FuelSDK::Client do
|
4
|
-
#
|
5
|
-
# it 'errors when instantiated with clientsecret but without clientid' do
|
6
|
-
# expect { FuelSDK::Client.new :clientid => 'id' }.to raise_error
|
7
|
-
# end
|
8
|
-
#
|
9
|
-
# it 'errors when instantiated with clientid but without clientsecret' do
|
10
|
-
# expect { FuelSDK::Client.new :clientid => 'id' }.to raise_error
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# describe '#new' do
|
14
|
-
# let(:client) { FuelSDK::Client.new :clientid => 'id', :clientsecret => 'secret' }
|
15
|
-
# subject { client }
|
16
|
-
#
|
17
|
-
# its(:id) { should eq 'id' }
|
18
|
-
# its(:secret) { should eq 'secret' }
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
#end
|