reward_station 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/reward_station/client.rb +15 -8
- data/lib/reward_station/version.rb +1 -1
- data/lib/wsdl/reward_services.xml +50 -0
- data/spec/reward_station/service_spec.rb +12 -1
- metadata +11 -13
@@ -62,6 +62,10 @@ module RewardStation
|
|
62
62
|
def return_user user_id
|
63
63
|
request_with_token(:return_user, :body => { 'UserID' => user_id} )[:user_profile]
|
64
64
|
end
|
65
|
+
|
66
|
+
def return_user_by_user_name user_name
|
67
|
+
request_with_token(:return_user_by_user_name , :body => { 'UserName' => user_name} )[:user_profile]
|
68
|
+
end
|
65
69
|
|
66
70
|
def award_points user_id, points, description, program_id = nil, point_reason_code_id = nil
|
67
71
|
request_with_token(:award_points, :body => {
|
@@ -82,12 +86,15 @@ module RewardStation
|
|
82
86
|
end
|
83
87
|
|
84
88
|
def update_user user_id, attrs = {}
|
85
|
-
|
86
89
|
organization_id = attrs[:organization_id] || @organization_id
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
|
91
|
+
raise(ArgumentError, "organization_id should be numeric") if organization_id.to_i.zero?
|
92
|
+
|
93
|
+
[:email, :first_name, :last_name].each do |f|
|
94
|
+
raise(ArgumentError, "#{f} required and should not be empty") if attrs[f].to_s.blank?
|
95
|
+
end
|
96
|
+
|
97
|
+
user_name = attrs[:user_name] || attrs[:email]
|
91
98
|
balance = attrs[:balance] || 0
|
92
99
|
|
93
100
|
request_with_token(:update_user , :body => {
|
@@ -95,10 +102,10 @@ module RewardStation
|
|
95
102
|
'UserID' => user_id,
|
96
103
|
'ClientID' => @client_id,
|
97
104
|
'UserName' => user_name,
|
98
|
-
'FirstName' => first_name,
|
99
|
-
'LastName' => last_name,
|
105
|
+
'FirstName' => attrs[:first_name],
|
106
|
+
'LastName' => attrs[:last_name],
|
100
107
|
'CountryCode' => 'USA',
|
101
|
-
'Email' => email,
|
108
|
+
'Email' => attrs[:email],
|
102
109
|
'IsActive' => true,
|
103
110
|
'PointBalance' => balance,
|
104
111
|
'OrganizationID' => organization_id
|
@@ -95,6 +95,28 @@
|
|
95
95
|
<s:element minOccurs="0" maxOccurs="1" name="UserProfile" type="tns:User"/>
|
96
96
|
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
|
97
97
|
</s:sequence>
|
98
|
+
</s:complexType>
|
99
|
+
<s:element name="ReturnUserByUserName">
|
100
|
+
<s:complexType>
|
101
|
+
<s:sequence>
|
102
|
+
<s:element minOccurs="1" maxOccurs="1" name="UserName" type="s:string"/>
|
103
|
+
<s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
|
104
|
+
</s:sequence>
|
105
|
+
</s:complexType>
|
106
|
+
</s:element>
|
107
|
+
<s:element name="ReturnUserByUserNameResponse">
|
108
|
+
<s:complexType>
|
109
|
+
<s:sequence>
|
110
|
+
<s:element minOccurs="0" maxOccurs="1" name="ReturnUserByUserNameResult" type="tns:ReturnUserByUserNameResult"/>
|
111
|
+
</s:sequence>
|
112
|
+
</s:complexType>
|
113
|
+
</s:element>
|
114
|
+
<s:complexType name="ReturnUserByUserNameResult">
|
115
|
+
<s:sequence>
|
116
|
+
<s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
|
117
|
+
<s:element minOccurs="0" maxOccurs="1" name="UserProfile" type="tns:User"/>
|
118
|
+
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
|
119
|
+
</s:sequence>
|
98
120
|
</s:complexType>
|
99
121
|
<s:element name="UpdateUser">
|
100
122
|
<s:complexType>
|
@@ -286,6 +308,12 @@
|
|
286
308
|
<wsdl:message name="ReturnUserSoapOut">
|
287
309
|
<wsdl:part name="parameters" element="tns:ReturnUserResponse"/>
|
288
310
|
</wsdl:message>
|
311
|
+
<wsdl:message name="ReturnUserByUserNameSoapIn">
|
312
|
+
<wsdl:part name="parameters" element="tns:ReturnUserByUserName"/>
|
313
|
+
</wsdl:message>
|
314
|
+
<wsdl:message name="ReturnUserByUserNameSoapOut">
|
315
|
+
<wsdl:part name="parameters" element="tns:ReturnUserByUserNameResponse"/>
|
316
|
+
</wsdl:message>
|
289
317
|
<wsdl:message name="UpdateUserSoapIn">
|
290
318
|
<wsdl:part name="parameters" element="tns:UpdateUser"/>
|
291
319
|
</wsdl:message>
|
@@ -328,6 +356,10 @@
|
|
328
356
|
<wsdl:operation name="ReturnUser">
|
329
357
|
<wsdl:input message="tns:ReturnUserSoapIn"/>
|
330
358
|
<wsdl:output message="tns:ReturnUserSoapOut"/>
|
359
|
+
</wsdl:operation>
|
360
|
+
<wsdl:operation name="ReturnUserByUserName">
|
361
|
+
<wsdl:input message="tns:ReturnUserByUserNameSoapIn"/>
|
362
|
+
<wsdl:output message="tns:ReturnUserByUserNameSoapOut"/>
|
331
363
|
</wsdl:operation>
|
332
364
|
<wsdl:operation name="UpdateUser">
|
333
365
|
<wsdl:input message="tns:UpdateUserSoapIn"/>
|
@@ -378,6 +410,15 @@
|
|
378
410
|
<wsdl:output>
|
379
411
|
<soap:body use="literal"/>
|
380
412
|
</wsdl:output>
|
413
|
+
</wsdl:operation>
|
414
|
+
<wsdl:operation name="ReturnUserByUserName">
|
415
|
+
<soap:operation soapAction="http://rswebservices.rewardstation.com/ReturnUserByUserName" style="document"/>
|
416
|
+
<wsdl:input>
|
417
|
+
<soap:body use="literal"/>
|
418
|
+
</wsdl:input>
|
419
|
+
<wsdl:output>
|
420
|
+
<soap:body use="literal"/>
|
421
|
+
</wsdl:output>
|
381
422
|
</wsdl:operation>
|
382
423
|
<wsdl:operation name="UpdateUser">
|
383
424
|
<soap:operation soapAction="http://rswebservices.rewardstation.com/UpdateUser" style="document"/>
|
@@ -453,6 +494,15 @@
|
|
453
494
|
<wsdl:output>
|
454
495
|
<soap12:body use="literal"/>
|
455
496
|
</wsdl:output>
|
497
|
+
</wsdl:operation>
|
498
|
+
<wsdl:operation name="ReturnUserByUserName">
|
499
|
+
<soap12:operation soapAction="http://rswebservices.rewardstation.com/ReturnUserByUserName" style="document"/>
|
500
|
+
<wsdl:input>
|
501
|
+
<soap12:body use="literal"/>
|
502
|
+
</wsdl:input>
|
503
|
+
<wsdl:output>
|
504
|
+
<soap12:body use="literal"/>
|
505
|
+
</wsdl:output>
|
456
506
|
</wsdl:operation>
|
457
507
|
<wsdl:operation name="UpdateUser">
|
458
508
|
<soap12:operation soapAction="http://rswebservices.rewardstation.com/UpdateUser" style="document"/>
|
@@ -242,7 +242,7 @@ describe RewardStation::Client do
|
|
242
242
|
before { savon.stub(:update_user).and_return(:create_user_missing_info) }
|
243
243
|
|
244
244
|
it "should raise MissingInformation error" do
|
245
|
-
lambda { service.create_user :organization_id => '150' }.should raise_error(
|
245
|
+
lambda { service.create_user :organization_id => '150' }.should raise_error(ArgumentError)
|
246
246
|
end
|
247
247
|
end
|
248
248
|
end
|
@@ -295,6 +295,17 @@ describe RewardStation::Client do
|
|
295
295
|
:balance => 0)
|
296
296
|
}.should_not raise_error(RewardStation::InvalidToken)
|
297
297
|
end
|
298
|
+
|
299
|
+
it 'should raise ArgumentError if organization_id missing' do
|
300
|
+
lambda{
|
301
|
+
service.create_user(:organization_id => "",
|
302
|
+
:email => 'john5@company.com',
|
303
|
+
:first_name => 'John',
|
304
|
+
:last_name => 'Smith',
|
305
|
+
:user_name => 'john5@company.com',
|
306
|
+
:balance => 0)
|
307
|
+
}.should raise_error(ArgumentError)
|
308
|
+
end
|
298
309
|
end
|
299
310
|
|
300
311
|
describe "on create user invalid request" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reward_station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stepan Filatov
|
@@ -16,10 +16,11 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-08
|
20
|
-
default_executable:
|
19
|
+
date: 2011-09-08 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
26
|
requirements:
|
@@ -31,11 +32,11 @@ dependencies:
|
|
31
32
|
- 9
|
32
33
|
- 6
|
33
34
|
version: 0.9.6
|
35
|
+
version_requirements: *id001
|
34
36
|
name: savon
|
37
|
+
- !ruby/object:Gem::Dependency
|
35
38
|
prerelease: false
|
36
39
|
type: :runtime
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
42
|
requirements:
|
@@ -47,10 +48,8 @@ dependencies:
|
|
47
48
|
- 3
|
48
49
|
- 3
|
49
50
|
version: 0.3.3
|
50
|
-
name: ruby-saml-bekk
|
51
|
-
prerelease: false
|
52
|
-
type: :runtime
|
53
51
|
version_requirements: *id002
|
52
|
+
name: ruby-saml-bekk
|
54
53
|
description: ""
|
55
54
|
email:
|
56
55
|
- filatov.st@gmail.com
|
@@ -94,7 +93,6 @@ files:
|
|
94
93
|
- spec/reward_station/service_spec.rb
|
95
94
|
- spec/savon_helper.rb
|
96
95
|
- spec/spec_helper.rb
|
97
|
-
has_rdoc: true
|
98
96
|
homepage: https://github.com/cloudcastle/reward_station
|
99
97
|
licenses: []
|
100
98
|
|
@@ -124,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
122
|
requirements: []
|
125
123
|
|
126
124
|
rubyforge_project: reward_station
|
127
|
-
rubygems_version: 1.
|
125
|
+
rubygems_version: 1.8.6
|
128
126
|
signing_key:
|
129
127
|
specification_version: 3
|
130
128
|
summary: Reward Station is a client library for rewardstation.com
|