vindicia-api 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +9 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +20 -0
- data/README.md +75 -0
- data/Rakefile +11 -0
- data/lib/vindicia-api.rb +2 -0
- data/lib/vindicia/config.rb +217 -0
- data/lib/vindicia/model.rb +114 -0
- data/lib/vindicia/util.rb +8 -0
- data/lib/vindicia/version.rb +3 -0
- data/test/helper.rb +20 -0
- data/test/singleton_reset.rb +16 -0
- data/test/test_vindicia-api.rb +7 -0
- data/test/vindicia/config_test.rb +95 -0
- data/test/vindicia/model_test.rb +59 -0
- data/test/vindicia/util_test.rb +8 -0
- data/vindicia-api.gemspec +25 -0
- metadata +119 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create ruby-1.9.3@vindicia_api_gem
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011-2012 Agora Games
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# vindicia-api
|
2
|
+
|
3
|
+
A wrapper for making calls to Vindicia's CashBox SOAP API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'vindicia-api'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ gem install vindicia-api
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Add something like the following to your environments or in an initializer:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
Vindicia.configure do |config|
|
31
|
+
config.api_version = '3.6'
|
32
|
+
config.login = 'your_login'
|
33
|
+
config.password = 'your_password'
|
34
|
+
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
35
|
+
config.namespace = 'http://soap.vindicia.com'
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
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
|
+
|
41
|
+
Current supported API versions are '3.5' and '3.6'.
|
42
|
+
|
43
|
+
Available Vindicia endpoints are:
|
44
|
+
|
45
|
+
* Development: "https://soap.prodtest.sj.vindicia.com/soap.pl"
|
46
|
+
* Staging: "https://soap.staging.sj.vindicia.com"
|
47
|
+
* Production: "https://soap.vindicia.com/soap.pl"
|
48
|
+
|
49
|
+
After the Vindicia API has been configured, all Vindicia classes for the respective API version will be available under the `Vindicia::*` namespace.
|
50
|
+
|
51
|
+
Parameters are passed as hashes, for example:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Vindicia::AutoBill.fetch_by_account(:account => { :merchantAccountId => id }
|
55
|
+
```
|
56
|
+
|
57
|
+
* Note that parameters must be specified in the same order as documented in Vindicia's developer documentation.
|
58
|
+
|
59
|
+
## Bugs
|
60
|
+
|
61
|
+
* WebSession class is unsupported as it uses 'initialize' as an API call which is a ruby reserved word
|
62
|
+
|
63
|
+
## Contributing to vindicia-api
|
64
|
+
|
65
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
66
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
67
|
+
* Fork the project
|
68
|
+
* Start a feature/bugfix branch
|
69
|
+
* Commit and push until you are happy with your contribution
|
70
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
71
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
72
|
+
|
73
|
+
## Copyright
|
74
|
+
|
75
|
+
Copyright (c) 2011-2012 Agora Games. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
data/lib/vindicia-api.rb
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require 'vindicia/util'
|
3
|
+
|
4
|
+
module Vindicia
|
5
|
+
|
6
|
+
API_CLASSES = {
|
7
|
+
"3.5" => {
|
8
|
+
: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],
|
9
|
+
:activity=>[:record],
|
10
|
+
:address=>[:update, :fetch_by_vid],
|
11
|
+
:all_data_types=>[:get_vindicia],
|
12
|
+
:all_symc_data_types=>[:get_vindicia],
|
13
|
+
:auto_bill=>[:update, :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, :future_rebills, :fetch_delta_since, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :finalize_pay_pal_auth],
|
14
|
+
:billing_plan=>[:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id],
|
15
|
+
: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],
|
16
|
+
: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],
|
17
|
+
:electronic_signature=>[:sign, :get_signature_block],
|
18
|
+
:email_template=>[:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
19
|
+
:entitlement=>[:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
20
|
+
:gift_card=>[:status_inquiry, :reverse],
|
21
|
+
:metric_statistics=>[:report],
|
22
|
+
:payment_method=>[:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
23
|
+
:payment_provider=>[:update, :fetch_by_vid],
|
24
|
+
:product=>[:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
25
|
+
:refund=>[:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
26
|
+
: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],
|
27
|
+
:token=>[:update, :fetch],
|
28
|
+
: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],
|
29
|
+
:web_session=>[:initialize, :finalize, :fetch_by_vid]
|
30
|
+
},
|
31
|
+
"3.6" => {
|
32
|
+
: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],
|
33
|
+
:activity=>[:record],
|
34
|
+
:address=>[:update, :fetch_by_vid],
|
35
|
+
:all_data_types=>[:get_vindicia],
|
36
|
+
:all_symc_data_types=>[:get_vindicia],
|
37
|
+
:auto_bill=>[:update, :upgrade, :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, :future_rebills, :fetch_delta_since, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :finalize_pay_pal_auth],
|
38
|
+
:billing_plan=>[:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id],
|
39
|
+
: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],
|
40
|
+
: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],
|
41
|
+
:electronic_signature=>[:sign, :get_signature_block],
|
42
|
+
:email_template=>[:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
43
|
+
:entitlement=>[:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
44
|
+
:gift_card=>[:status_inquiry, :reverse],
|
45
|
+
:metric_statistics=>[:report],
|
46
|
+
:payment_method=>[:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
47
|
+
:payment_provider=>[:update, :fetch_by_vid],
|
48
|
+
:product=>[:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
49
|
+
:refund=>[:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
50
|
+
: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],
|
51
|
+
:token=>[:update, :fetch],
|
52
|
+
: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],
|
53
|
+
# :web_session=>[:initialize, :finalize, :fetch_by_vid] # initialize is a ruby reserved word. need to refactor to get this one to work =( @TQ
|
54
|
+
:web_session=>[:finalize, :fetch_by_vid]
|
55
|
+
},
|
56
|
+
"3.7" => {
|
57
|
+
: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],
|
58
|
+
:activity => [:record],
|
59
|
+
:address => [:update, :fetch_by_vid],
|
60
|
+
:all_data_types => [:get_vindicia],
|
61
|
+
:all_symc_data_types => [:get_vindicia],
|
62
|
+
:auto_bill => [:update, :upgrade, :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, :future_rebills, :fetch_delta_since, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :finalize_pay_pal_auth, :add_product, :remove_product, :add_charge, :make_payment, :reverse_payment, :fetch_invoice, :fetch_invoice_numbers, :write_off_invoice],
|
63
|
+
:billing_plan => [:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id],
|
64
|
+
: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],
|
65
|
+
: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],
|
66
|
+
:electronic_signature => [:sign, :get_signature_block],
|
67
|
+
:email_template => [:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
68
|
+
:entitlement => [:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
69
|
+
:gift_card => [:status_inquiry, :reverse],
|
70
|
+
:metric_statistics => [:report],
|
71
|
+
:payment_method => [:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
72
|
+
:payment_provider => [:update, :fetch_by_vid],
|
73
|
+
:product => [:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
74
|
+
:refund => [:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
75
|
+
: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],
|
76
|
+
:token => [:update, :fetch],
|
77
|
+
: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],
|
78
|
+
# :web_session=>[:initialize, :finalize, :fetch_by_vid] # initialize is a ruby reserved word. need to refactor to get this one to work =( @TQ
|
79
|
+
:web_session=> [:finalize, :fetch_by_vid]
|
80
|
+
},
|
81
|
+
"3.8" => {
|
82
|
+
: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],
|
83
|
+
:activity => [:record],
|
84
|
+
:address => [:update, :fetch_by_vid],
|
85
|
+
:all_data_types => [:get_vindicia],
|
86
|
+
:all_symc_data_types => [:get_vindicia],
|
87
|
+
: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, :future_rebills, :fetch_delta_since, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :finalize_pay_pal_auth, :add_product, :remove_product, :add_campaign_to_product, :add_charge, :make_payment, :reverse_payment, :fetch_invoice, :fetch_invoice_numbers, :write_off_invoice],
|
88
|
+
:billing_plan => [:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id],
|
89
|
+
: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],
|
90
|
+
: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],
|
91
|
+
: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],
|
92
|
+
:electronic_signature => [:sign, :get_signature_block],
|
93
|
+
:email_template => [:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
94
|
+
:entitlement => [:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
95
|
+
:gift_card => [:status_inquiry, :reverse],
|
96
|
+
:metric_statistics => [:report],
|
97
|
+
:payment_method => [:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
98
|
+
:payment_provider => [:update, :fetch_by_vid],
|
99
|
+
:product => [:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
100
|
+
:refund => [:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
101
|
+
: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],
|
102
|
+
:token => [:update, :fetch],
|
103
|
+
: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],
|
104
|
+
# :web_session=>[:initialize, :finalize, :fetch_by_vid] # initialize is a ruby reserved word. need to refactor to get this one to work =( @TQ
|
105
|
+
:web_session=> [:finalize, :fetch_by_vid]
|
106
|
+
},
|
107
|
+
"3.9" => {
|
108
|
+
: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],
|
109
|
+
:activity => [:record],
|
110
|
+
:address => [:update, :fetch_by_vid],
|
111
|
+
:all_data_types => [:get_vindicia],
|
112
|
+
:all_symc_data_types => [:get_vindicia],
|
113
|
+
: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, :future_rebills, :fetch_delta_since, :redeem_gift_card, :grant_credit, :revoke_credit, :fetch_credit_history, :fetch_all_credit_history, :finalize_pay_pal_auth, :add_product, :remove_product, :add_campaign_to_product, :add_charge, :make_payment, :reverse_payment, :fetch_invoice, :fetch_invoice_numbers, :write_off_invoice],
|
114
|
+
:billing_plan => [:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id],
|
115
|
+
: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],
|
116
|
+
: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],
|
117
|
+
: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],
|
118
|
+
:electronic_signature => [:sign, :get_signature_block],
|
119
|
+
:email_template => [:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
120
|
+
:entitlement => [:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
121
|
+
:gift_card => [:status_inquiry, :reverse],
|
122
|
+
:name_value_pair => [:fetch_name_value_names, :fetch_name_value_types],
|
123
|
+
:payment_method => [:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
124
|
+
:payment_provider => [:update, :fetch_by_vid],
|
125
|
+
:product => [:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
126
|
+
:refund => [:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
127
|
+
: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],
|
128
|
+
:token => [:update, :fetch],
|
129
|
+
: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],
|
130
|
+
# :web_session=>[:initialize, :finalize, :fetch_by_vid] # initialize is a ruby reserved word. need to refactor to get this one to work =( @TQ
|
131
|
+
:web_session=> [:finalize, :fetch_by_vid]
|
132
|
+
},
|
133
|
+
"4.0" => {
|
134
|
+
: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],
|
135
|
+
:activity => [:record],
|
136
|
+
:address => [:update, :fetch_by_vid],
|
137
|
+
:all_data_types => [:get_vindicia],
|
138
|
+
: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, :add_product, :remove_product, :add_campaign_to_product, :add_charge, :make_payment, :reverse_payment, :fetch_invoice, :fetch_invoice_numbers, :write_off_invoice],
|
139
|
+
:billing_plan => [:update, :fetch_by_vid, :fetch_by_merchant_billing_plan_id, :fetch_by_billing_plan_status, :fetch_all, :fetch_by_merchant_entitlement_id],
|
140
|
+
: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],
|
141
|
+
: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],
|
142
|
+
: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],
|
143
|
+
:electronic_signature => [:sign, :get_signature_block],
|
144
|
+
:email_template => [:update, :fetch_by_vid, :fetch_by_product, :fetch_by_type, :fetch_by_type_and_version],
|
145
|
+
:entitlement => [:fetch_by_entitlement_id_and_account, :fetch_by_account, :fetch_delta_since],
|
146
|
+
:gift_card => [:status_inquiry, :reverse],
|
147
|
+
:name_value_pair => [:fetch_name_value_names, :fetch_name_value_types],
|
148
|
+
:payment_method => [:update, :fetch_by_vid, :fetch_by_web_session_vid, :fetch_by_account, :fetch_by_merchant_payment_method_id, :validate],
|
149
|
+
:payment_provider => [:fetch_by_name, :data_request],
|
150
|
+
:product => [:update, :fetch_by_vid, :fetch_by_merchant_product_id, :fetch_by_account, :fetch_all, :fetch_by_merchant_entitlement_id],
|
151
|
+
: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],
|
152
|
+
:refund => [:fetch_by_vid, :fetch_by_account, :fetch_by_transaction, :fetch_delta_since, :report, :perform],
|
153
|
+
:token => [:update, :fetch],
|
154
|
+
: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],
|
155
|
+
# :web_session=>[:initialize, :finalize, :fetch_by_vid] # initialize is a ruby reserved word. need to refactor to get this one to work =( @TQ
|
156
|
+
:web_session=> [:finalize, :fetch_by_vid]
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
class Configuration
|
161
|
+
include Singleton
|
162
|
+
|
163
|
+
attr_accessor :api_version, :login, :password, :endpoint, :namespace
|
164
|
+
|
165
|
+
def initialize
|
166
|
+
@@configured = false
|
167
|
+
end
|
168
|
+
|
169
|
+
def configured!
|
170
|
+
@@configured = true
|
171
|
+
end
|
172
|
+
|
173
|
+
def is_configured?
|
174
|
+
@@configured
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def self.config
|
179
|
+
Configuration.instance
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.configure
|
183
|
+
raise 'Vindicia-api gem has already been configured. Things might get hairy if we do this again with new values.' if config.is_configured?
|
184
|
+
yield config
|
185
|
+
if initialize!
|
186
|
+
config.configured!
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
private
|
191
|
+
|
192
|
+
def self.initialize!
|
193
|
+
return false unless API_CLASSES[config.api_version]
|
194
|
+
|
195
|
+
API_CLASSES[config.api_version].each_key do |vindicia_klass|
|
196
|
+
const_set(Vindicia::Util.camelize(vindicia_klass.to_s),
|
197
|
+
Class.new do
|
198
|
+
include Vindicia::Model
|
199
|
+
|
200
|
+
client do
|
201
|
+
http.headers["Pragma"] = "no-cache"
|
202
|
+
http.auth.ssl.verify_mode = :none # TODO set based on environment
|
203
|
+
end
|
204
|
+
|
205
|
+
api_version Vindicia.config.api_version
|
206
|
+
login Vindicia.config.login
|
207
|
+
password Vindicia.config.password
|
208
|
+
|
209
|
+
endpoint Vindicia.config.endpoint
|
210
|
+
namespace Vindicia.config.namespace
|
211
|
+
|
212
|
+
actions *API_CLASSES[Vindicia.config.api_version][vindicia_klass]
|
213
|
+
end
|
214
|
+
)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require "savon"
|
2
|
+
require "savon/core_ext/string"
|
3
|
+
|
4
|
+
module Vindicia
|
5
|
+
|
6
|
+
# = Vindicia::Model
|
7
|
+
#
|
8
|
+
# Model for SOAP service oriented applications.
|
9
|
+
module Model
|
10
|
+
|
11
|
+
VERSION = "0.0.0"
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
def self.extend_object(base)
|
16
|
+
super
|
17
|
+
base.init_vindicia_model
|
18
|
+
end
|
19
|
+
|
20
|
+
def init_vindicia_model
|
21
|
+
class_action_module
|
22
|
+
end
|
23
|
+
|
24
|
+
def client(&block)
|
25
|
+
@client ||= Savon::Client.new &block
|
26
|
+
end
|
27
|
+
|
28
|
+
def endpoint(uri)
|
29
|
+
client.wsdl.endpoint = uri
|
30
|
+
end
|
31
|
+
|
32
|
+
def namespace(uri)
|
33
|
+
client.wsdl.namespace = uri
|
34
|
+
end
|
35
|
+
|
36
|
+
# Accepts one or more SOAP actions and generates both class and instance methods named
|
37
|
+
# after the given actions. Each generated method accepts an optional SOAP body Hash and
|
38
|
+
# a block to be passed to <tt>Savon::Client#request</tt> and executes a SOAP request.
|
39
|
+
def actions(*actions)
|
40
|
+
actions.each do |action|
|
41
|
+
define_class_action action
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def define_class_action(action)
|
48
|
+
class_action_module.module_eval <<-CODE
|
49
|
+
def #{action.to_s.snakecase}(body = {}, &block)
|
50
|
+
client.request :tns, #{action.inspect} do
|
51
|
+
soap.namespaces["xmlns:tns"] = vindicia_target_namespace
|
52
|
+
http.headers["SOAPAction"] = vindicia_soap_action('#{action}')
|
53
|
+
soap.body = {
|
54
|
+
:auth => vindicia_auth_credentials
|
55
|
+
}.merge(body)
|
56
|
+
block.call(soap, wsdl, http, wsse) if block
|
57
|
+
end
|
58
|
+
rescue Exception => e
|
59
|
+
rescue_exception(:#{action.to_s.snakecase}, e)
|
60
|
+
end
|
61
|
+
CODE
|
62
|
+
end
|
63
|
+
|
64
|
+
def api_version(version)
|
65
|
+
@api_version = version
|
66
|
+
end
|
67
|
+
|
68
|
+
def login(login)
|
69
|
+
@login = login
|
70
|
+
end
|
71
|
+
|
72
|
+
def password(password)
|
73
|
+
@password = password
|
74
|
+
end
|
75
|
+
|
76
|
+
def vindicia_class_name
|
77
|
+
name.demodulize
|
78
|
+
end
|
79
|
+
|
80
|
+
def vindicia_auth_credentials
|
81
|
+
{:login => @login, :password => @password, :version => @api_version}
|
82
|
+
end
|
83
|
+
|
84
|
+
def vindicia_target_namespace
|
85
|
+
"#{client.wsdl.namespace}/v#{underscoreize_periods(@api_version)}/#{vindicia_class_name}"
|
86
|
+
end
|
87
|
+
|
88
|
+
def underscoreize_periods(target)
|
89
|
+
target.gsub(/\./, '_')
|
90
|
+
end
|
91
|
+
|
92
|
+
def vindicia_soap_action(action)
|
93
|
+
%{"#{vindicia_target_namespace}##{action.to_s.lower_camelcase}"}
|
94
|
+
end
|
95
|
+
|
96
|
+
def rescue_exception(action, error)
|
97
|
+
{ "#{action}_response".to_sym => { :return =>
|
98
|
+
{ :return_code => '500', :return_string => "Error contacting Vindicia: #{error.message}" }
|
99
|
+
} }
|
100
|
+
end
|
101
|
+
|
102
|
+
def class_action_module
|
103
|
+
@class_action_module ||= Module.new do
|
104
|
+
# confused why this is needed
|
105
|
+
end.tap { |mod| extend mod }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.included(base)
|
110
|
+
base.extend ClassMethods
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'singleton_reset'
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
15
|
+
require 'vindicia-api'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'mocha'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# http://blog.ardes.com/2006/12/11/testing-singletons-with-ruby
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
class <<Singleton
|
5
|
+
def included_with_reset(klass)
|
6
|
+
included_without_reset(klass)
|
7
|
+
class <<klass
|
8
|
+
def reset_instance
|
9
|
+
Singleton.send :__init__, self
|
10
|
+
self
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
alias_method :included_without_reset, :included
|
15
|
+
alias_method :included, :included_with_reset
|
16
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'vindicia/util'
|
3
|
+
|
4
|
+
class Vindicia::ConfigTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
Vindicia.class_eval do
|
8
|
+
def self.clear_config
|
9
|
+
if Vindicia.config.is_configured?
|
10
|
+
Vindicia::API_CLASSES[Vindicia.config.api_version].each_key do |vindicia_klass|
|
11
|
+
Vindicia.send(:remove_const, Vindicia::Util.camelize(vindicia_klass.to_s).to_sym)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def teardown
|
19
|
+
Vindicia.clear_config
|
20
|
+
Vindicia::Configuration.reset_instance
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_should_not_configure_on_upsupported_api_version
|
24
|
+
assert !Vindicia.config.is_configured?
|
25
|
+
|
26
|
+
bad_api_version = '0.0'
|
27
|
+
assert !Vindicia::API_CLASSES.has_key?(bad_api_version)
|
28
|
+
|
29
|
+
assert_nothing_raised do
|
30
|
+
Vindicia.configure do |config|
|
31
|
+
config.api_version = bad_api_version
|
32
|
+
config.login = 'your_login'
|
33
|
+
config.password = 'your_password'
|
34
|
+
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
35
|
+
config.namespace = 'http://soap.vindicia.com'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
assert !Vindicia.config.is_configured?
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_should_raise_exception_on_reconfigure
|
43
|
+
good_api_version = '3.6'
|
44
|
+
assert Vindicia::API_CLASSES.has_key?(good_api_version)
|
45
|
+
assert !Vindicia.config.is_configured?
|
46
|
+
|
47
|
+
assert_nothing_raised do
|
48
|
+
Vindicia.configure do |config|
|
49
|
+
config.api_version = good_api_version
|
50
|
+
config.login = 'your_login'
|
51
|
+
config.password = 'your_password'
|
52
|
+
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
53
|
+
config.namespace = 'http://soap.vindicia.com'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
assert Vindicia.config.is_configured?
|
58
|
+
|
59
|
+
some_other_api_version = '3.5'
|
60
|
+
assert Vindicia::API_CLASSES.has_key?(some_other_api_version)
|
61
|
+
|
62
|
+
assert_raise RuntimeError do
|
63
|
+
Vindicia.configure do |config|
|
64
|
+
config.api_version = good_api_version
|
65
|
+
config.login = 'your_login'
|
66
|
+
config.password = 'your_password'
|
67
|
+
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
68
|
+
config.namespace = 'http://soap.vindicia.com'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_should_define_vindicia_classes_for_respective_api_version
|
74
|
+
good_api_version = '3.6'
|
75
|
+
assert Vindicia::API_CLASSES.has_key?(good_api_version)
|
76
|
+
assert !Vindicia.config.is_configured?
|
77
|
+
|
78
|
+
assert_nothing_raised do
|
79
|
+
Vindicia.configure do |config|
|
80
|
+
config.api_version = good_api_version
|
81
|
+
config.login = 'your_login'
|
82
|
+
config.password = 'your_password'
|
83
|
+
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
84
|
+
config.namespace = 'http://soap.vindicia.com'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
assert Vindicia.config.is_configured?
|
89
|
+
|
90
|
+
Vindicia::API_CLASSES[good_api_version].each_key do |vindicia_klass|
|
91
|
+
assert Vindicia.const_get(Vindicia::Util.camelize(vindicia_klass.to_s))
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'vindicia/util'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
class Vindicia::ModelTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
Vindicia.class_eval do
|
9
|
+
def self.clear_config
|
10
|
+
if Vindicia.config.is_configured?
|
11
|
+
Vindicia::API_CLASSES[Vindicia.config.api_version].each_key do |vindicia_klass|
|
12
|
+
Vindicia.send(:remove_const, Vindicia::Util.camelize(vindicia_klass.to_s).to_sym)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
@good_api_version = '3.6'
|
19
|
+
assert Vindicia::API_CLASSES.has_key?(@good_api_version)
|
20
|
+
assert !Vindicia.config.is_configured?
|
21
|
+
|
22
|
+
assert_nothing_raised do
|
23
|
+
Vindicia.configure do |config|
|
24
|
+
config.api_version = @good_api_version
|
25
|
+
config.login = 'your_login'
|
26
|
+
config.password = 'your_password'
|
27
|
+
config.endpoint = 'https://soap.prodtest.sj.vindicia.com/soap.pl'
|
28
|
+
config.namespace = 'http://soap.vindicia.com'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
assert Vindicia.config.is_configured?
|
32
|
+
end
|
33
|
+
|
34
|
+
def teardown
|
35
|
+
Vindicia.clear_config
|
36
|
+
Vindicia::Configuration.reset_instance
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_should_define_api_methods_of_respective_vindicia_class_for_respective_api_version
|
40
|
+
Vindicia::API_CLASSES[@good_api_version].each_key do |vindicia_klass_name|
|
41
|
+
|
42
|
+
vindicia_klass = Vindicia.const_get(Vindicia::Util.camelize(vindicia_klass_name.to_s))
|
43
|
+
|
44
|
+
Vindicia::API_CLASSES[@good_api_version][vindicia_klass_name].each do |api_method|
|
45
|
+
assert vindicia_klass.respond_to?(api_method)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_should_catch_exceptions_thrown_underneath_savon
|
51
|
+
Vindicia::AutoBill.client.expects(:request).once.raises(Timeout::Error)
|
52
|
+
|
53
|
+
resp = Vindicia::AutoBill.update({})
|
54
|
+
|
55
|
+
assert_not_nil resp
|
56
|
+
assert resp.to_hash
|
57
|
+
assert_equal '500', resp[:update_response][:return][:return_code]
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'vindicia/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "vindicia-api"
|
7
|
+
gem.version = Vindicia::VERSION
|
8
|
+
gem.authors = ["Tom Quackenbush"]
|
9
|
+
gem.email = ["tquackenbush@agoragames.com"]
|
10
|
+
gem.homepage = "https://github.com/agoragames/vindicia-api"
|
11
|
+
gem.summary = %q{A wrapper for creating queries to the Vindicia CashBox API}
|
12
|
+
gem.description = %q{A wrapper for creating queries to the Vindicia CashBox API}
|
13
|
+
|
14
|
+
gem.rubyforge_project = "vindicia-api"
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($\)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.add_dependency('savon')
|
22
|
+
|
23
|
+
gem.add_development_dependency('rake')
|
24
|
+
gem.add_development_dependency('mocha')
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vindicia-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tom Quackenbush
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: savon
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: mocha
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: A wrapper for creating queries to the Vindicia CashBox API
|
63
|
+
email:
|
64
|
+
- tquackenbush@agoragames.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .document
|
70
|
+
- .gitignore
|
71
|
+
- .rvmrc
|
72
|
+
- CHANGELOG.md
|
73
|
+
- Gemfile
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- lib/vindicia-api.rb
|
78
|
+
- lib/vindicia/config.rb
|
79
|
+
- lib/vindicia/model.rb
|
80
|
+
- lib/vindicia/util.rb
|
81
|
+
- lib/vindicia/version.rb
|
82
|
+
- test/helper.rb
|
83
|
+
- test/singleton_reset.rb
|
84
|
+
- test/test_vindicia-api.rb
|
85
|
+
- test/vindicia/config_test.rb
|
86
|
+
- test/vindicia/model_test.rb
|
87
|
+
- test/vindicia/util_test.rb
|
88
|
+
- vindicia-api.gemspec
|
89
|
+
homepage: https://github.com/agoragames/vindicia-api
|
90
|
+
licenses: []
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project: vindicia-api
|
109
|
+
rubygems_version: 1.8.24
|
110
|
+
signing_key:
|
111
|
+
specification_version: 3
|
112
|
+
summary: A wrapper for creating queries to the Vindicia CashBox API
|
113
|
+
test_files:
|
114
|
+
- test/helper.rb
|
115
|
+
- test/singleton_reset.rb
|
116
|
+
- test/test_vindicia-api.rb
|
117
|
+
- test/vindicia/config_test.rb
|
118
|
+
- test/vindicia/model_test.rb
|
119
|
+
- test/vindicia/util_test.rb
|