espago 0.0.9 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +15 -3
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +263 -47
  5. data/Guardfile +1 -0
  6. data/README.md +116 -6
  7. data/app/helpers/espago/masterpass_helper.rb +13 -0
  8. data/app/helpers/espago/secure_web_page_helper.rb +5 -0
  9. data/app/views/espago_masterpass/_masterpass_button.html.haml +20 -0
  10. data/app/views/espago_masterpass/_masterpass_pairing_button.html.haml +11 -0
  11. data/app/views/espago_masterpass/_masterpass_precheckout_button.html.haml +21 -0
  12. data/app/views/espago_secure_web_page/_form.html.haml +26 -0
  13. data/espago.gemspec +16 -9
  14. data/lib/espago/api_connection/{post_clients.rb → api.rb} +1 -5
  15. data/lib/espago/api_connection/api_delete.rb +9 -0
  16. data/lib/espago/api_connection/api_get.rb +13 -0
  17. data/lib/espago/api_connection/api_post.rb +9 -0
  18. data/lib/espago/api_connection/api_put.rb +9 -0
  19. data/lib/espago/api_connection/charges_complete_post.rb +9 -0
  20. data/lib/espago/api_connection/charges_delete.rb +9 -0
  21. data/lib/espago/api_connection/charges_get.rb +9 -0
  22. data/lib/espago/api_connection/charges_post.rb +9 -0
  23. data/lib/espago/api_connection/{post_charges_refund.rb → charges_refund_post.rb} +1 -5
  24. data/lib/espago/api_connection/clients_authorize_post.rb +9 -0
  25. data/lib/espago/api_connection/clients_delete.rb +9 -0
  26. data/lib/espago/api_connection/clients_get.rb +9 -0
  27. data/lib/espago/api_connection/clients_invoices_get.rb +9 -0
  28. data/lib/espago/api_connection/clients_post.rb +9 -0
  29. data/lib/espago/api_connection/clients_put.rb +9 -0
  30. data/lib/espago/api_connection/clients_subscriptions_get.rb +9 -0
  31. data/lib/espago/api_connection/complete_post.rb +14 -0
  32. data/lib/espago/api_connection/dcc_decision_post.rb +9 -0
  33. data/lib/espago/api_connection/invoice_items_delete.rb +9 -0
  34. data/lib/espago/api_connection/invoice_items_get.rb +9 -0
  35. data/lib/espago/api_connection/invoice_items_post.rb +9 -0
  36. data/lib/espago/api_connection/invoices_get.rb +9 -0
  37. data/lib/espago/api_connection/line_items_get.rb +9 -0
  38. data/lib/espago/api_connection/masterpass_post.rb +9 -0
  39. data/lib/espago/api_connection/plans_delete.rb +9 -0
  40. data/lib/espago/api_connection/plans_get.rb +9 -0
  41. data/lib/espago/api_connection/plans_post.rb +9 -0
  42. data/lib/espago/api_connection/plans_put.rb +9 -0
  43. data/lib/espago/api_connection/refunds_post.rb +9 -0
  44. data/lib/espago/api_connection/secure_web_page_register_post.rb +9 -0
  45. data/lib/espago/api_connection/subscriptions_delete.rb +9 -0
  46. data/lib/espago/api_connection/subscriptions_get.rb +9 -0
  47. data/lib/espago/api_connection/subscriptions_post.rb +9 -0
  48. data/lib/espago/api_connection/tokens_get.rb +9 -0
  49. data/lib/espago/api_connection/{delete_charges.rb → tokens_post.rb} +3 -2
  50. data/lib/espago/api_connection/visacheckout_post.rb +9 -0
  51. data/lib/espago/api_connection.rb +20 -9
  52. data/lib/espago/back_request.rb +33 -0
  53. data/lib/espago/client.rb +23 -9
  54. data/lib/espago/engine.rb +5 -0
  55. data/lib/espago/masterpass.rb +52 -0
  56. data/lib/espago/router.rb +1 -1
  57. data/lib/espago/secure_web_page.rb +31 -0
  58. data/lib/espago/version.rb +1 -1
  59. data/lib/espago.rb +11 -3
  60. data/lib/generators/espago/install_generator.rb +20 -0
  61. data/lib/generators/espago/templates/README +10 -0
  62. data/lib/generators/espago/templates/espago.rb +6 -0
  63. data/spec/espago/api_connection_spec.rb +5 -4
  64. data/spec/espago/back_request_spec.rb +33 -0
  65. data/spec/espago/client_spec.rb +21 -8
  66. data/spec/espago/error_spec.rb +4 -3
  67. data/spec/espago/response_spec.rb +10 -10
  68. data/spec/espago/router_spec.rb +6 -7
  69. data/spec/features/apis_spec.rb +21 -0
  70. data/spec/features/charges_spec.rb +79 -0
  71. data/spec/features/charges_spec_with_params_spec.rb +89 -0
  72. data/spec/features/clients_spec.rb +100 -0
  73. data/spec/features/dcc_decision_spec.rb +20 -0
  74. data/spec/features/error_spec.rb +28 -0
  75. data/spec/features/invoice_items_spec.rb +37 -0
  76. data/spec/features/invoices_spec.rb +24 -0
  77. data/spec/features/line_items_spec.rb +17 -0
  78. data/spec/features/plans_spec.rb +61 -0
  79. data/spec/features/secure_web_page_register_spec.rb +23 -0
  80. data/spec/features/subscriptions_spec.rb +43 -0
  81. data/spec/features/tokens_spec.rb +39 -0
  82. data/spec/fixtures/cassettes/api_2.yml +68 -0
  83. data/spec/fixtures/cassettes/api_3.yml +68 -0
  84. data/spec/fixtures/cassettes/charges_complete.yml +48 -0
  85. data/spec/fixtures/cassettes/charges_complete_deprecation.yml +48 -0
  86. data/spec/fixtures/cassettes/charges_destroy.yml +46 -0
  87. data/spec/fixtures/cassettes/charges_get.yml +67 -0
  88. data/spec/fixtures/cassettes/charges_get_pay_mTOngouLTJWZ0w.yml +48 -0
  89. data/spec/fixtures/cassettes/charges_post.yml +50 -0
  90. data/spec/fixtures/cassettes/charges_refund.yml +50 -0
  91. data/spec/fixtures/cassettes/clients_authorize.yml +50 -0
  92. data/spec/fixtures/cassettes/clients_delete.yml +44 -0
  93. data/spec/fixtures/cassettes/clients_get.yml +48 -0
  94. data/spec/fixtures/cassettes/clients_get_cli_w0Se2smYwyQ0Uw.yml +48 -0
  95. data/spec/fixtures/cassettes/clients_invoices.yml +48 -0
  96. data/spec/fixtures/cassettes/clients_post.yml +50 -0
  97. data/spec/fixtures/cassettes/clients_put.yml +50 -0
  98. data/spec/fixtures/cassettes/clients_subscriptions.yml +48 -0
  99. data/spec/fixtures/cassettes/dcc_decision_post.yml +50 -0
  100. data/spec/fixtures/cassettes/error_400.yml +48 -0
  101. data/spec/fixtures/cassettes/error_401.yml +48 -0
  102. data/spec/fixtures/cassettes/error_500.yml +48 -0
  103. data/spec/fixtures/cassettes/invoice_items_delete_ii_WDzszvhTshe78Xd.yml +44 -0
  104. data/spec/fixtures/cassettes/invoice_items_get_ii_5LS-YR7S1QaJBl3.yml +49 -0
  105. data/spec/fixtures/cassettes/invoice_items_post_ii_5LS-YR7S1QaJBl3.yml +51 -0
  106. data/spec/fixtures/cassettes/invoices_get.yml +48 -0
  107. data/spec/fixtures/cassettes/invoices_get_in_tUCMhwlg2nkvAaL.yml +48 -0
  108. data/spec/fixtures/cassettes/line_items_get.yml +47 -0
  109. data/spec/fixtures/cassettes/plans_delete.yml +42 -0
  110. data/spec/fixtures/cassettes/plans_get.yml +46 -0
  111. data/spec/fixtures/cassettes/plans_get_pl_12345.yml +46 -0
  112. data/spec/fixtures/cassettes/plans_post.yml +50 -0
  113. data/spec/fixtures/cassettes/plans_put.yml +46 -0
  114. data/spec/fixtures/cassettes/secure_web_page_register_post.yml +56 -0
  115. data/spec/fixtures/cassettes/subscriptions_delete_sub_8yYuCBKdywr7e2.yml +44 -0
  116. data/spec/fixtures/cassettes/subscriptions_get.yml +46 -0
  117. data/spec/fixtures/cassettes/subscriptions_get_sub_8yYuCBKdywr7e2.yml +46 -0
  118. data/spec/fixtures/cassettes/subscriptions_post.yml +50 -0
  119. data/spec/fixtures/cassettes/tokens_get.yml +48 -0
  120. data/spec/fixtures/cassettes/tokens_post.yml +56 -0
  121. data/spec/spec_helper.rb +29 -1
  122. metadata +271 -42
  123. data/lib/espago/api_connection/delete_clients.rb +0 -13
  124. data/lib/espago/api_connection/get_charges.rb +0 -17
  125. data/lib/espago/api_connection/get_clients.rb +0 -17
  126. data/lib/espago/api_connection/get_tokens.rb +0 -13
  127. data/lib/espago/api_connection/post_charges.rb +0 -13
  128. data/lib/espago/api_connection/post_clients_authorize.rb +0 -13
  129. data/lib/espago/api_connection/post_complete.rb +0 -13
  130. data/lib/espago/api_connection/post_tokens.rb +0 -14
  131. data/lib/espago/api_connection/put_clients.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9f06d19baed38844060f767678cc1e08df0b64ba
4
- data.tar.gz: 40a3d3d5c42aa5751425aaf3f6ac47428f2b5168
2
+ SHA256:
3
+ metadata.gz: 6cecfc3e61851881b307347b5db67843c55f2666af1c08a2ed874bdeb56afd58
4
+ data.tar.gz: 6e75c9b9a03fa8d32e6923154a30ba6af8fe651da1311b67c22b7772405f0e1b
5
5
  SHA512:
6
- metadata.gz: 76c47df71036ce428b04abf38ab7dad46122b4d92cc833dfc7280634845dc3ae6e4f3d6b053b95cf4d6f648bd4f6d155ba111a9d3c78688357b15dc5e4370d42
7
- data.tar.gz: cb034408241e51d751e5bdeb37fce8015a0fbe5e8825c827d2d1b4a6a4241a8ed965e7f7a068599d91b125a8189689dd507e2df1f9da4408eb006a3c1963788b
6
+ metadata.gz: '0971aacc3c040da88abc8b6c8d4d1cb201ae6cd68ee85916725d0b3bff22e5d7d6c62ab1ec09ebae3e99a5c6b7b61c6787c28493e40b47cd2888049c09caae60'
7
+ data.tar.gz: d68e32f6a39be3a5e8044f4234d6b2f905e47262b35dc61869e78629b1f359472f357861f3cc693117eea1cd079974687a30a1082282b12102f4cdc90d6f626d
data/.travis.yml CHANGED
@@ -1,5 +1,17 @@
1
+ before_install: bundle update --bundler
2
+ env:
3
+ global:
4
+ - CC_TEST_REPORTER_ID=6c7689ce08533f243c6949aabf49abada63dc24f5e1bf5c4a6dfdb20080b95fa
1
5
  language: ruby
2
6
  rvm:
3
- - "1.9.2"
4
- - "1.9.3"
5
- - "2.0.0"
7
+ - 2.4.6
8
+ - 2.5.5
9
+ - 2.6.2
10
+ before_script:
11
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
+ - chmod +x ./cc-test-reporter
13
+ - ./cc-test-reporter before-build
14
+ script:
15
+ - bundle exec rspec
16
+ after_script:
17
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in espago.gemspec
4
4
  gemspec
5
+
6
+ gem "ruby-lsp", "~> 0.1.0", :group => :development
data/Gemfile.lock CHANGED
@@ -1,67 +1,283 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- espago (0.0.9)
4
+ espago (0.1.9)
5
5
  facets
6
- faraday
6
+ faraday (>= 2.0.0)
7
+ json (>= 2.3.1)
8
+ rails
7
9
 
8
10
  GEM
9
11
  remote: https://rubygems.org/
10
12
  specs:
11
- coderay (1.0.8)
12
- diff-lcs (1.1.3)
13
- facets (2.9.3)
14
- faraday (0.8.7)
15
- multipart-post (~> 1.1)
16
- fuubar (1.1.0)
17
- rspec (~> 2.0)
18
- rspec-instafail (~> 0.2.0)
19
- ruby-progressbar (~> 1.0.0)
20
- guard (1.6.1)
21
- listen (>= 0.6.0)
22
- lumberjack (>= 1.0.2)
23
- pry (>= 0.9.10)
24
- thor (>= 0.14.6)
25
- guard-rspec (2.3.3)
26
- guard (>= 1.1)
27
- rspec (~> 2.11)
28
- listen (0.7.2)
29
- lumberjack (1.0.2)
30
- method_source (0.8.1)
31
- multi_json (1.5.0)
32
- multipart-post (1.2.0)
33
- pry (0.9.10)
34
- coderay (~> 1.0.5)
35
- method_source (~> 0.8)
36
- slop (~> 3.3.1)
37
- rake (10.0.2)
38
- rb-fsevent (0.9.3)
39
- rspec (2.12.0)
40
- rspec-core (~> 2.12.0)
41
- rspec-expectations (~> 2.12.0)
42
- rspec-mocks (~> 2.12.0)
43
- rspec-core (2.12.2)
44
- rspec-expectations (2.12.1)
45
- diff-lcs (~> 1.1.3)
46
- rspec-instafail (0.2.4)
47
- rspec-mocks (2.12.1)
48
- ruby-progressbar (1.0.2)
49
- simplecov (0.7.1)
50
- multi_json (~> 1.0)
51
- simplecov-html (~> 0.7.1)
52
- simplecov-html (0.7.1)
53
- slop (3.3.3)
54
- thor (0.16.0)
13
+ actioncable (7.0.3)
14
+ actionpack (= 7.0.3)
15
+ activesupport (= 7.0.3)
16
+ nio4r (~> 2.0)
17
+ websocket-driver (>= 0.6.1)
18
+ actionmailbox (7.0.3)
19
+ actionpack (= 7.0.3)
20
+ activejob (= 7.0.3)
21
+ activerecord (= 7.0.3)
22
+ activestorage (= 7.0.3)
23
+ activesupport (= 7.0.3)
24
+ mail (>= 2.7.1)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.0.3)
29
+ actionpack (= 7.0.3)
30
+ actionview (= 7.0.3)
31
+ activejob (= 7.0.3)
32
+ activesupport (= 7.0.3)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.0)
38
+ actionpack (7.0.3)
39
+ actionview (= 7.0.3)
40
+ activesupport (= 7.0.3)
41
+ rack (~> 2.0, >= 2.2.0)
42
+ rack-test (>= 0.6.3)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
+ actiontext (7.0.3)
46
+ actionpack (= 7.0.3)
47
+ activerecord (= 7.0.3)
48
+ activestorage (= 7.0.3)
49
+ activesupport (= 7.0.3)
50
+ globalid (>= 0.6.0)
51
+ nokogiri (>= 1.8.5)
52
+ actionview (7.0.3)
53
+ activesupport (= 7.0.3)
54
+ builder (~> 3.1)
55
+ erubi (~> 1.4)
56
+ rails-dom-testing (~> 2.0)
57
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
58
+ activejob (7.0.3)
59
+ activesupport (= 7.0.3)
60
+ globalid (>= 0.3.6)
61
+ activemodel (7.0.3)
62
+ activesupport (= 7.0.3)
63
+ activerecord (7.0.3)
64
+ activemodel (= 7.0.3)
65
+ activesupport (= 7.0.3)
66
+ activestorage (7.0.3)
67
+ actionpack (= 7.0.3)
68
+ activejob (= 7.0.3)
69
+ activerecord (= 7.0.3)
70
+ activesupport (= 7.0.3)
71
+ marcel (~> 1.0)
72
+ mini_mime (>= 1.1.0)
73
+ activesupport (7.0.3)
74
+ concurrent-ruby (~> 1.0, >= 1.0.2)
75
+ i18n (>= 1.6, < 2)
76
+ minitest (>= 5.1)
77
+ tzinfo (~> 2.0)
78
+ addressable (2.8.0)
79
+ public_suffix (>= 2.0.2, < 5.0)
80
+ ast (2.4.2)
81
+ builder (3.2.4)
82
+ byebug (11.1.3)
83
+ coderay (1.1.3)
84
+ concurrent-ruby (1.1.10)
85
+ crack (0.4.5)
86
+ rexml
87
+ crass (1.0.6)
88
+ diff-lcs (1.5.0)
89
+ digest (3.1.0)
90
+ docile (1.4.0)
91
+ erubi (1.10.0)
92
+ facets (3.1.0)
93
+ faraday (2.3.0)
94
+ faraday-net_http (~> 2.0)
95
+ ruby2_keywords (>= 0.0.4)
96
+ faraday-net_http (2.0.3)
97
+ ffi (1.15.5)
98
+ formatador (1.1.0)
99
+ fuubar (2.5.1)
100
+ rspec-core (~> 3.0)
101
+ ruby-progressbar (~> 1.4)
102
+ globalid (1.0.0)
103
+ activesupport (>= 5.0)
104
+ guard (2.18.0)
105
+ formatador (>= 0.2.4)
106
+ listen (>= 2.7, < 4.0)
107
+ lumberjack (>= 1.0.12, < 2.0)
108
+ nenv (~> 0.1)
109
+ notiffany (~> 0.0)
110
+ pry (>= 0.13.0)
111
+ shellany (~> 0.0)
112
+ thor (>= 0.18.1)
113
+ guard-compat (1.2.1)
114
+ guard-rspec (4.7.3)
115
+ guard (~> 2.1)
116
+ guard-compat (~> 1.1)
117
+ rspec (>= 2.99.0, < 4.0)
118
+ hashdiff (1.0.1)
119
+ i18n (1.10.0)
120
+ concurrent-ruby (~> 1.0)
121
+ json (2.6.2)
122
+ language_server-protocol (3.16.0.3)
123
+ listen (3.0.8)
124
+ rb-fsevent (~> 0.9, >= 0.9.4)
125
+ rb-inotify (~> 0.9, >= 0.9.7)
126
+ loofah (2.18.0)
127
+ crass (~> 1.0.2)
128
+ nokogiri (>= 1.5.9)
129
+ lumberjack (1.2.8)
130
+ mail (2.7.1)
131
+ mini_mime (>= 0.1.1)
132
+ marcel (1.0.2)
133
+ method_source (1.0.0)
134
+ mini_mime (1.1.2)
135
+ mini_portile2 (2.8.0)
136
+ minitest (5.16.1)
137
+ nenv (0.3.0)
138
+ net-imap (0.2.3)
139
+ digest
140
+ net-protocol
141
+ strscan
142
+ net-pop (0.1.1)
143
+ digest
144
+ net-protocol
145
+ timeout
146
+ net-protocol (0.1.3)
147
+ timeout
148
+ net-smtp (0.3.1)
149
+ digest
150
+ net-protocol
151
+ timeout
152
+ nio4r (2.5.8)
153
+ nokogiri (1.13.6)
154
+ mini_portile2 (~> 2.8.0)
155
+ racc (~> 1.4)
156
+ notiffany (0.1.3)
157
+ nenv (~> 0.1)
158
+ shellany (~> 0.0)
159
+ parallel (1.22.1)
160
+ parser (3.1.2.0)
161
+ ast (~> 2.4.1)
162
+ prettier_print (0.1.0)
163
+ pry (0.14.1)
164
+ coderay (~> 1.1)
165
+ method_source (~> 1.0)
166
+ public_suffix (4.0.7)
167
+ racc (1.6.0)
168
+ rack (2.2.3.1)
169
+ rack-test (1.1.0)
170
+ rack (>= 1.0, < 3)
171
+ rails (7.0.3)
172
+ actioncable (= 7.0.3)
173
+ actionmailbox (= 7.0.3)
174
+ actionmailer (= 7.0.3)
175
+ actionpack (= 7.0.3)
176
+ actiontext (= 7.0.3)
177
+ actionview (= 7.0.3)
178
+ activejob (= 7.0.3)
179
+ activemodel (= 7.0.3)
180
+ activerecord (= 7.0.3)
181
+ activestorage (= 7.0.3)
182
+ activesupport (= 7.0.3)
183
+ bundler (>= 1.15.0)
184
+ railties (= 7.0.3)
185
+ rails-dom-testing (2.0.3)
186
+ activesupport (>= 4.2.0)
187
+ nokogiri (>= 1.6)
188
+ rails-html-sanitizer (1.4.3)
189
+ loofah (~> 2.3)
190
+ railties (7.0.3)
191
+ actionpack (= 7.0.3)
192
+ activesupport (= 7.0.3)
193
+ method_source
194
+ rake (>= 12.2)
195
+ thor (~> 1.0)
196
+ zeitwerk (~> 2.5)
197
+ rainbow (3.1.1)
198
+ rake (13.0.6)
199
+ rb-fsevent (0.9.8)
200
+ rb-inotify (0.10.1)
201
+ ffi (~> 1.0)
202
+ regexp_parser (2.5.0)
203
+ rexml (3.2.5)
204
+ rspec (3.11.0)
205
+ rspec-core (~> 3.11.0)
206
+ rspec-expectations (~> 3.11.0)
207
+ rspec-mocks (~> 3.11.0)
208
+ rspec-core (3.11.0)
209
+ rspec-support (~> 3.11.0)
210
+ rspec-expectations (3.11.0)
211
+ diff-lcs (>= 1.2.0, < 2.0)
212
+ rspec-support (~> 3.11.0)
213
+ rspec-its (1.3.0)
214
+ rspec-core (>= 3.0.0)
215
+ rspec-expectations (>= 3.0.0)
216
+ rspec-mocks (3.11.1)
217
+ diff-lcs (>= 1.2.0, < 2.0)
218
+ rspec-support (~> 3.11.0)
219
+ rspec-support (3.11.0)
220
+ rubocop (1.30.1)
221
+ parallel (~> 1.10)
222
+ parser (>= 3.1.0.0)
223
+ rainbow (>= 2.2.2, < 4.0)
224
+ regexp_parser (>= 1.8, < 3.0)
225
+ rexml (>= 3.2.5, < 4.0)
226
+ rubocop-ast (>= 1.18.0, < 2.0)
227
+ ruby-progressbar (~> 1.7)
228
+ unicode-display_width (>= 1.4.0, < 3.0)
229
+ rubocop-ast (1.18.0)
230
+ parser (>= 3.1.1.0)
231
+ ruby-lsp (0.1.0)
232
+ language_server-protocol
233
+ rubocop (>= 1.0)
234
+ sorbet-runtime
235
+ syntax_tree (>= 2.4)
236
+ ruby-progressbar (1.11.0)
237
+ ruby2_keywords (0.0.5)
238
+ shellany (0.0.1)
239
+ simplecov (0.21.2)
240
+ docile (~> 1.1)
241
+ simplecov-html (~> 0.11)
242
+ simplecov_json_formatter (~> 0.1)
243
+ simplecov-html (0.12.3)
244
+ simplecov_json_formatter (0.1.4)
245
+ sorbet-runtime (0.5.10109)
246
+ strscan (3.0.3)
247
+ syntax_tree (2.8.0)
248
+ prettier_print
249
+ thor (1.2.1)
250
+ timeout (0.3.0)
251
+ tzinfo (2.0.4)
252
+ concurrent-ruby (~> 1.0)
253
+ unicode-display_width (2.1.0)
254
+ vcr (6.1.0)
255
+ webmock (3.14.0)
256
+ addressable (>= 2.8.0)
257
+ crack (>= 0.3.2)
258
+ hashdiff (>= 0.4.0, < 2.0.0)
259
+ websocket-driver (0.7.5)
260
+ websocket-extensions (>= 0.1.0)
261
+ websocket-extensions (0.1.5)
262
+ zeitwerk (2.6.0)
55
263
 
56
264
  PLATFORMS
57
265
  ruby
58
266
 
59
267
  DEPENDENCIES
268
+ byebug
60
269
  espago!
61
270
  fuubar
62
271
  guard-rspec
63
272
  pry
64
273
  rake
65
274
  rb-fsevent (~> 0.9.1)
66
- rspec
275
+ rspec (>= 3.11.0)
276
+ rspec-its
277
+ ruby-lsp (~> 0.1.0)
67
278
  simplecov
279
+ vcr
280
+ webmock
281
+
282
+ BUNDLED WITH
283
+ 1.17.3
data/Guardfile CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  guard 'rspec' do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^spec/features/.+_spec\.rb$})
6
7
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
8
  watch(%r{^lib/espago/(.+)\.rb$}) { |m| "spec/espago/#{m[1]}_spec.rb" }
8
9
  watch('spec/spec_helper.rb') { "spec" }
data/README.md CHANGED
@@ -2,6 +2,7 @@ Espago gem
2
2
  ======
3
3
 
4
4
  [![Build Status](https://travis-ci.org/espago/espago.png?branch=master)](https://travis-ci.org/espago/espago)
5
+ [![Gem Version](https://badge.fury.io/rb/espago.svg)](http://badge.fury.io/rb/espago)
5
6
 
6
7
  ### Installing Espago gem
7
8
 
@@ -11,9 +12,7 @@ or just add it to your Gemfile if you are running a Rails project
11
12
 
12
13
  ## Configuration
13
14
 
14
- After registering at <http://espago.com> configure your app with the security credentials.
15
-
16
- ### Global
15
+ After registering at <http://espago.com> configure your app with the security credentials. More information about configuration of merchant account you can find in our documentation <https://developers.espago.com/en>
17
16
 
18
17
  The most standard way of configuring Espago is to do it globally on the Espago class.
19
18
 
@@ -21,8 +20,119 @@ The most standard way of configuring Espago is to do it globally on the Espago c
21
20
  Espago.app_password = 'your-espago-secret'
22
21
  Espago.public_key = 'your-espago-key'
23
22
  Espago.production = false #sets Espago enviroment to sandbox
23
+ Espago.api_version = 3
24
+
25
+ ## Sending request
26
+
27
+ There are two possible ways of sending requests by using Espago gem.
28
+ The first possibility is to call everytime send_request() function with proper path, HTTP method and parameters.
29
+
30
+ Espago.send_request path, request_type, [parameters]
31
+
32
+ Here it is an example of using this way to create new client (read how to created token_id at https://github.com/espago/espago-1.2.js-demo) :
33
+
34
+ Espago.send_request :clients, :post, {description: "Jan Kowalski", email: "kowalski@example.com", card: 'token_id'}
35
+
36
+ The second possible way to sending requests by Espago gem is to call the proper path on Espago object, using specific HTTP method and setting chosen parameteres.
37
+
38
+ Espago.path request_type, [parameters]
39
+
40
+ Below, it is an example of using this possibility to create new client:
41
+
42
+ Espago.clients :post, {description: "Jan Kowalski", email: "kowalski@example.com", card: 'token_id'}
43
+
44
+ ## Getting response
45
+
46
+ Every returned object includes informations about header and body of response.
47
+
48
+ For example for request:
49
+
50
+ client = Espago.clients :post, {description: "Jan Kowalski", email: "kowalski@example.com", card: 'token_id'}
51
+
52
+ Espago returns an special response object:
53
+
54
+ #<Espago::Response:0x000001038dba40
55
+ @body=
56
+ {"email"=>"kowalski@example.com",
57
+ "id"=>"cli_N2NNf85cFB1xWs",
58
+ "created_at"=>1381834598,
59
+ "description"=>"Jan Kowalski",
60
+ "card"=>
61
+ {"company"=>"VI",
62
+ "last4"=>"4242",
63
+ "year"=>2019,
64
+ "month"=>3,
65
+ "first_name"=>"Jan",
66
+ "last_name"=>"Kowalski",
67
+ "authorized"=>nil,
68
+ "created_at"=>1381834598},
69
+ "deleted"=>false},
70
+ @status=201>
71
+
72
+ To get response status code you should use "status" method.
73
+ For example
74
+
75
+ client.status
76
+
77
+ returns "201" code.
78
+
79
+ To get body of response you should use "body" method.
80
+ For example
81
+
82
+ client.body
83
+
84
+ can return hash with client details:
85
+
86
+ {
87
+ "email"=>"kowalski@example.com",
88
+ "id"=>"cli_N2NNf85cFB1xWs",
89
+ "created_at"=>1381834598,
90
+ "description"=>"Jan Kowalski",
91
+ "card"=>
92
+ {"company"=>"VI",
93
+ "last4"=>"4242",
94
+ "year"=>2019,
95
+ "month"=>3,
96
+ "first_name"=>"Jan",
97
+ "last_name"=>"Kowalski",
98
+ "authorized"=>nil,
99
+ "created_at"=>1381834598},
100
+ "deleted"=>false
101
+ }
102
+
103
+ Now if you want get customer's e-mail(or anoher field in 1st level of response) this short code should execute operation:
104
+
105
+ client.email
106
+ => "kowalski@example.com"
107
+
108
+ client.card
109
+ => {"company"=>"VI", "last4"=>"4242", "year"=>2019, "month"=>3, "first_name"=>"Jan", "last_name"=>"Kowalski", "authorized"=>nil, "created_at"=>1381834598}
24
110
 
25
- ### Sending request
111
+ ## All possible paths (resources)
26
112
 
27
- response = Espago.send_request(:clients, :get)
28
- response = Espago.clients :get
113
+ <table align="center">
114
+ <tr>
115
+ <th>Parameter</th><th>Description</th><th>Documentation link</th>
116
+ </tr>
117
+ <tr>
118
+ <th>tokens</th><td>special id for credit card</td><td>https://developers.espago.com/en/v3#244-card-tokens</td>
119
+ </tr>
120
+ <tr>
121
+ <th>clients</th><td>clients data</td><td>https://developers.espago.com/en/v3#255-customers</td>
122
+ </tr>
123
+ <tr>
124
+ <th>charges</th><td>credit payments</td><td>https://developers.espago.com/en/v3#209-card-payments</td>
125
+ </tr>
126
+ <tr>
127
+ <th>plans</th><td>plans for recurring payments</td><td>https://developers.espago.com/en/v3#222-plans</td>
128
+ </tr>
129
+ <tr>
130
+ <th>subscriptions</th><td>recurring payments for client according to the created plan</td><td>https://developers.espago.com/en/v3#228-subscriptions</td>
131
+ </tr>
132
+ <tr>
133
+ <th>invoices</th><td>single recurring payment</td><td>https://developers.espago.com/en/v3#234-invoices</td>
134
+ </tr>
135
+ <tr>
136
+ <th>line_items</th><td>element of every invoice</td><td>https://developers.espago.com/en/v3#241-getting-informations-about-line-items-of-invoice</td>
137
+ </tr>
138
+ </table>
@@ -0,0 +1,13 @@
1
+ module Espago::MasterpassHelper
2
+ def espago_masterpass_button(data)
3
+ render :partial => 'espago_masterpass/masterpass_button', :locals => { :data => Espago::Masterpass.prepare_form(data)}
4
+ end
5
+
6
+ def espago_masterpass_pairing_button(data)
7
+ render :partial => 'espago_masterpass/masterpass_pairing_button', :locals => { :data => Espago::Masterpass.prepare_pairing_form(data)}
8
+ end
9
+
10
+ def espago_masterpass_precheckout_button(data)
11
+ render :partial => 'espago_masterpass/masterpass_precheckout_button', :locals => { :data => Espago::Masterpass.prepare_precheckout_form(data)}
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Espago::SecureWebPageHelper
2
+ def espago_secure_web_page_form(data)
3
+ render :partial => 'espago_secure_web_page/form', :locals => { :data => Espago::SecureWebPage.prepare_form(data)}
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ = form_tag '',authenticity_token: false, id: :masterpass_espago_form do
2
+ = hidden_field_tag 'masterpass_action', data[:masterpass_action]
3
+ = hidden_field_tag 'app_id', data[:app_id]
4
+ = hidden_field_tag 'session_id', data[:session_id]
5
+ = hidden_field_tag 'amount', data[:amount]
6
+ = hidden_field_tag 'currency', data[:currency]
7
+ = hidden_field_tag 'description', data[:description]
8
+ = hidden_field_tag 'api_version', data[:api_version]
9
+ = hidden_field_tag 'checksum', data[:checksum]
10
+ - data[:shopping_cart_items].each_with_index do |shopping_cart_item,index|
11
+ = hidden_field_tag "shopping_cart_items[#{index}][description]", shopping_cart_item[:description]
12
+ = hidden_field_tag "shopping_cart_items[#{index}][quantity]", shopping_cart_item[:quantity]
13
+ = hidden_field_tag "shopping_cart_items[#{index}][value]", shopping_cart_item[:value]
14
+ = hidden_field_tag "shopping_cart_items[#{index}][image_url]", shopping_cart_item[:image_url]
15
+
16
+ .button
17
+ = button_tag( t("activerecord.models.espago.masterpass.buy"), style:'float:left')
18
+ #espagoloading{style:"display:none;float:left"}
19
+ %img{src:'https://sandbox.masterpass.com/lightbox/version90/Switch/assets/img/spinner.gif', style:'margin-left:10px;width:30px'}
20
+
@@ -0,0 +1,11 @@
1
+ = form_tag '',authenticity_token: false, id: :masterpass_espago_form do
2
+ = hidden_field_tag 'masterpass_action', data[:masterpass_action]
3
+ = hidden_field_tag 'app_id', data[:app_id]
4
+ = hidden_field_tag 'session_id', data[:session_id]
5
+ = hidden_field_tag 'user_id', data[:user_id]
6
+ = hidden_field_tag 'api_version', data[:api_version]
7
+ = hidden_field_tag 'checksum', data[:checksum]
8
+ .button
9
+ = button_tag( t("activerecord.models.espago.masterpass.pairing"), style:'float:left')
10
+ #espagoloading{style:"display:none;float:left"}
11
+ %img{src:'https://sandbox.masterpass.com/lightbox/version90/Switch/assets/img/spinner.gif', style:'margin-left:10px;width:30px'}
@@ -0,0 +1,21 @@
1
+ = form_tag '',authenticity_token: false, id: :masterpass_espago_form do
2
+ = hidden_field_tag 'masterpass_action', data[:masterpass_action]
3
+ = hidden_field_tag 'client_id', data[:client_id]
4
+ = hidden_field_tag 'app_id', data[:app_id]
5
+ = hidden_field_tag 'session_id', data[:session_id]
6
+ = hidden_field_tag 'amount', data[:amount]
7
+ = hidden_field_tag 'currency', data[:currency]
8
+ = hidden_field_tag 'description', data[:description]
9
+ = hidden_field_tag 'api_version', data[:api_version]
10
+ = hidden_field_tag 'checksum', data[:checksum]
11
+ - data[:shopping_cart_items].each_with_index do |shopping_cart_item,index|
12
+ = hidden_field_tag "shopping_cart_items[#{index}][description]", shopping_cart_item[:description]
13
+ = hidden_field_tag "shopping_cart_items[#{index}][quantity]", shopping_cart_item[:quantity]
14
+ = hidden_field_tag "shopping_cart_items[#{index}][value]", shopping_cart_item[:value]
15
+ = hidden_field_tag "shopping_cart_items[#{index}][image_url]", shopping_cart_item[:image_url]
16
+
17
+ / .button
18
+ / = button_tag( t("activerecord.models.espago.masterpass.buy"), style:'float:left')
19
+ #espagoloading{style:"display:none;float:left"}
20
+ %img{src:'https://sandbox.masterpass.com/lightbox/version90/Switch/assets/img/spinner.gif', style:'margin-left:10px;width:30px'}
21
+
@@ -0,0 +1,26 @@
1
+ = form_tag Espago::SecureWebPage.form_post, authenticity_token: false, id: :espago_secure_web_page do
2
+ = hidden_field_tag 'api_version', data[:api_version]
3
+ = hidden_field_tag 'app_id', data[:app_id]
4
+ = hidden_field_tag 'kind', data[:kind]
5
+
6
+ = hidden_field_tag 'session_id', data[:session_id]
7
+ = hidden_field_tag 'amount', data[:amount]
8
+ = hidden_field_tag 'currency', data[:currency]
9
+ = hidden_field_tag 'title', data[:title]
10
+
11
+ = hidden_field_tag 'description', data[:description]
12
+ = hidden_field_tag 'email', data[:email]
13
+ = hidden_field_tag 'positive_url', data[:positive_url]
14
+ = hidden_field_tag 'negative_url', data[:negative_url]
15
+
16
+ = hidden_field_tag 'ts', data[:ts]
17
+ = hidden_field_tag 'service_client_id', data[:service_client_id]
18
+ = hidden_field_tag 'checksum', data[:checksum]
19
+ - data[:shopping_cart_items].each_with_index do |shopping_cart_item,index|
20
+ = hidden_field_tag "shopping_cart_items[#{index}][description]", shopping_cart_item[:description]
21
+ = hidden_field_tag "shopping_cart_items[#{index}][quantity]", shopping_cart_item[:quantity]
22
+ = hidden_field_tag "shopping_cart_items[#{index}][value]", shopping_cart_item[:value]
23
+ = hidden_field_tag "shopping_cart_items[#{index}][image_url]", shopping_cart_item[:image_url]
24
+
25
+ .button
26
+ = button_tag( t("activerecord.models.espago.secure_web_page.buy"), style:'float:left')
data/espago.gemspec CHANGED
@@ -1,30 +1,37 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'espago/version'
5
4
 
6
5
  Gem::Specification.new do |gem|
7
- gem.name = "espago"
6
+ gem.name = 'espago'
8
7
  gem.version = Espago::VERSION
9
- gem.authors = ["Piotrek", "Szymon Fiedler"]
8
+
9
+ gem.authors = ["Piotrek", "Szymon Fiedler","Waclaw Luczak", "faramund"]
10
10
  gem.email = ["developers@espago.com"]
11
11
  gem.description = %q{Espago api wrapper}
12
12
  gem.summary = %q{Espago api wrapper}
13
13
  gem.homepage = ""
14
14
 
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ["lib"]
18
+ gem.require_paths = ['lib']
19
19
 
20
- gem.add_dependency "faraday"
20
+ gem.add_dependency "faraday", '>= 2.0.0'
21
+ gem.add_dependency "json", '>= 2.3.1'
21
22
  gem.add_dependency "facets"
23
+ gem.add_dependency "rails"
22
24
 
23
- gem.add_development_dependency "rspec"
25
+ gem.add_development_dependency "rspec", '>= 3.11.0'
26
+ gem.add_development_dependency 'rspec-its'
27
+ gem.add_development_dependency "byebug"
24
28
  gem.add_development_dependency "pry"
25
29
  gem.add_development_dependency "guard-rspec"
26
30
  gem.add_development_dependency "simplecov"
27
31
  gem.add_development_dependency "fuubar"
28
32
  gem.add_development_dependency 'rake'
29
33
  gem.add_development_dependency 'rb-fsevent', '~> 0.9.1'
34
+ gem.add_development_dependency 'webmock'
35
+ gem.add_development_dependency 'vcr'
36
+ # gem.add_development_dependency 'codeclimate-test-reporter'
30
37
  end