ecconnect_rails 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +5 -0
  4. data/Rakefile +29 -0
  5. data/app/controllers/ecconnect_rails/application_controller.rb +4 -0
  6. data/app/controllers/ecconnect_rails/base_controller.rb +170 -0
  7. data/app/controllers/ecconnect_rails/ecconnect_payments_controller.rb +4 -0
  8. data/app/helpers/ecconnect_rails/application_helper.rb +29 -0
  9. data/app/models/ecconnect_rails/ecconnect_payment.rb +202 -0
  10. data/app/views/ecconnect_rails/ecconnect_payments/failure.html.erb +0 -0
  11. data/app/views/ecconnect_rails/ecconnect_payments/new.html.erb +5 -0
  12. data/app/views/ecconnect_rails/ecconnect_payments/notify.html.erb +18 -0
  13. data/app/views/ecconnect_rails/ecconnect_payments/show.html.erb +1 -0
  14. data/app/views/ecconnect_rails/ecconnect_payments/success.html.erb +0 -0
  15. data/config/locales/ecconnect_rails_en.yml +59 -0
  16. data/config/routes.rb +9 -0
  17. data/lib/ecconnect_rails.rb +11 -0
  18. data/lib/ecconnect_rails/engine.rb +5 -0
  19. data/lib/ecconnect_rails/version.rb +3 -0
  20. data/lib/tasks/ecconnect_rails_tasks.rake +4 -0
  21. data/spec/certs/1753970.crt +16 -0
  22. data/spec/certs/1753970.pem +15 -0
  23. data/spec/certs/test-server.cert +16 -0
  24. data/spec/controllers/ecconnect_payments_controller_spec.rb +170 -0
  25. data/spec/dummy/Gemfile +5 -0
  26. data/spec/dummy/Gemfile.lock +106 -0
  27. data/spec/dummy/Rakefile +7 -0
  28. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  29. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  30. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  31. data/spec/dummy/app/controllers/ecconnect_payments_controller.rb +32 -0
  32. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  33. data/spec/dummy/app/models/test.rb +3 -0
  34. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/spec/dummy/config.ru +4 -0
  36. data/spec/dummy/config/application.rb +65 -0
  37. data/spec/dummy/config/boot.rb +10 -0
  38. data/spec/dummy/config/environment.rb +5 -0
  39. data/spec/dummy/config/environments/development.rb +31 -0
  40. data/spec/dummy/config/environments/production.rb +64 -0
  41. data/spec/dummy/config/environments/test.rb +35 -0
  42. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/spec/dummy/config/initializers/ecconnect_rails.rb +6 -0
  44. data/spec/dummy/config/initializers/inflections.rb +15 -0
  45. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  46. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  47. data/spec/dummy/config/initializers/session_store.rb +8 -0
  48. data/spec/dummy/config/initializers/wrap_parameters.rb +10 -0
  49. data/spec/dummy/config/locales/en.yml +5 -0
  50. data/spec/dummy/config/mongoid.yml +80 -0
  51. data/spec/dummy/config/routes.rb +4 -0
  52. data/spec/dummy/public/404.html +26 -0
  53. data/spec/dummy/public/422.html +26 -0
  54. data/spec/dummy/public/500.html +25 -0
  55. data/spec/dummy/public/favicon.ico +0 -0
  56. data/spec/dummy/script/rails +6 -0
  57. data/spec/factories/econnect_payment.rb +11 -0
  58. data/spec/features/ecconnect_payments_spec.rb +72 -0
  59. data/spec/models/ecconnect_rails/ecconnect_payment_spec.rb +51 -0
  60. data/spec/routing/ecconnect_rails/ecconnect_payments_routing_spec.rb +15 -0
  61. data/spec/spec_helper.rb +39 -0
  62. metadata +256 -0
@@ -0,0 +1,5 @@
1
+ <%= form_for @ecconnect_payment do |f| %>
2
+ <%= f.label :amount %>
3
+ <%= f.text_field :amount %>
4
+ <%= f.submit %>
5
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <%= @ecconnect_payment.merchant_id %>
2
+ <%= "\n" %>
3
+ <%= @ecconnect_payment.terminal_id %>
4
+ <%= "\n" %>
5
+ <%= @ecconnect_payment.order_id %>
6
+ <%= "\n" %>
7
+ <%= @ecconnect_payment.currency %>
8
+ <%= "\n" %>
9
+ <%= @ecconnect_payment.upc_amount %>
10
+ <%= "\n" %>
11
+ <%= @ecconnect_payment.xid %>
12
+ <%= "\n" %>
13
+ <%= "Response.action=#{@action}"%>
14
+ <%= "\n" %>
15
+ <%= "Response.reason=#{@reason}" if @reason %>
16
+ <%= "\n" if @reason %>
17
+ <%= "Response.forwardUrl=#{@forward_url}" if @forward_url %>
18
+ <%= "\n" if @forward_url %>
@@ -0,0 +1 @@
1
+ <%= ecconnect_form @ecconnect_payment %>
@@ -0,0 +1,59 @@
1
+ en:
2
+ ecconnect_rails:
3
+ ecconnect_form:
4
+ submit: Pay
5
+ success: Transaction success
6
+ wrong_signature: Wrong signature
7
+ currency_980: UAH
8
+ currency_643: RUB
9
+ currency_840: USD
10
+ currency_978: EUR
11
+ codes:
12
+ code_000: Approved
13
+ code_101: Invalid card parameters
14
+ code_105: Not approved by emitent
15
+ code_108: Lost/stolen card
16
+ code_111: Non existent card
17
+ code_116: Insufficient funds
18
+ code_130: Limit is exceeded
19
+ code_290: Issuer is not accessible
20
+ code_291: Technical/Communication problem
21
+ code_401: Invalid format
22
+ code_402: Invalid Acquirer/Merchant data
23
+ code_403: Component communication failure
24
+ code_404: Authentication error
25
+ code_405: Signature is invalid
26
+ code_406: Quota of transactions exceeded
27
+ code_407: Merchant is not active
28
+ code_408: Transaction was not found
29
+ code_409: Too many transactions were found
30
+ code_410: The order was paid (possible replay)
31
+ code_411: The order request time is out-of-date
32
+ code_412: Replay order condition
33
+ code_413: Unknown card type
34
+ code_420: The total amount of successful transactions per day is limited
35
+ code_421: Tran amount limit (non 3-D Secure full authenticated)
36
+ code_430: Transaction is prohibited by Gateway
37
+ code_431: Attempted 3D-Secure is not accepted
38
+ code_432: Card is in stop list
39
+ code_433: The number of transactions has exceeded the limit
40
+ code_434: The merchant does not accept cards from the country
41
+ code_435: CLient IP address is on stop list
42
+ code_436: The sum of amount transactions has exceeded the limit
43
+ code_438: Unacceptable currency code
44
+ code_439: The time limit from request to authorization has been exceeded
45
+ code_440: The authorization time limit has been exceeded
46
+ code_441: MPI communication problem
47
+ code_450: Recurrent payments are prohibited
48
+ code_501: Canceled by user
49
+ code_502: The web session is expired
50
+ code_503: Transaction was canceled by merchant
51
+ code_504: Transaction was canceled by gateway with reversal
52
+ code_505: Invalid sequense of operations
53
+ code_506: Preauthorized transaction is expired
54
+ code_507: Preauthorized transaction already processed with payment
55
+ code_508: Invalid amount to pay a preauthorized transaction
56
+ code_509: Not able to trace back to original transaction
57
+ code_510: Refund is expired
58
+ code_511: Transaction was canceled by settlement action
59
+ code_601: Not completed
@@ -0,0 +1,9 @@
1
+ EcconnectRails::Engine.routes.draw do
2
+ resources :ecconnect_payments, only: [:new, :create, :show] do
3
+ collection do
4
+ post 'success'
5
+ post 'failure'
6
+ post 'notify'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require 'ecconnect_rails/engine'
2
+
3
+ module EcconnectRails
4
+ ECCONNECT_VERSION = 1
5
+
6
+ @default_options = {}
7
+ class << self; attr_accessor :default_options; end
8
+
9
+ #class Exception < ::Exception; end
10
+ #class InvalidResponse < Exception; end
11
+ end
@@ -0,0 +1,5 @@
1
+ module EcconnectRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace EcconnectRails
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module EcconnectRails
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ecconnect_rails do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,16 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIClTCCAf4CCQC/rNHnwWNxvjANBgkqhkiG9w0BAQUFADCBjjESMBAGA1UECBMJ
3
+ VHVyZ2VuZXZhMRMwEQYDVQQHEwpTaW1mZXJvcG9sMRYwFAYDVQQK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YsxCzAJBgNVBAYTAlVBMRMwEQYDVQQIEwpTb21lLVN0YXRlMQ0wCwYD
7
+ VQQHEwRLeWl2MQwwCgYDVQQKEwNVUEMxFzAVBgNVBAsTDmVDb21tZXJjZSBVbml0
8
+ MRIwEAYDVQQDEwlTaWduYXR1cmUxHTAbBgkqhkiG9w0BCQEWDmVjLmhlbHBAdXBj
9
+ LnVhMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzIoeW9btImJ1X/u1DofZY
10
+ 1lGEAdDqmBKljFIlARpwyNjUb70RkZPzq1TB3SuNNJQ+1Wms2sKGu5uozoy9a2AR
11
+ rJOsR+QJSwEcQo/th+NhhTTBNh/rPshlCX6R2Hm1yoMTvTrloxAXpDtgkeyMQdBe
12
+ SZ991wX/EhX0zMaRG2dDSQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAMwpbjWXzoNQ
13
+ wQcxAYaoL7uFhNDub8QnCJJjC3HvGz2Kz250hyWc3KVRSEGQ4l9sNZl1PrHUg6OP
14
+ i4dPF01D5Nd36YIcMj5wsu3L4J77NvuLAj36ZZTPTsp0UmFdPaBa99GaeZgyfRxB
15
+ NNNZ4iNswLcXmGStimAC/32TO4SsPn91
16
+ -----END CERTIFICATE-----
@@ -0,0 +1,170 @@
1
+ require 'spec_helper'
2
+
3
+ describe EcconnectRails::EcconnectPaymentsController do
4
+ routes { EcconnectRails::Engine.routes }
5
+ let(:payment){ FactoryGirl.create :ecconnect_payment }
6
+ describe "GET new" do
7
+ before{ get :new }
8
+ it{ response.status.should == 200 }
9
+ it{ assigns(:ecconnect_payment).should be_a_new(EcconnectRails::EcconnectPayment) }
10
+ end
11
+
12
+ describe "GET show" do
13
+ before{ get :show, id: payment.to_param }
14
+ it{ response.status.should == 200 }
15
+ it{ assigns(:ecconnect_payment).should == payment }
16
+ end
17
+
18
+ describe "POST create" do
19
+ before{ post :create, ecconnect_payment: { amount: amount } }
20
+ context "right data" do
21
+ let(:amount){ 23 }
22
+ it{ response.should redirect_to "/ecconnect/ecconnect_payments/#{EcconnectRails::EcconnectPayment.last.to_param}" }
23
+ end
24
+ context "wrong data" do
25
+ let(:amount){ nil }
26
+ it{ response.should render_template('new') }
27
+ end
28
+ end
29
+
30
+ describe "POST failure" do
31
+ ['000', 101, 105, 108, 111, 116, 130, 290, 291, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
32
+ 412, 413, 420, 421, 430, 431, 432, 433, 434, 435, 436, 438, 439, 440, 441, 450, 501, 502, 503,
33
+ 504, 505, 506, 507, 508, 509, 510, 511, 601].each do |code|
34
+ let(:payment){ FactoryGirl.create :payment }
35
+ context "right signature" do
36
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
37
+ before{ post :failure, {'TranCode' => code.to_s} }
38
+ it{ response.should render_template 'failure' }
39
+ it{ flash[:error].should == I18n.t("ecconnect_rails.codes.code_#{code}" ) }
40
+ end
41
+ context "wrong signature" do
42
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(false) }
43
+ before{ post :failure, {'TranCode' => code.to_s} }
44
+ it{ response.should render_template 'failure' }
45
+ it{ flash[:error].should == I18n.t("ecconnect_rails.wrong_signature") }
46
+ end
47
+ describe "override methods" do
48
+ context "right signature" do
49
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
50
+ it{ expect{ post :failure, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(3) }
51
+ end
52
+ context "wrong signature" do
53
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(false) }
54
+ it{ expect{ post :failure, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(4) }
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ describe "POST success" do
61
+ ['000', 101, 105, 108, 111, 116, 130, 290, 291, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
62
+ 412, 413, 420, 421, 430, 431, 432, 433, 434, 435, 436, 438, 439, 440, 441, 450, 501, 502, 503,
63
+ 504, 505, 506, 507, 508, 509, 510, 511, 601].each do |code|
64
+ let(:payment){ FactoryGirl.create :payment }
65
+ context "right signature" do
66
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
67
+ before{ post :success, {'TranCode' => code.to_s} }
68
+ it do
69
+ if code == "000"
70
+ response.should render_template 'success'
71
+ else
72
+ response.should render_template 'failure'
73
+ end
74
+ end
75
+ it do
76
+ if code == "000"
77
+ flash[:notice].should == I18n.t("ecconnect_rails.success")
78
+ else
79
+ flash[:error].should == I18n.t("ecconnect_rails.codes.code_#{code}" )
80
+ end
81
+ end
82
+ end
83
+ context "wrong signature" do
84
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(false) }
85
+ before{ post :success, {'TranCode' => code.to_s} }
86
+ it{ response.should render_template 'failure' }
87
+ it{ flash[:error].should == I18n.t("ecconnect_rails.wrong_signature") }
88
+ end
89
+ describe "override methods" do
90
+ context "right signature" do
91
+ if code == "000"
92
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
93
+ it{ expect{ post :success, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(1) }
94
+ else
95
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
96
+ it{ expect{ post :success, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(3) }
97
+ end
98
+ end
99
+ context "wrong signature" do
100
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(false) }
101
+ it{ expect{ post :success, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(2) }
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+ describe "POST notify" do
108
+ ['000', 101, 105, 108, 111, 116, 130, 290, 291, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
109
+ 412, 413, 420, 421, 430, 431, 432, 433, 434, 435, 436, 438, 439, 440, 441, 450, 501, 502, 503,
110
+ 504, 505, 506, 507, 508, 509, 510, 511, 601].each do |code|
111
+ let(:payment){ FactoryGirl.create :payment }
112
+ context "right signature" do
113
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
114
+ before{ post :notify, {'TranCode' => code.to_s} }
115
+ it do
116
+ if code == "000"
117
+ response.should render_template 'notify'
118
+ assigns(:action) == 'approve'
119
+ assigns(:reason) == nil
120
+ assigns(:forward_url) == nil
121
+ else
122
+ response.should render_template 'notify'
123
+ assigns(:action) == 'reverse'
124
+ assigns(:reason) == I18n.t("ecconnect_rails.codes.code_503")
125
+ assigns(:forward_url) == nil
126
+ end
127
+ end
128
+ end
129
+ context "wrong signature" do
130
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(false) }
131
+ before{ post :notify, {'TranCode' => code.to_s} }
132
+ it{ response.should render_template 'notify' }
133
+ it{ assigns(:action) == 'reverse' }
134
+ it{ assigns(:reason) == I18n.t("ecconnect_rails.codes.code_405") }
135
+ it{ assigns(:forward_url) == nil }
136
+ end
137
+ describe "override methods" do
138
+ context "right signature && right signature and code" do
139
+ if code == "000" #right signature and code
140
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
141
+ it{ expect{ post :notify, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(6) }
142
+ context "override url" do
143
+ before{ EcconnectRails::EcconnectPaymentsController.any_instance.stub(:forward_url_success).and_return('http://google.com') }
144
+ before{ post :notify, {'TranCode' => code.to_s} }
145
+ it{ assigns(:forward_url) == 'http://google.com' }
146
+ end
147
+ else #right signature
148
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(true) }
149
+ it{ expect{ post :notify, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(5) }
150
+ context "override url" do
151
+ before{ EcconnectRails::EcconnectPaymentsController.any_instance.stub(:forward_url_failure).and_return('http://google.com.ua') }
152
+ before{ post :notify, {'TranCode' => code.to_s} }
153
+ it{ assigns(:forward_url) == 'http://google.com.ua' }
154
+ end
155
+ end
156
+ end
157
+ context "wrong signature" do
158
+ before{ EcconnectRails::EcconnectPayment.any_instance.stub(:check_signature).and_return(false) }
159
+ it{ expect{ post :notify, {'TranCode' => code.to_s} }.to change{TestModel.count}.by(7) }
160
+ context "override url" do
161
+ before{ EcconnectRails::EcconnectPaymentsController.any_instance.stub(:forward_url_failure).and_return('http://google.com.ua') }
162
+ before{ post :notify, {'TranCode' => code.to_s} }
163
+ it{ assigns(:forward_url) == 'http://google.com.ua' }
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
169
+ end
170
+
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'ecconnect_rails', :path => '../../'
4
+ gem "mongoid", ">= 3.0.0"
5
+ gem 'mongoid-autoinc', ">= 0.3.0"
@@ -0,0 +1,106 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ ecconnect_rails (0.0.2)
5
+ mongoid (>= 3.0.0)
6
+ mongoid-autoinc (>= 0.3.0)
7
+ rails (>= 3.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (3.2.14)
13
+ actionpack (= 3.2.14)
14
+ mail (~> 2.5.4)
15
+ actionpack (3.2.14)
16
+ activemodel (= 3.2.14)
17
+ activesupport (= 3.2.14)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ journey (~> 1.0.4)
21
+ rack (~> 1.4.5)
22
+ rack-cache (~> 1.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.2.1)
25
+ activemodel (3.2.14)
26
+ activesupport (= 3.2.14)
27
+ builder (~> 3.0.0)
28
+ activerecord (3.2.14)
29
+ activemodel (= 3.2.14)
30
+ activesupport (= 3.2.14)
31
+ arel (~> 3.0.2)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.2.14)
34
+ activemodel (= 3.2.14)
35
+ activesupport (= 3.2.14)
36
+ activesupport (3.2.14)
37
+ i18n (~> 0.6, >= 0.6.4)
38
+ multi_json (~> 1.0)
39
+ arel (3.0.2)
40
+ builder (3.0.4)
41
+ erubis (2.7.0)
42
+ hike (1.2.3)
43
+ i18n (0.6.5)
44
+ journey (1.0.4)
45
+ json (1.8.0)
46
+ mail (2.5.4)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.25)
50
+ mongoid (3.1.4)
51
+ activemodel (~> 3.2)
52
+ moped (~> 1.4)
53
+ origin (~> 1.0)
54
+ tzinfo (~> 0.3.22)
55
+ mongoid-autoinc (0.5.1)
56
+ activesupport
57
+ mongoid (~> 3.0)
58
+ rake
59
+ moped (1.5.1)
60
+ multi_json (1.8.0)
61
+ origin (1.1.0)
62
+ polyglot (0.3.3)
63
+ rack (1.4.5)
64
+ rack-cache (1.2)
65
+ rack (>= 0.4)
66
+ rack-ssl (1.3.3)
67
+ rack
68
+ rack-test (0.6.2)
69
+ rack (>= 1.0)
70
+ rails (3.2.14)
71
+ actionmailer (= 3.2.14)
72
+ actionpack (= 3.2.14)
73
+ activerecord (= 3.2.14)
74
+ activeresource (= 3.2.14)
75
+ activesupport (= 3.2.14)
76
+ bundler (~> 1.0)
77
+ railties (= 3.2.14)
78
+ railties (3.2.14)
79
+ actionpack (= 3.2.14)
80
+ activesupport (= 3.2.14)
81
+ rack-ssl (~> 1.3.2)
82
+ rake (>= 0.8.7)
83
+ rdoc (~> 3.4)
84
+ thor (>= 0.14.6, < 2.0)
85
+ rake (10.1.0)
86
+ rdoc (3.12.2)
87
+ json (~> 1.4)
88
+ sprockets (2.2.2)
89
+ hike (~> 1.2)
90
+ multi_json (~> 1.0)
91
+ rack (~> 1.0)
92
+ tilt (~> 1.1, != 1.3.0)
93
+ thor (0.18.1)
94
+ tilt (1.4.1)
95
+ treetop (1.4.15)
96
+ polyglot
97
+ polyglot (>= 0.3.1)
98
+ tzinfo (0.3.37)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ ecconnect_rails!
105
+ mongoid (>= 3.0.0)
106
+ mongoid-autoinc (>= 0.3.0)