vindicia-api 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.md +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +24 -8
- data/lib/vindicia-api.rb +1 -0
- data/lib/vindicia/config.rb +30 -11
- data/lib/vindicia/model.rb +3 -2
- data/lib/vindicia/savon.rb +26 -0
- data/lib/vindicia/version.rb +1 -1
- data/test/fixtures/vcr_cassettes/web_session__initialize.yml +57 -0
- data/test/helper.rb +14 -1
- data/test/vindicia/model_test.rb +32 -1
- data/test/vindicia/version_test.rb +8 -0
- data/vindicia-api.gemspec +4 -1
- metadata +44 -20
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NmNmYjI0ZmE4YTYxMDA5NmFjZmQzYWE4MjI3MmRjYTQ0ZGVmNjliZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjgwOTI2OWMxZDBkM2FkZTIzOTVmYzQ3M2JmYmJkODZkNmExNTIzNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjZiMzZjYjU3ODY5YWI4NjkxODQ5NWNhYjI3MTJhZmFmYTJmODE1NjI3ODM0
|
10
|
+
OGY5NmZhYjY4Zjk2ZTYyMGM4MmY1NjUwOGM2MzEwNjkxOTBkZjhjYjdiOGU4
|
11
|
+
MDNiNWZiOWIyMWI1YmI2ZGU1M2FjOWQ4MDkxNmZhNWVkNTQ3MTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDk2ODVjMDIyNWViMDBiNmZlOWRiOTZmY2IyMGRmOWIyNjAyOGM0Yjc0OWM4
|
14
|
+
NGQ3Yzg2OGI3YjM2YjQ5ZDI5NGFkMTIxNjIyYTUyZWViZjQ5YTI1ODA2N2Vk
|
15
|
+
NzZmNDExNzQ0YzMzOTg0ODZlY2JhNzJiYTI2YzQ0NDFjYzMzNDI=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.1.0 (2014-04-04)
|
4
|
+
|
5
|
+
* Added support for WebSession, escaping initialize [#7](https://github.com/agoragames/vindicia-api/pull/7)
|
6
|
+
|
7
|
+
## 0.0.7 (2013-08-23)
|
8
|
+
|
9
|
+
* Locked savon dependency in gemspec to ~> 1.2.0
|
10
|
+
|
11
|
+
## 0.0.6
|
12
|
+
|
13
|
+
* Update activesupport dependency to be activesupport instead of active_support.
|
14
|
+
|
3
15
|
## 0.0.2
|
4
16
|
|
5
17
|
* Initial public release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -28,9 +28,9 @@ Add something like the following to your environments or in an initializer:
|
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
Vindicia.configure do |config|
|
31
|
-
config.api_version = '
|
31
|
+
config.api_version = '4.2'
|
32
32
|
config.login = 'your_login'
|
33
|
-
config.password = 'your_password'
|
33
|
+
config.password = 'your_password'
|
34
34
|
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
35
35
|
config.namespace = 'http://soap.vindicia.com'
|
36
36
|
end
|
@@ -38,7 +38,15 @@ end
|
|
38
38
|
|
39
39
|
You will want to modify the example above with which API version you are targeting, your login credentials, and the Vindicia endpoint you will be using.
|
40
40
|
|
41
|
-
Current supported API versions are '3.5'
|
41
|
+
Current supported API versions are [ '3.5', '3.6', '3.7', '3.8', '3.9', '4.0', '4.1', '4.2' ].
|
42
|
+
|
43
|
+
For a fuller understanding of the supported versions, classes, and methods, see
|
44
|
+
Vindicia::API_CLASSES. For instance, the list of versions may be introspected
|
45
|
+
via the following:
|
46
|
+
Vindicia::API_CLASSES.keys
|
47
|
+
|
48
|
+
Likewise, the list of classes and their methods may be introspected via the following:
|
49
|
+
Vindicia::API_CLASSES[version_number]
|
42
50
|
|
43
51
|
Available Vindicia endpoints are:
|
44
52
|
|
@@ -51,17 +59,25 @@ After the Vindicia API has been configured, all Vindicia classes for the respect
|
|
51
59
|
Parameters are passed as hashes, for example:
|
52
60
|
|
53
61
|
```ruby
|
54
|
-
Vindicia::AutoBill.fetch_by_account(:account => { :merchantAccountId => id }
|
62
|
+
auto_bill_response = Vindicia::AutoBill.fetch_by_account(:account => { :merchantAccountId => id })
|
63
|
+
auto_bill = auto_bill_response.to_class
|
64
|
+
if auto_bill.nil?
|
65
|
+
raise "Error fetching AutoBill by Account for merchantAccountId: '#{id}', fault: '#{auto_bill_response.soap_fault}', error: #{auto_bill_response.http_error}"
|
66
|
+
end
|
55
67
|
```
|
56
68
|
|
57
69
|
* Note that parameters must be specified in the same order as documented in Vindicia's developer documentation.
|
58
70
|
|
59
|
-
##
|
71
|
+
## Hacks
|
60
72
|
|
61
|
-
* WebSession class is
|
73
|
+
* WebSession class is supported in a hacky manner, as it uses 'initialize' as
|
74
|
+
an API call which is a ruby reserved word. An underscore is hence prepended to
|
75
|
+
avoid the issue, so WebSession._initialize can be used to create a WebSession.
|
76
|
+
* Savon 1 required jumping the same hoops repetitively to extract the class, so
|
77
|
+
.to_class was extended to Savon::SOAP::Response .
|
62
78
|
|
63
79
|
## Contributing to vindicia-api
|
64
|
-
|
80
|
+
|
65
81
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
66
82
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
67
83
|
* Fork the project
|
@@ -72,4 +88,4 @@ Vindicia::AutoBill.fetch_by_account(:account => { :merchantAccountId => id }
|
|
72
88
|
|
73
89
|
## Copyright
|
74
90
|
|
75
|
-
Copyright (c) 2011-
|
91
|
+
Copyright (c) 2011-2014 Agora Games. See LICENSE.txt for further details.
|
data/lib/vindicia-api.rb
CHANGED
data/lib/vindicia/config.rb
CHANGED
@@ -25,7 +25,7 @@ module Vindicia
|
|
25
25
|
:symantec=>[:add_auto_bill_item, :cancel_auto_bill, :cancel_pending_ar_txns, :delay_bill, :dispute_bill, :refund_ab_txns, :update_abs_account, :update_ab_product, :update_bp, :update_bp_and_catch_up_billing, :validate_bp, :fetch_b_ps_by_customer_guid, :lookup_transaction, :disable_billing_profile, :fetch_captured_transactions, :report_order_exception],
|
26
26
|
:token=>[:update, :fetch],
|
27
27
|
:transaction=>[:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_search_page, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth],
|
28
|
-
:web_session=>[:
|
28
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
29
29
|
},
|
30
30
|
"3.6" => {
|
31
31
|
:account=>[:update, :stop_auto_billing, :update_payment_method, :fetch_by_merchant_account_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_payment_method, :token_balance, :token_transaction, :increment_tokens, :decrement_tokens, :transfer, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :add_children, :remove_children, :fetch_family, :transfer_credit],
|
@@ -49,8 +49,7 @@ module Vindicia
|
|
49
49
|
:symantec=>[:add_auto_bill_item, :cancel_auto_bill, :cancel_pending_ar_txns, :delay_bill, :dispute_bill, :refund_ab_txns, :update_abs_account, :update_ab_product, :update_bp, :update_bp_and_catch_up_billing, :validate_bp, :fetch_b_ps_by_customer_guid, :lookup_transaction, :disable_billing_profile, :fetch_captured_transactions, :report_order_exception],
|
50
50
|
:token=>[:update, :fetch],
|
51
51
|
:transaction=>[:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_search_page, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth],
|
52
|
-
|
53
|
-
:web_session=>[:finalize, :fetch_by_vid]
|
52
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
54
53
|
},
|
55
54
|
"3.7" => {
|
56
55
|
:account => [:update, :stop_auto_billing, :update_payment_method, :fetch_by_merchant_account_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_payment_method, :token_balance, :token_transaction, :increment_tokens, :decrement_tokens, :transfer, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :add_children, :remove_children, :fetch_family, :transfer_credit, :make_payment, :reverse_payment, :is_entitled, :grant_entitlement, :revoke_entitlement, :extend_entitlement_to_date, :extend_entitlement_by_interval],
|
@@ -74,8 +73,7 @@ module Vindicia
|
|
74
73
|
:symantec => [:add_auto_bill_item, :cancel_auto_bill, :cancel_pending_ar_txns, :delay_bill, :dispute_bill, :refund_ab_txns, :update_abs_account, :update_ab_product, :update_bp, :update_bp_and_catch_up_billing, :validate_bp, :fetch_b_ps_by_customer_guid, :lookup_transaction, :disable_billing_profile, :fetch_captured_transactions, :report_order_exception],
|
75
74
|
:token => [:update, :fetch],
|
76
75
|
:transaction => [:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_search_page, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth],
|
77
|
-
|
78
|
-
:web_session=> [:finalize, :fetch_by_vid]
|
76
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
79
77
|
},
|
80
78
|
"3.8" => {
|
81
79
|
:account => [:update, :stop_auto_billing, :update_payment_method, :fetch_by_merchant_account_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_payment_method, :token_balance, :token_transaction, :increment_tokens, :decrement_tokens, :transfer, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :add_children, :remove_children, :fetch_family, :transfer_credit, :make_payment, :reverse_payment, :is_entitled, :grant_entitlement, :revoke_entitlement, :extend_entitlement_to_date, :extend_entitlement_by_interval],
|
@@ -100,8 +98,7 @@ module Vindicia
|
|
100
98
|
:symantec => [:add_auto_bill_item, :cancel_auto_bill, :cancel_pending_ar_txns, :delay_bill, :dispute_bill, :refund_ab_txns, :update_abs_account, :update_ab_product, :update_bp, :update_bp_and_catch_up_billing, :validate_bp, :fetch_b_ps_by_customer_guid, :lookup_transaction, :disable_billing_profile, :fetch_captured_transactions, :report_order_exception],
|
101
99
|
:token => [:update, :fetch],
|
102
100
|
:transaction => [:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_search_page, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth],
|
103
|
-
|
104
|
-
:web_session=> [:finalize, :fetch_by_vid]
|
101
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
105
102
|
},
|
106
103
|
"3.9" => {
|
107
104
|
:account => [:update, :stop_auto_billing, :update_payment_method, :fetch_by_merchant_account_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_payment_method, :token_balance, :token_transaction, :increment_tokens, :decrement_tokens, :transfer, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :fetch_all_credit_history, :add_children, :remove_children, :fetch_family, :transfer_credit, :make_payment, :reverse_payment, :is_entitled, :grant_entitlement, :revoke_entitlement, :extend_entitlement_to_date, :extend_entitlement_by_interval],
|
@@ -126,8 +123,7 @@ module Vindicia
|
|
126
123
|
:symantec => [:add_auto_bill_item, :cancel_auto_bill, :cancel_pending_ar_txns, :delay_bill, :dispute_bill, :refund_ab_txns, :update_abs_account, :update_ab_product, :update_bp, :update_bp_and_catch_up_billing, :validate_bp, :fetch_b_ps_by_customer_guid, :lookup_transaction, :disable_billing_profile, :fetch_captured_transactions, :report_order_exception],
|
127
124
|
:token => [:update, :fetch],
|
128
125
|
:transaction => [:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_search_page, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth],
|
129
|
-
|
130
|
-
:web_session=> [:finalize, :fetch_by_vid]
|
126
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
131
127
|
},
|
132
128
|
"4.0" => {
|
133
129
|
:account => [:update, :stop_auto_billing, :update_payment_method, :fetch_by_merchant_account_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_payment_method, :token_balance, :token_transaction, :increment_tokens, :decrement_tokens, :transfer, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :fetch_all_credit_history, :add_children, :remove_children, :fetch_family, :transfer_credit, :make_payment, :reverse_payment, :is_entitled, :grant_entitlement, :revoke_entitlement, :extend_entitlement_to_date, :extend_entitlement_by_interval],
|
@@ -151,8 +147,31 @@ module Vindicia
|
|
151
147
|
:refund => [:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
152
148
|
:token => [:update, :fetch],
|
153
149
|
:transaction => [:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_search_page, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth, :finalize_boku_auth_capture],
|
154
|
-
|
155
|
-
|
150
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
151
|
+
},
|
152
|
+
"4.2" => {
|
153
|
+
:account => [:update, :stop_auto_billing, :update_payment_method, :fetch_by_merchant_account_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_payment_method, :token_balance, :token_transaction, :increment_tokens, :decrement_tokens, :transfer, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :fetch_all_credit_history, :add_children, :remove_children, :fetch_family, :transfer_credit, :make_payment, :reverse_payment, :is_entitled, :grant_entitlement, :revoke_entitlement, :extend_entitlement_to_date, :extend_entitlement_by_interval],
|
154
|
+
:activity => [:record],
|
155
|
+
:address => [:update, :fetch_by_vid],
|
156
|
+
:all_data_types => [:get_vindicia],
|
157
|
+
:auto_bill => [:update, :upgrade, :add_campaign, :fetch_upgrade_history_by_merchant_auto_bill_id, :fetch_upgrade_history_by_vid, :cancel, :delay_billing_to_date, :delay_billing_by_days, :change_billing_day_of_month, :fetch_by_account_and_product, :fetch_by_merchant_auto_bill_id, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_email, :fetch_by_account, :fetch_future_rebills, :fetch_delta_since, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :fetch_all_credit_history, :finalize_pay_pal_auth, :finalize_customer_action, :add_product, :remove_product, :add_charge, :make_payment, :reverse_payment, :fetch_invoice, :fetch_invoice_numbers, :write_off_invoice, :fetch_all_in_season, :fetch_all_off_season, :fetch_remaining_payment_details, :fetch_daily_invoice_billings],
|
158
|
+
:billing_plan => [:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id, :fetch_all_in_season, :fetch_all_off_season],
|
159
|
+
:campaign => [:generate_coupon_codes, :retrieve_coupon_codes, :validate_code, :activate_code, :fetch_all_campaigns, :fetch_by_campaign_id, :fetch_by_vid, :activate_campaign, :deactivate_campaign, :cancel_campaign, :mark_all_coupons_used, :update_campaign, :create_campaign, :clone_campaign],
|
160
|
+
:chargeback => [:update, :fetch_by_vid, :fetch_by_account, :fetch_by_case_number, :fetch_by_reference_number, :fetch_by_status, :fetch_by_status_since, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :report],
|
161
|
+
:diagnostic => [:get_hello, :put_hello, :echo_string, :echo_string_by_proxy, :get_some_mock_transactions, :put_some_mock_transactions, :echo_boolean, :echo_date_time, :echo_mock_activity_fulfillment, :useless_use_of_diagnostic_object],
|
162
|
+
:electronic_signature => [:sign, :get_signature_block],
|
163
|
+
:email_template => [:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
164
|
+
:entitlement => [:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
165
|
+
:gift_card => [:status_inquiry, :reverse],
|
166
|
+
:name_value_pair => [:fetch_name_value_names, :fetch_name_value_types],
|
167
|
+
:payment_method => [:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
168
|
+
:payment_provider => [:fetch_by_name, :data_request],
|
169
|
+
:product => [:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
170
|
+
:rate_plan => [:update, :fetch_by_merchant_rate_plan_id, :fetch_by_vid, :record_event, :reverse_event, :deduct_event, :fetch_unbilled_rated_units_total, :fetch_unbilled_events, :fetch_events, :fetch_event_by_id, :fetch_event_by_vid, :fetch_all],
|
171
|
+
:refund => [:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
172
|
+
:token => [:update, :fetch],
|
173
|
+
:transaction => [:fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_transaction_id, :fetch_delta_since, :fetch_delta, :fetch_by_autobill, :fetch_by_payment_method, :auth, :calculate_sales_tax, :capture, :cancel, :auth_capture, :report, :score, :finalize_pay_pal_auth, :finalize_boku_auth_capture, :finalize_customer_action, :address_and_sales_tax_from_pay_pal_order],
|
174
|
+
:web_session=>[:_initialize, :finalize, :fetch_by_vid]
|
156
175
|
}
|
157
176
|
}
|
158
177
|
|
data/lib/vindicia/model.rb
CHANGED
@@ -44,11 +44,12 @@ module Vindicia
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def define_class_action(action)
|
47
|
+
escaped_action = !action.to_s.start_with?('_') ? action : action[1..-1] #chomp leading _, if present
|
47
48
|
class_action_module.module_eval <<-CODE
|
48
49
|
def #{action.to_s.underscore}(body = {}, &block)
|
49
|
-
client.request :tns, #{
|
50
|
+
client.request :tns, #{escaped_action.inspect} do
|
50
51
|
soap.namespaces["xmlns:tns"] = vindicia_target_namespace
|
51
|
-
http.headers["SOAPAction"] = vindicia_soap_action('#{
|
52
|
+
http.headers["SOAPAction"] = vindicia_soap_action('#{escaped_action}')
|
52
53
|
soap.body = {
|
53
54
|
:auth => vindicia_auth_credentials
|
54
55
|
}.merge(body)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Savon
|
2
|
+
module SOAP
|
3
|
+
class ResponseError < StandardError
|
4
|
+
end
|
5
|
+
|
6
|
+
class Response
|
7
|
+
def to_class(opts = {})
|
8
|
+
return if !success?
|
9
|
+
klass = to_hash
|
10
|
+
# drill down to envelope
|
11
|
+
klass = klass[klass.keys[0]]
|
12
|
+
|
13
|
+
status_code = klass[:return][:return_code].to_i
|
14
|
+
if status_code != 200
|
15
|
+
if opts[:raise_on_error]
|
16
|
+
raise ResponseError.new("Soap Error: #{klass[:return][:return_string]}")
|
17
|
+
end
|
18
|
+
return
|
19
|
+
end
|
20
|
+
|
21
|
+
# drill down to payload, [0] is return, [1] is payload, [2] is xmlns
|
22
|
+
klass[klass.keys[1]]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/vindicia/version.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://soap.prodtest.sj.vindicia.com/soap.pl
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
9
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://soap.vindicia.com/v3_6/WebSession"
|
10
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:initialize><auth><login>your_login</login><password>your_password</password><version>3.6</version></auth><ipAddress>124.23.210.175</ipAddress><method>AutoBill_Update</method><returnUrl>https://merchant.com/subscribe/success.php</returnUrl><errorUrl>https://merchant.com/subscribe/failed.php</errorUrl><privatePormValues><name>Account_VID</name><value>36c8de2cb74b2c2b08b259cf231ac8d90d1bb3b8</value></privatePormValues><privatePormValues><name>Product_merchantProductId</name><value>StartWars
|
11
|
+
II</value></privatePormValues><privatePormValues><name>vin_BillingPlan_merchantBillingPlanId</name><value>GoldAccess2010,
|
12
|
+
PlatinumAccess2010</value></privatePormValues><methodParamValues><name>AutoBill_Update_minChargebackProbability</name><value>80</value></methodParamValues></tns:initialize></env:Body></env:Envelope>
|
13
|
+
headers:
|
14
|
+
Pragma:
|
15
|
+
- no-cache
|
16
|
+
Soapaction:
|
17
|
+
- ! '"http://soap.vindicia.com/v3_6/WebSession#initialize"'
|
18
|
+
Content-Type:
|
19
|
+
- text/xml;charset=UTF-8
|
20
|
+
Content-Length:
|
21
|
+
- '1086'
|
22
|
+
Accept:
|
23
|
+
- ! '*/*'
|
24
|
+
User-Agent:
|
25
|
+
- Ruby
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 200
|
29
|
+
message: OK
|
30
|
+
headers:
|
31
|
+
Date:
|
32
|
+
- Fri, 04 Apr 2014 21:58:50 GMT
|
33
|
+
Server:
|
34
|
+
- Apache/2.2.15 (CentOS) mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_apreq2-20090110/2.8.0
|
35
|
+
mod_perl/2.0.4 Perl/v5.10.1
|
36
|
+
Content-Length:
|
37
|
+
- '866'
|
38
|
+
Content-Type:
|
39
|
+
- text/xml; charset=utf-8
|
40
|
+
Soapserver:
|
41
|
+
- SOAP::Lite/Perl/0.710.10
|
42
|
+
Connection:
|
43
|
+
- close
|
44
|
+
body:
|
45
|
+
encoding: US-ASCII
|
46
|
+
string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soap:Envelope \n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
|
47
|
+
\n xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" \n xmlns:vin=\"http://soap.vindicia.com/v3_6/Vindicia\"
|
48
|
+
\n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"
|
49
|
+
\n xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soap:Body>\n
|
50
|
+
\ <initializeResponse xmlns=\"http://soap.vindicia.com/v3_6/WebSession\">\n
|
51
|
+
\ <return xmlns=\"\" xsi:type=\"vin:Return\">\n <returnCode xsi:type=\"vin:ReturnCode\">403</returnCode>\n\n
|
52
|
+
\ <soapId xsi:type=\"xsd:string\">d7cf030773898b759e5c025dffa90498951a2405</soapId>\n\n
|
53
|
+
\ <returnString xsi:type=\"xsd:string\">Permission denied to domain
|
54
|
+
\"soap\"</returnString>\n </return>\n </initializeResponse>\n </soap:Body>\n</soap:Envelope>\n"
|
55
|
+
http_version:
|
56
|
+
recorded_at: Fri, 04 Apr 2014 21:58:50 GMT
|
57
|
+
recorded_with: VCR 2.9.0
|
data/test/helper.rb
CHANGED
@@ -17,4 +17,17 @@ require 'vindicia-api'
|
|
17
17
|
class Test::Unit::TestCase
|
18
18
|
end
|
19
19
|
|
20
|
-
require 'mocha'
|
20
|
+
require 'mocha/setup'
|
21
|
+
require 'webmock/test_unit'
|
22
|
+
require 'vcr'
|
23
|
+
|
24
|
+
VCR.configure do |c|
|
25
|
+
c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
|
26
|
+
c.hook_into :webmock
|
27
|
+
end
|
28
|
+
|
29
|
+
Savon.configure do |config|
|
30
|
+
config.log = false
|
31
|
+
end
|
32
|
+
|
33
|
+
HTTPI.log = false
|
data/test/vindicia/model_test.rb
CHANGED
@@ -22,7 +22,7 @@ class Vindicia::ModelTest < Test::Unit::TestCase
|
|
22
22
|
Vindicia.configure do |config|
|
23
23
|
config.api_version = @good_api_version
|
24
24
|
config.login = 'your_login'
|
25
|
-
config.password = 'your_password'
|
25
|
+
config.password = 'your_password'
|
26
26
|
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
27
27
|
config.namespace = 'http://soap.vindicia.com'
|
28
28
|
end
|
@@ -55,4 +55,35 @@ class Vindicia::ModelTest < Test::Unit::TestCase
|
|
55
55
|
assert resp.to_hash
|
56
56
|
assert_equal '500', resp[:update_response][:return][:return_code]
|
57
57
|
end
|
58
|
+
|
59
|
+
def test_should_support_ruby_keyword_actions
|
60
|
+
# this feature is used by WebSession, to support the initialize action, no huge rework, just escape codes
|
61
|
+
assert Vindicia.config.is_configured?
|
62
|
+
|
63
|
+
web_session = Vindicia::WebSession
|
64
|
+
|
65
|
+
# method is available to be called
|
66
|
+
web_session_methods = web_session.methods
|
67
|
+
assert web_session_methods.include?(:_initialize)
|
68
|
+
|
69
|
+
# method yields an action that is escaped
|
70
|
+
VCR.use_cassette('web_session#_initialize') do
|
71
|
+
resp = web_session._initialize(:ipAddress => '124.23.210.175',
|
72
|
+
:method => 'AutoBill_Update',
|
73
|
+
:returnUrl => 'https://merchant.com/subscribe/success.php',
|
74
|
+
:errorUrl => 'https://merchant.com/subscribe/failed.php',
|
75
|
+
:privatePormValues => [
|
76
|
+
{ :name => 'Account_VID', :value => '36c8de2cb74b2c2b08b259cf231ac8d90d1bb3b8' },
|
77
|
+
{ :name => 'Product_merchantProductId', :value => 'StartWars II' },
|
78
|
+
{ :name => 'vin_BillingPlan_merchantBillingPlanId', :value => 'GoldAccess2010, PlatinumAccess2010' }
|
79
|
+
],
|
80
|
+
:methodParamValues => [
|
81
|
+
{ :name => 'AutoBill_Update_minChargebackProbability', :value => '80' }
|
82
|
+
])
|
83
|
+
assert_not_nil resp
|
84
|
+
assert resp.to_hash
|
85
|
+
# the fact that the response is enveloped in the escaped form of the action is evidence that the action was properly mapped
|
86
|
+
assert_equal '403', resp[:initialize_response][:return][:return_code]
|
87
|
+
end
|
88
|
+
end
|
58
89
|
end
|
data/vindicia-api.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.homepage = "https://github.com/agoragames/vindicia-api"
|
11
11
|
gem.summary = %q{A wrapper for creating queries to the Vindicia CashBox API}
|
12
12
|
gem.description = %q{A wrapper for creating queries to the Vindicia CashBox API}
|
13
|
+
gem.license = 'MIT'
|
13
14
|
|
14
15
|
gem.rubyforge_project = "vindicia-api"
|
15
16
|
|
@@ -18,9 +19,11 @@ Gem::Specification.new do |gem|
|
|
18
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
20
|
gem.require_paths = ["lib"]
|
20
21
|
|
21
|
-
gem.add_dependency('savon')
|
22
|
+
gem.add_dependency('savon', '~> 1.2.0')
|
22
23
|
gem.add_dependency('activesupport')
|
23
24
|
|
24
25
|
gem.add_development_dependency('rake')
|
25
26
|
gem.add_development_dependency('mocha')
|
27
|
+
gem.add_development_dependency('webmock')
|
28
|
+
gem.add_development_dependency('vcr')
|
26
29
|
end
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vindicia-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tom Quackenbush
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: savon
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 1.2.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: activesupport
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: mocha
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,34 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
93
|
requirements:
|
75
94
|
- - ! '>='
|
76
95
|
- !ruby/object:Gem::Version
|
@@ -93,40 +112,45 @@ files:
|
|
93
112
|
- lib/vindicia-api.rb
|
94
113
|
- lib/vindicia/config.rb
|
95
114
|
- lib/vindicia/model.rb
|
115
|
+
- lib/vindicia/savon.rb
|
96
116
|
- lib/vindicia/version.rb
|
117
|
+
- test/fixtures/vcr_cassettes/web_session__initialize.yml
|
97
118
|
- test/helper.rb
|
98
119
|
- test/singleton_reset.rb
|
99
120
|
- test/test_vindicia-api.rb
|
100
121
|
- test/vindicia/config_test.rb
|
101
122
|
- test/vindicia/model_test.rb
|
123
|
+
- test/vindicia/version_test.rb
|
102
124
|
- vindicia-api.gemspec
|
103
125
|
homepage: https://github.com/agoragames/vindicia-api
|
104
|
-
licenses:
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
105
129
|
post_install_message:
|
106
130
|
rdoc_options: []
|
107
131
|
require_paths:
|
108
132
|
- lib
|
109
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
134
|
requirements:
|
112
135
|
- - ! '>='
|
113
136
|
- !ruby/object:Gem::Version
|
114
137
|
version: '0'
|
115
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
-
none: false
|
117
139
|
requirements:
|
118
140
|
- - ! '>='
|
119
141
|
- !ruby/object:Gem::Version
|
120
142
|
version: '0'
|
121
143
|
requirements: []
|
122
144
|
rubyforge_project: vindicia-api
|
123
|
-
rubygems_version:
|
145
|
+
rubygems_version: 2.2.2
|
124
146
|
signing_key:
|
125
|
-
specification_version:
|
147
|
+
specification_version: 4
|
126
148
|
summary: A wrapper for creating queries to the Vindicia CashBox API
|
127
149
|
test_files:
|
150
|
+
- test/fixtures/vcr_cassettes/web_session__initialize.yml
|
128
151
|
- test/helper.rb
|
129
152
|
- test/singleton_reset.rb
|
130
153
|
- test/test_vindicia-api.rb
|
131
154
|
- test/vindicia/config_test.rb
|
132
155
|
- test/vindicia/model_test.rb
|
156
|
+
- test/vindicia/version_test.rb
|