reward_station 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +113 -11
- data/lib/reward_station/{service.rb → client.rb} +13 -18
- data/lib/{responses/award_points → reward_station/responses}/award_points.xml +0 -0
- data/lib/{responses/award_points → reward_station/responses}/award_points_invalid_token.xml +0 -0
- data/lib/{responses/update_user → reward_station/responses}/create_user.xml +0 -0
- data/lib/{responses/update_user → reward_station/responses}/create_user_exists.xml +0 -0
- data/lib/{responses/return_point_summary → reward_station/responses}/return_point_summary.xml +0 -0
- data/lib/{responses/return_point_summary → reward_station/responses}/return_point_summary_invalid_token.xml +0 -0
- data/lib/{responses/return_popular_products → reward_station/responses}/return_popular_products.xml +0 -0
- data/lib/{responses/return_popular_products → reward_station/responses}/return_popular_products_invalid_token.xml +0 -0
- data/lib/{responses/return_token → reward_station/responses}/return_token.xml +0 -0
- data/lib/{responses/return_token → reward_station/responses}/return_token_invalid.xml +0 -0
- data/lib/{responses/return_user → reward_station/responses}/return_user.xml +0 -0
- data/lib/{responses/return_user → reward_station/responses}/return_user_invalid_token.xml +0 -0
- data/lib/{responses/return_user → reward_station/responses}/return_user_invalid_user.xml +0 -0
- data/lib/reward_station/stub_client.rb +22 -0
- data/lib/reward_station/stub_response.rb +45 -0
- data/lib/reward_station/version.rb +1 -1
- data/lib/reward_station.rb +4 -5
- data/lib/saml/auth_response.rb +2 -0
- data/reward_station.gemspec +3 -1
- data/spec/reward_station/service_spec.rb +27 -13
- data/{lib/savon/mock.rb → spec/savon_helper.rb} +14 -2
- data/spec/spec_helper.rb +2 -0
- metadata +38 -22
- data/lib/savon/macros.rb +0 -12
- data/lib/savon/mock_response.rb +0 -45
data/README.md
CHANGED
@@ -1,19 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Client library for Xceleration rewardstation.com service
|
1
|
+
# Xceleration Reward Station
|
4
2
|
|
3
|
+
Client library for Xceleration rewardstation.com SOAP service
|
5
4
|
|
6
5
|
## Basic Usage
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
Common scenario is creating client instance using required parameters `:client_id` and `:client_password`.
|
8
|
+
Client implements several methods for accessing reward station SOAP API.
|
9
|
+
|
10
|
+
### Initialization
|
11
|
+
|
12
|
+
reward_station = RewardStation::Client.new {
|
13
|
+
:client_id => "112112", # required
|
14
|
+
:client_password => "fsdftr#", # required
|
15
|
+
:organization_id => '150', # optional, default Organization ID
|
16
|
+
:program_id => 25, # optional, default Program ID
|
17
|
+
:point_reasond_code_id => 129 # optional, default Point Reason Code ID
|
18
|
+
:token => "sdfweqwrtwerfasdfas" # optional, initial Access Token value
|
19
|
+
:new_token_callback => lambda{ |token| ... } # optional, callback on Access Token change
|
20
|
+
}
|
21
|
+
|
22
|
+
### New Token Callback
|
23
|
+
You can specify callback in constructor as `lambda` or `proc`
|
24
|
+
Or you can specify callback as block:
|
10
25
|
|
11
|
-
|
12
|
-
|
26
|
+
reward_station.new_token_calback do |new_token|
|
27
|
+
# notify other client instance about new token
|
28
|
+
end
|
29
|
+
|
30
|
+
### Return Token
|
31
|
+
Access token request. Usually not needed on businnes level because client requests it when it became invalid or expired
|
13
32
|
|
14
33
|
token = reward_station.return_token
|
15
34
|
|
16
|
-
|
35
|
+
### Award Points
|
17
36
|
Update award points
|
18
37
|
|
19
38
|
user_id = "130"
|
@@ -24,7 +43,7 @@ Update award points
|
|
24
43
|
|
25
44
|
confirmation_number = reward_station.award_points user_id, points, description, program_id, point_reason_code_id
|
26
45
|
|
27
|
-
|
46
|
+
### Create User
|
28
47
|
|
29
48
|
user_attributes = reward_station.create_user :organization_id => '150',
|
30
49
|
:email => 'john5@company.com',
|
@@ -60,12 +79,95 @@ Update award points
|
|
60
79
|
# :error_message => nil
|
61
80
|
# }
|
62
81
|
|
82
|
+
### Update User
|
83
|
+
|
84
|
+
Similar to 'Create User'
|
85
|
+
|
86
|
+
user_attributes = reward_station.update_user user_id, :organization_id => '150',
|
87
|
+
:email => 'john5@company.com',
|
88
|
+
:first_name => 'John',
|
89
|
+
:last_name => 'Smith',
|
90
|
+
:user_name => 'john5@company.com',
|
91
|
+
:balance => 0
|
92
|
+
|
93
|
+
|
94
|
+
### Return Points Summary
|
95
|
+
|
96
|
+
Returns user points. Required parameter - User ID
|
97
|
+
|
98
|
+
user_id = 130
|
99
|
+
|
100
|
+
summary = service.return_point_summary user_id
|
101
|
+
|
102
|
+
puts summary.inspect
|
103
|
+
|
104
|
+
# {
|
105
|
+
# :user_id => '577',
|
106
|
+
# :is_active => true,
|
107
|
+
# :points_earned => '465',
|
108
|
+
# :points_redeemed => '0',
|
109
|
+
# :points_credited => '0',
|
110
|
+
# :points_balance => '465'
|
111
|
+
# }
|
112
|
+
|
113
|
+
|
114
|
+
### Return Popular Products
|
115
|
+
|
116
|
+
Returns an array of popular products for user
|
117
|
+
|
118
|
+
user_id = 130
|
119
|
+
|
120
|
+
popular_products = service.return_popular_products user_id
|
121
|
+
|
122
|
+
puts popular_products.inspect
|
123
|
+
|
124
|
+
# [
|
125
|
+
# {
|
126
|
+
# :product_id => 'MC770LLA',
|
127
|
+
# :name => 'iPad 2 with Wifi - 32GB',
|
128
|
+
# :description => 'The NEW Apple iPad 2 - Thinner, lighter, and full of great ideas. Once you pick up iPad 2, it’ll be hard to put down. That’s the idea behind the all-new design. It’s 33 percent thinner and up to 15 percent lighter, so it feels even more comfortable in your hands. And, it makes surfing the web, checking email, watching movies, and reading books so natural, you might forget there’s incredible technology under your fingers.<br><br><b>Dual-core A5 chip</b>.<br> Two powerful cores in one A5 chip mean iPad can do twice the work at once. You’ll notice the difference when you’re surfing the web, watching movies, making FaceTime video calls, gaming, and going from app to app to app. Multitasking is smoother, apps load faster, and everything just works better.<br><br><b>Superfast graphics</b>. <br>With up to nine times the graphics performance, gameplay on iPad is even smoother and more realistic. And faster graphics help apps perform better — especially those with video. You’ll see it when you’re scrolling through your photo library, editing video with iMovie, and viewing animations in Keynote.<br><br><b>Battery life keeps on going. So you can, too.</b><br> Even with the new thinner and lighter design, iPad has the same amazing 10-hour battery life. That’s enough juice for one flight across the ocean, or one movie-watching all-nighter, or a week’s commute across town. The power-efficient A5 chip and iOS keep battery life from fading away, so you can get carried away.<br><br><b>Two cameras.</b><br> You’ll see two cameras on iPad — one on the front and one on the back. They may be tiny, but they’re a big deal. They’re designed for FaceTime video calling, and they work together so you can talk to your favorite people and see them smile and laugh back at you. The front camera puts you and your friend face-to-face. Switch to the back camera during your video call to share where you are, who you’re with, or what’s going on around you. When you’re not using FaceTime, let the back camera roll if you see something movie-worthy. It’s HD, so whatever you shoot is a mini-masterpiece. And you can take wacky snapshots in Photo Booth. It’s the most fun a face can have.<br><br><b>Due to the demand for this item, please allow up to 8-10 weeks for delivery</b>.',
|
129
|
+
# :points => '10927',
|
130
|
+
# :category => 'Office & Computer',
|
131
|
+
# :manufacturer => 'Apple',
|
132
|
+
# :small_image_url => 'https://www.rewardstation.com/catalogimages/MC769LLA.gif',
|
133
|
+
# :large_image_url => 'https://www.rewardstation.com/catalogimages/MC769LLA.jpg'
|
134
|
+
# }, {
|
135
|
+
# ...
|
136
|
+
# }
|
137
|
+
# ]
|
138
|
+
|
139
|
+
|
140
|
+
## Client Stub
|
141
|
+
|
142
|
+
Client supports stub mode.
|
143
|
+
Client stub supports all request methods supported by `RewardStation::Client` but it doesn't make requests to Reward Station API. It just returns predefined SOAP responses.
|
144
|
+
You can override those responses in `config/reward_station/responses` folder. For example if `award_points` method response should be overridden then add `award_points.xml` file to `config/reward_station/responses` folder.
|
145
|
+
|
146
|
+
### Stub Initialization
|
147
|
+
|
148
|
+
stub = RewardStation::Client.stub
|
149
|
+
|
150
|
+
### config/reward_station/responses/award_points.xml
|
151
|
+
|
152
|
+
<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">
|
153
|
+
<soap:Body>
|
154
|
+
<AwardPointsResponse xmlns="http://rswebservices.rewardstation.com/">
|
155
|
+
<AwardPointsResult>
|
156
|
+
<UserID>577</UserID>
|
157
|
+
<Points>10</Points>
|
158
|
+
<ConfirmationNumber>9376</ConfirmationNumber>
|
159
|
+
<ErrorMessage/>
|
160
|
+
</AwardPointsResult>
|
161
|
+
</AwardPointsResponse>
|
162
|
+
</soap:Body>
|
163
|
+
</soap:Envelope>
|
164
|
+
|
63
165
|
|
64
166
|
## Single-Sign-On
|
65
167
|
|
66
168
|
Basic SSO logic implemented in SAML::AuthResponse class. Example usage of AuthResponse:
|
67
169
|
|
68
|
-
|
170
|
+
### SessionController
|
69
171
|
|
70
172
|
require 'saml/auth_response'
|
71
173
|
|
@@ -110,7 +212,7 @@ Basic SSO logic implemented in SAML::AuthResponse class. Example usage of AuthRe
|
|
110
212
|
end
|
111
213
|
end
|
112
214
|
|
113
|
-
|
215
|
+
### signon.html.erb
|
114
216
|
|
115
217
|
<html>
|
116
218
|
<body>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RewardStation
|
2
|
-
class
|
2
|
+
class Client
|
3
3
|
|
4
4
|
def initialize options = {}
|
5
5
|
[:client_id, :client_password].each do |arg|
|
@@ -19,11 +19,6 @@ module RewardStation
|
|
19
19
|
@new_token_callback = options[:new_token_callback]
|
20
20
|
end
|
21
21
|
|
22
|
-
@mode = :default
|
23
|
-
if options[:mode]
|
24
|
-
raise ArgumentError, "supported modes :default and :mock" unless [:mock, :default].include?(options[:mode].to_sym)
|
25
|
-
@mode = options[:mode].to_sym
|
26
|
-
end
|
27
22
|
end
|
28
23
|
|
29
24
|
def new_token_callback &block
|
@@ -31,7 +26,12 @@ module RewardStation
|
|
31
26
|
end
|
32
27
|
|
33
28
|
class << self
|
34
|
-
|
29
|
+
|
30
|
+
def stub options = {}
|
31
|
+
RewardStation::StubClient.new options
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_client
|
35
35
|
@@client ||= Savon::Client.new do |wsdl|
|
36
36
|
wsdl.document = File.join(File.dirname(__FILE__), '..', 'wsdl', 'reward_services.xml')
|
37
37
|
end
|
@@ -43,7 +43,7 @@ module RewardStation
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def logger
|
46
|
-
|
46
|
+
Client.logger
|
47
47
|
end
|
48
48
|
|
49
49
|
def return_token
|
@@ -115,10 +115,6 @@ module RewardStation
|
|
115
115
|
|
116
116
|
protected
|
117
117
|
|
118
|
-
def mock?
|
119
|
-
@mode == :mock
|
120
|
-
end
|
121
|
-
|
122
118
|
def update_token
|
123
119
|
@token = return_token
|
124
120
|
@new_token_callback.call(@token) if @new_token_callback
|
@@ -139,12 +135,7 @@ module RewardStation
|
|
139
135
|
end
|
140
136
|
|
141
137
|
def request method_name, params
|
142
|
-
|
143
|
-
if mock?
|
144
|
-
#TODO
|
145
|
-
end
|
146
|
-
|
147
|
-
response = Service.client.request(:wsdl, method_name , params).to_hash
|
138
|
+
response = get_response method_name, params
|
148
139
|
|
149
140
|
logger.debug response.inspect
|
150
141
|
|
@@ -163,5 +154,9 @@ module RewardStation
|
|
163
154
|
logger.error ex.backtrace.inspect
|
164
155
|
raise ConnectionError.new
|
165
156
|
end
|
157
|
+
|
158
|
+
def get_response method_name, params
|
159
|
+
Client.get_client.request(:wsdl, method_name , params).to_hash
|
160
|
+
end
|
166
161
|
end
|
167
162
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/{responses/return_point_summary → reward_station/responses}/return_point_summary.xml
RENAMED
File without changes
|
File without changes
|
data/lib/{responses/return_popular_products → reward_station/responses}/return_popular_products.xml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RewardStation
|
2
|
+
class StubClient < Client
|
3
|
+
|
4
|
+
def initialize responses = {}
|
5
|
+
@responses = {}
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def get_response method_name, params
|
11
|
+
response = StubResponse[method_name, method_name]
|
12
|
+
|
13
|
+
raise ArgumentError, "Missing stub file for '#{method_name}' request" unless response
|
14
|
+
|
15
|
+
hash = Nori.parse(response)
|
16
|
+
|
17
|
+
raise ArgumentError, "Stub file for '#{method_name}' has incorrect format" unless hash.key?(:envelope) || hash[:envelope].key?(:body)
|
18
|
+
|
19
|
+
hash[:envelope][:body]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module RewardStation
|
2
|
+
class StubResponse
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def gem_responses_path
|
6
|
+
File.join(File.dirname(__FILE__), "responses")
|
7
|
+
end
|
8
|
+
|
9
|
+
def local_responses_path
|
10
|
+
File.expand_path('config/reward_station/responses') rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def load(*args)
|
14
|
+
file_name = args.last
|
15
|
+
responses[file_name] ||= load_response_file file_name
|
16
|
+
end
|
17
|
+
|
18
|
+
alias_method :[], :load
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def responses
|
23
|
+
@responses ||= {}
|
24
|
+
end
|
25
|
+
|
26
|
+
def load_response_file file_name
|
27
|
+
file_path = nil
|
28
|
+
|
29
|
+
if local_responses_path
|
30
|
+
local_path = File.join(local_responses_path, "#{file_name}.xml")
|
31
|
+
file_path = local_path if File.exist?(local_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
unless file_path
|
35
|
+
gem_path = File.join(gem_responses_path, "#{file_name}.xml")
|
36
|
+
file_path = gem_path if File.exist?(gem_path)
|
37
|
+
end
|
38
|
+
|
39
|
+
raise ArgumentError, "Unable to load: #{file_name}" unless file_path
|
40
|
+
|
41
|
+
File.read file_path
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/reward_station.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'savon'
|
2
|
+
require 'ruby-saml'
|
2
3
|
|
3
|
-
require
|
4
|
-
require 'savon/macros'
|
5
|
-
require 'savon/mock_response'
|
6
|
-
|
4
|
+
require 'reward_station/stub_response'
|
7
5
|
require 'reward_station/errors'
|
8
|
-
require 'reward_station/
|
6
|
+
require 'reward_station/client'
|
7
|
+
require 'reward_station/stub_client'
|
9
8
|
|
10
9
|
|
data/lib/saml/auth_response.rb
CHANGED
data/reward_station.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
3
4
|
require "reward_station/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
@@ -8,7 +9,7 @@ Gem::Specification.new do |s|
|
|
8
9
|
s.platform = Gem::Platform::RUBY
|
9
10
|
s.authors = ["Stepan Filatov", 'Cloud Castle Inc.']
|
10
11
|
s.email = ["filatov.st@gmail.com"]
|
11
|
-
s.homepage = "https://github.com/
|
12
|
+
s.homepage = "https://github.com/cloudcastle/reward_station"
|
12
13
|
s.summary = %q{Reward Station is a client library for rewardstation.com}
|
13
14
|
s.description = %q{}
|
14
15
|
|
@@ -20,4 +21,5 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.require_paths = ["lib"]
|
21
22
|
|
22
23
|
s.add_dependency 'savon', ">= 0.9.6"
|
24
|
+
s.add_dependency "ruby-saml-bekk", '>= 0.3.3'
|
23
25
|
end
|
@@ -1,30 +1,44 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe RewardStation::
|
3
|
+
describe RewardStation::Client do
|
4
4
|
|
5
|
-
let(:service) { RewardStation::
|
5
|
+
let(:service) { RewardStation::Client.new :client_id => '100080', :client_password => 'fM6Rv4moz#', :token => "e285e1ed-2356-4676-a554-99d79e6284b0" }
|
6
6
|
|
7
7
|
describe "required options" do
|
8
8
|
it "should raise ArgumentError on missing client_id" do
|
9
|
-
lambda{ RewardStation::
|
9
|
+
lambda{ RewardStation::Client.new :client_password => "" }.should raise_error(ArgumentError)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should raise ArgumentError on missing client_password" do
|
13
|
-
lambda{ RewardStation::
|
13
|
+
lambda{ RewardStation::Client.new :client_id => "" }.should raise_error(ArgumentError)
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should not rause ArgumentError if all required parameters present" do
|
17
|
-
lambda{ RewardStation::
|
17
|
+
lambda{ RewardStation::Client.new :client_id => "", :client_password => "" }.should_not raise_error(ArgumentError)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "new_token_callback" do
|
22
22
|
it "should raise ArgumentError if options is not lambda or proc" do
|
23
|
-
lambda{ RewardStation::
|
23
|
+
lambda{ RewardStation::Client.new :client_id => "", :client_password => "", :new_token_callback => "" }.should raise_error(ArgumentError)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should not raise ArgumentError if option is lambda or proc" do
|
27
|
-
lambda{ RewardStation::
|
27
|
+
lambda{ RewardStation::Client.new :client_id => "", :client_password => "", :new_token_callback => Proc.new { } }.should_not raise_error(ArgumentError)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'stub' do
|
32
|
+
it "should create stub" do
|
33
|
+
RewardStation::Client.stub.should be_a(RewardStation::StubClient)
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'stub service' do
|
37
|
+
let(:service) {RewardStation::Client.stub}
|
38
|
+
|
39
|
+
it "should return token" do
|
40
|
+
service.return_token.should eq("e285e1ed-2356-4676-a554-99d79e6284b0")
|
41
|
+
end
|
28
42
|
end
|
29
43
|
end
|
30
44
|
|
@@ -69,11 +83,11 @@ describe RewardStation::Service do
|
|
69
83
|
|
70
84
|
describe "award_points" do
|
71
85
|
let(:service) {
|
72
|
-
RewardStation::
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
86
|
+
RewardStation::Client.new :client_id => '100080',
|
87
|
+
:client_password => 'fM6Rv4moz#',
|
88
|
+
:program_id => 90,
|
89
|
+
:point_reason_code_id => 129,
|
90
|
+
:token => "e285e1ed-2356-4676-a554-99d79e6284b0"
|
77
91
|
}
|
78
92
|
|
79
93
|
describe "on valid response" do
|
@@ -223,7 +237,7 @@ describe RewardStation::Service do
|
|
223
237
|
end
|
224
238
|
|
225
239
|
describe "update_user" do
|
226
|
-
let(:service) { RewardStation::
|
240
|
+
let(:service) { RewardStation::Client.new :client_id => '100080', :client_password => 'fM6Rv4moz#', :organization_id => '150', :token => "e285e1ed-2356-4676-a554-99d79e6284b0" }
|
227
241
|
|
228
242
|
describe "on create user valid request" do
|
229
243
|
before { savon.stub(:update_user).and_return(:create_user) }
|
@@ -1,4 +1,15 @@
|
|
1
1
|
module Savon
|
2
|
+
# = Savon::Spec::Macros
|
3
|
+
#
|
4
|
+
# Include this module into your RSpec tests to mock/stub Savon SOAP requests.
|
5
|
+
module Macros
|
6
|
+
def savon
|
7
|
+
Savon::SOAP::Response.any_instance.stub(:soap_fault?).and_return(false)
|
8
|
+
Savon::SOAP::Response.any_instance.stub(:http_error?).and_return(false)
|
9
|
+
Savon::Mock.new
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
2
13
|
# = Savon::Spec::Mock
|
3
14
|
#
|
4
15
|
# Mocks/stubs SOAP requests executed by Savon.
|
@@ -30,7 +41,7 @@ module Savon
|
|
30
41
|
http = { :code => 200, :headers => {}, :body => "" }
|
31
42
|
|
32
43
|
case response
|
33
|
-
when Symbol then http[:body] =
|
44
|
+
when Symbol then http[:body] = RewardStation::StubResponse[soap_action, response]
|
34
45
|
when Hash then http.merge! response
|
35
46
|
when String then http[:body] = response
|
36
47
|
end
|
@@ -67,4 +78,5 @@ module Savon
|
|
67
78
|
@soap_action = soap_action.kind_of?(Symbol) ? soap_action.to_s.lower_camelcase : soap_action
|
68
79
|
end
|
69
80
|
end
|
70
|
-
|
81
|
+
|
82
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stepan Filatov
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-07-
|
19
|
+
date: 2011-07-19 00:00:00 +04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,22 @@ dependencies:
|
|
35
35
|
version: 0.9.6
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: ruby-saml-bekk
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 21
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
- 3
|
50
|
+
- 3
|
51
|
+
version: 0.3.3
|
52
|
+
type: :runtime
|
53
|
+
version_requirements: *id002
|
38
54
|
description: ""
|
39
55
|
email:
|
40
56
|
- filatov.st@gmail.com
|
@@ -52,33 +68,33 @@ files:
|
|
52
68
|
- LICENSE
|
53
69
|
- README.md
|
54
70
|
- Rakefile
|
55
|
-
- lib/responses/award_points/award_points.xml
|
56
|
-
- lib/responses/award_points/award_points_invalid_token.xml
|
57
|
-
- lib/responses/return_point_summary/return_point_summary.xml
|
58
|
-
- lib/responses/return_point_summary/return_point_summary_invalid_token.xml
|
59
|
-
- lib/responses/return_popular_products/return_popular_products.xml
|
60
|
-
- lib/responses/return_popular_products/return_popular_products_invalid_token.xml
|
61
|
-
- lib/responses/return_token/return_token.xml
|
62
|
-
- lib/responses/return_token/return_token_invalid.xml
|
63
|
-
- lib/responses/return_user/return_user.xml
|
64
|
-
- lib/responses/return_user/return_user_invalid_token.xml
|
65
|
-
- lib/responses/return_user/return_user_invalid_user.xml
|
66
|
-
- lib/responses/update_user/create_user.xml
|
67
|
-
- lib/responses/update_user/create_user_exists.xml
|
68
71
|
- lib/reward_station.rb
|
72
|
+
- lib/reward_station/client.rb
|
69
73
|
- lib/reward_station/errors.rb
|
70
|
-
- lib/reward_station/
|
74
|
+
- lib/reward_station/responses/award_points.xml
|
75
|
+
- lib/reward_station/responses/award_points_invalid_token.xml
|
76
|
+
- lib/reward_station/responses/create_user.xml
|
77
|
+
- lib/reward_station/responses/create_user_exists.xml
|
78
|
+
- lib/reward_station/responses/return_point_summary.xml
|
79
|
+
- lib/reward_station/responses/return_point_summary_invalid_token.xml
|
80
|
+
- lib/reward_station/responses/return_popular_products.xml
|
81
|
+
- lib/reward_station/responses/return_popular_products_invalid_token.xml
|
82
|
+
- lib/reward_station/responses/return_token.xml
|
83
|
+
- lib/reward_station/responses/return_token_invalid.xml
|
84
|
+
- lib/reward_station/responses/return_user.xml
|
85
|
+
- lib/reward_station/responses/return_user_invalid_token.xml
|
86
|
+
- lib/reward_station/responses/return_user_invalid_user.xml
|
87
|
+
- lib/reward_station/stub_client.rb
|
88
|
+
- lib/reward_station/stub_response.rb
|
71
89
|
- lib/reward_station/version.rb
|
72
90
|
- lib/saml/auth_response.rb
|
73
|
-
- lib/savon/macros.rb
|
74
|
-
- lib/savon/mock.rb
|
75
|
-
- lib/savon/mock_response.rb
|
76
91
|
- lib/wsdl/reward_services.xml
|
77
92
|
- reward_station.gemspec
|
78
93
|
- spec/reward_station/service_spec.rb
|
94
|
+
- spec/savon_helper.rb
|
79
95
|
- spec/spec_helper.rb
|
80
96
|
has_rdoc: true
|
81
|
-
homepage: https://github.com/
|
97
|
+
homepage: https://github.com/cloudcastle/reward_station
|
82
98
|
licenses: []
|
83
99
|
|
84
100
|
post_install_message:
|
data/lib/savon/macros.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module Savon
|
2
|
-
# = Savon::Spec::Macros
|
3
|
-
#
|
4
|
-
# Include this module into your RSpec tests to mock/stub Savon SOAP requests.
|
5
|
-
module Macros
|
6
|
-
def savon
|
7
|
-
Savon::SOAP::Response.any_instance.stub(:soap_fault?).and_return(false)
|
8
|
-
Savon::SOAP::Response.any_instance.stub(:http_error?).and_return(false)
|
9
|
-
Savon::Mock.new
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/lib/savon/mock_response.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
module Savon
|
2
|
-
class MockResponse
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def gem_responses_path
|
6
|
-
File.join(File.dirname(__FILE__), "..", "responses")
|
7
|
-
end
|
8
|
-
|
9
|
-
def local_responses_path
|
10
|
-
File.expand_path('config/responses') rescue nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def load(*args)
|
14
|
-
file = args.map { |arg| arg.to_s.snakecase }.join("/")
|
15
|
-
responses[file] ||= load_response_file file
|
16
|
-
end
|
17
|
-
|
18
|
-
alias_method :[], :load
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def responses
|
23
|
-
@responses ||= {}
|
24
|
-
end
|
25
|
-
|
26
|
-
def load_response_file(file)
|
27
|
-
file_path = nil
|
28
|
-
|
29
|
-
if local_responses_path
|
30
|
-
local_path = File.join(local_responses_path, "#{file}.xml")
|
31
|
-
file_path = local_path if File.exist?(local_path)
|
32
|
-
end
|
33
|
-
|
34
|
-
unless file_path
|
35
|
-
gem_path = File.join(gem_responses_path, "#{file}.xml")
|
36
|
-
file_path = gem_path if File.exist?(gem_path)
|
37
|
-
end
|
38
|
-
|
39
|
-
raise ArgumentError, "Unable to load: #{file}" unless file_path
|
40
|
-
|
41
|
-
File.read file_path
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|