tamara 0.1.0

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 (60) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +114 -0
  3. data/.rubocop_todo.yml +21 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +5 -0
  6. data/Gemfile +22 -0
  7. data/Gemfile.lock +227 -0
  8. data/Guardfile +42 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +290 -0
  11. data/Rakefile +19 -0
  12. data/lib/generators/tamara/install_generator.rb +15 -0
  13. data/lib/generators/tamara/templates/tamara.rb +8 -0
  14. data/lib/tamara/api/api_token.rb +14 -0
  15. data/lib/tamara/api/application_service.rb +48 -0
  16. data/lib/tamara/api/orders/authorize.rb +26 -0
  17. data/lib/tamara/api/orders/cancel.rb +38 -0
  18. data/lib/tamara/api/orders/create.rb +71 -0
  19. data/lib/tamara/api/orders/details/merchant_order.rb +28 -0
  20. data/lib/tamara/api/orders/details/tamara_order.rb +28 -0
  21. data/lib/tamara/api/orders.rb +56 -0
  22. data/lib/tamara/api/payment_options/check.rb +34 -0
  23. data/lib/tamara/api/payment_options.rb +13 -0
  24. data/lib/tamara/api/payment_types.rb +23 -0
  25. data/lib/tamara/api/payments/capture.rb +40 -0
  26. data/lib/tamara/api/payments.rb +16 -0
  27. data/lib/tamara/api/request.rb +49 -0
  28. data/lib/tamara/api/signature.rb +25 -0
  29. data/lib/tamara/api/webhooks.rb +28 -0
  30. data/lib/tamara/configuration.rb +5 -0
  31. data/lib/tamara/errors.rb +67 -0
  32. data/lib/tamara/hmac.rb +20 -0
  33. data/lib/tamara/json_schemas/address.rb +23 -0
  34. data/lib/tamara/json_schemas/amount.rb +19 -0
  35. data/lib/tamara/json_schemas/checkout_optional_keys.rb +11 -0
  36. data/lib/tamara/json_schemas/consumer.rb +21 -0
  37. data/lib/tamara/json_schemas/discount.rb +17 -0
  38. data/lib/tamara/json_schemas/item.rb +41 -0
  39. data/lib/tamara/json_schemas/merchant_url.rb +19 -0
  40. data/lib/tamara/json_schemas/orders/cancel.rb +30 -0
  41. data/lib/tamara/json_schemas/orders/create.rb +61 -0
  42. data/lib/tamara/json_schemas/payment_options/check.rb +25 -0
  43. data/lib/tamara/json_schemas/payment_types.rb +21 -0
  44. data/lib/tamara/json_schemas/payments/capture.rb +38 -0
  45. data/lib/tamara/json_schemas/risk_assessment.rb +65 -0
  46. data/lib/tamara/json_schemas/types/boolean.rb +15 -0
  47. data/lib/tamara/json_schemas/types/date.rb +17 -0
  48. data/lib/tamara/json_schemas/types/enum.rb +15 -0
  49. data/lib/tamara/json_schemas/types/float.rb +16 -0
  50. data/lib/tamara/json_schemas/types/integer.rb +17 -0
  51. data/lib/tamara/json_schemas/types/string.rb +21 -0
  52. data/lib/tamara/json_schemas/types/url.rb +15 -0
  53. data/lib/tamara/json_schemas/types/uuid.rb +19 -0
  54. data/lib/tamara/json_schemas/validator.rb +66 -0
  55. data/lib/tamara/json_schemas/webhook.rb +33 -0
  56. data/lib/tamara/json_schemas/webhook_event.rb +37 -0
  57. data/lib/tamara/version.rb +3 -0
  58. data/lib/tamara.rb +101 -0
  59. data/sig/tamara.rbs +4 -0
  60. metadata +181 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: edbc1e81e1dfb04e02c29172d32de538b96b94d60e4fdd804b949264f673d2a2
4
+ data.tar.gz: 0c61bb924be56b120664eea9de485230455fb939e614196c598aab55937623b0
5
+ SHA512:
6
+ metadata.gz: c10cf6d155ecf1c9fff7319146939c4cb0983f02d016e6137590cfdbc65e874a3ea48ae494421cef342b3ec437f1833c86f8878777e5c2d2bec7d3b02ceb5eb8
7
+ data.tar.gz: 224597005ae038a91d1eff545bcd2f994848f4f1052635582a4ee63f01155d449401614ffde12ff20fcd0267b421309845c66273bf3b2e6b385e13cce2488f5d
data/.rubocop.yml ADDED
@@ -0,0 +1,114 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rails
6
+ - rubocop-rake
7
+ - rubocop-rspec
8
+
9
+ AllCops:
10
+ SuggestExtensions: false
11
+ NewCops: enable
12
+ Exclude:
13
+ - 'vendor/**/*'
14
+ - 'bin/**/*'
15
+ - 'spec/fixtures/**/*'
16
+ - 'tmp/**/*'
17
+ - 'Guardfile'
18
+ TargetRubyVersion: 2.6.1
19
+
20
+ Bundler/OrderedGems:
21
+ Enabled: false
22
+
23
+ Metrics/BlockLength:
24
+ Exclude:
25
+ - 'Rakefile'
26
+ - '**/*.rake'
27
+ - 'spec/**/*.rb'
28
+
29
+ Metrics/ModuleLength:
30
+ Exclude:
31
+ - 'spec/**/*.rb'
32
+
33
+ Style/FetchEnvVar:
34
+ Enabled: false
35
+
36
+ Metrics/ParameterLists:
37
+ CountKeywordArgs: false
38
+
39
+ Layout/LineLength:
40
+ Max: 180
41
+
42
+ Layout/ClassStructure:
43
+ Enabled: true
44
+
45
+ Lint/MissingSuper:
46
+ Enabled: false
47
+
48
+ Metrics/MethodLength:
49
+ Max: 40
50
+
51
+ Style/FormatStringToken:
52
+ Enabled: false
53
+
54
+ Style/IfUnlessModifier:
55
+ Enabled: false
56
+
57
+ Style/OptionalBooleanParameter:
58
+ Enabled: false
59
+
60
+ Style/RegexpLiteral:
61
+ AllowInnerSlashes: true
62
+
63
+ Layout/MultilineMethodCallIndentation:
64
+ EnforcedStyle: indented
65
+
66
+ Layout/FirstArrayElementIndentation:
67
+ EnforcedStyle: consistent
68
+
69
+ Layout/EndOfLine:
70
+ EnforcedStyle: lf
71
+
72
+ Rails:
73
+ Enabled: true
74
+
75
+ Rails/FilePath:
76
+ Enabled: false
77
+
78
+ Rails/SkipsModelValidations:
79
+ Enabled: false
80
+
81
+ Rails/HelperInstanceVariable:
82
+ Enabled: false
83
+
84
+ Rails/UnknownEnv:
85
+ Enabled: false
86
+
87
+ Rails/HttpPositionalArguments:
88
+ Enabled: false
89
+
90
+ HttpPositionalArguments:
91
+ Enabled: false
92
+
93
+ HasAndBelongsToMany:
94
+ Enabled: false
95
+
96
+ Style/Documentation:
97
+ Enabled: false
98
+
99
+ Style/FrozenStringLiteralComment:
100
+ Enabled: false
101
+
102
+ Style/StringLiterals:
103
+ EnforcedStyle: double_quotes
104
+
105
+ RSpec/FilePath:
106
+ Exclude:
107
+ - 'spec/lib/generators/**/*'
108
+ - 'spec/lib/tamara/**/*'
109
+
110
+ RSpec/NestedGroups:
111
+ Max: 5
112
+
113
+ RSpec/VerifiedDoubles:
114
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,21 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-01-13 15:12:59 UTC using RuboCop version 1.60.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle.
12
+ # SupportedStyles: final_newline, final_blank_line
13
+ Layout/TrailingEmptyLines:
14
+ Exclude:
15
+ - 'lib/tamara_rails/json_schemas/user.rb'
16
+
17
+ # Offense count: 1
18
+ # This cop supports unsafe autocorrection (--autocorrect-all).
19
+ Lint/NonDeterministicRequireOrder:
20
+ Exclude:
21
+ - 'spec/spec_helper.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-06-01
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in tamara.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem "dotenv-rails"
8
+ gem "fuubar", "~> 2.5.1"
9
+ gem "guard-rspec"
10
+ gem "rake", "~> 13.2"
11
+ gem "rspec", "~> 3.13"
12
+ gem "rubocop", "~> 1.50.2"
13
+ gem "rubocop-performance", "~> 1.17.1"
14
+ gem "rubocop-rails", "~> 2.19.1"
15
+ end
16
+
17
+ group :test do
18
+ gem "generator_spec"
19
+ gem "simplecov", "~> 0.22.0"
20
+ gem "vcr"
21
+ gem "webmock", "~> 3.24"
22
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,227 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tamara (0.1.0)
5
+ activesupport (>= 5.2, < 7.0)
6
+ concurrent-ruby (~> 1.2.2)
7
+ faraday (~> 1.10.3)
8
+ json-schema (~> 4.3.1)
9
+ jwt (~> 2.2.1)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actionpack (6.1.7.10)
15
+ actionview (= 6.1.7.10)
16
+ activesupport (= 6.1.7.10)
17
+ rack (~> 2.0, >= 2.0.9)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.0)
20
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
21
+ actionview (6.1.7.10)
22
+ activesupport (= 6.1.7.10)
23
+ builder (~> 3.1)
24
+ erubi (~> 1.4)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
27
+ activesupport (6.1.7.10)
28
+ concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ i18n (>= 1.6, < 2)
30
+ minitest (>= 5.1)
31
+ tzinfo (~> 2.0)
32
+ zeitwerk (~> 2.3)
33
+ addressable (2.8.7)
34
+ public_suffix (>= 2.0.2, < 7.0)
35
+ ast (2.4.2)
36
+ bigdecimal (3.1.9)
37
+ builder (3.3.0)
38
+ coderay (1.1.3)
39
+ concurrent-ruby (1.2.3)
40
+ crack (1.0.0)
41
+ bigdecimal
42
+ rexml
43
+ crass (1.0.6)
44
+ diff-lcs (1.6.0)
45
+ docile (1.4.1)
46
+ dotenv (2.8.1)
47
+ dotenv-rails (2.8.1)
48
+ dotenv (= 2.8.1)
49
+ railties (>= 3.2)
50
+ erubi (1.13.1)
51
+ faraday (1.10.4)
52
+ faraday-em_http (~> 1.0)
53
+ faraday-em_synchrony (~> 1.0)
54
+ faraday-excon (~> 1.1)
55
+ faraday-httpclient (~> 1.0)
56
+ faraday-multipart (~> 1.0)
57
+ faraday-net_http (~> 1.0)
58
+ faraday-net_http_persistent (~> 1.0)
59
+ faraday-patron (~> 1.0)
60
+ faraday-rack (~> 1.0)
61
+ faraday-retry (~> 1.0)
62
+ ruby2_keywords (>= 0.0.4)
63
+ faraday-em_http (1.0.0)
64
+ faraday-em_synchrony (1.0.0)
65
+ faraday-excon (1.1.0)
66
+ faraday-httpclient (1.0.1)
67
+ faraday-multipart (1.1.0)
68
+ multipart-post (~> 2.0)
69
+ faraday-net_http (1.0.2)
70
+ faraday-net_http_persistent (1.2.0)
71
+ faraday-patron (1.0.0)
72
+ faraday-rack (1.0.0)
73
+ faraday-retry (1.0.3)
74
+ ffi (1.17.1)
75
+ formatador (1.1.0)
76
+ fuubar (2.5.1)
77
+ rspec-core (~> 3.0)
78
+ ruby-progressbar (~> 1.4)
79
+ generator_spec (0.10.0)
80
+ activesupport (>= 3.0.0)
81
+ railties (>= 3.0.0)
82
+ guard (2.19.1)
83
+ formatador (>= 0.2.4)
84
+ listen (>= 2.7, < 4.0)
85
+ logger (~> 1.6)
86
+ lumberjack (>= 1.0.12, < 2.0)
87
+ nenv (~> 0.1)
88
+ notiffany (~> 0.0)
89
+ ostruct (~> 0.6)
90
+ pry (>= 0.13.0)
91
+ shellany (~> 0.0)
92
+ thor (>= 0.18.1)
93
+ guard-compat (1.2.1)
94
+ guard-rspec (4.7.3)
95
+ guard (~> 2.1)
96
+ guard-compat (~> 1.1)
97
+ rspec (>= 2.99.0, < 4.0)
98
+ hashdiff (1.1.2)
99
+ i18n (1.14.7)
100
+ concurrent-ruby (~> 1.0)
101
+ json (2.7.6)
102
+ json-schema (4.3.1)
103
+ addressable (>= 2.8)
104
+ jwt (2.2.3)
105
+ listen (3.9.0)
106
+ rb-fsevent (~> 0.10, >= 0.10.3)
107
+ rb-inotify (~> 0.9, >= 0.9.10)
108
+ logger (1.6.6)
109
+ loofah (2.24.0)
110
+ crass (~> 1.0.2)
111
+ nokogiri (>= 1.12.0)
112
+ lumberjack (1.2.10)
113
+ method_source (1.1.0)
114
+ mini_portile2 (2.8.8)
115
+ minitest (5.25.4)
116
+ multipart-post (2.4.1)
117
+ nenv (0.3.0)
118
+ nokogiri (1.13.10)
119
+ mini_portile2 (~> 2.8.0)
120
+ racc (~> 1.4)
121
+ notiffany (0.1.3)
122
+ nenv (~> 0.1)
123
+ shellany (~> 0.0)
124
+ ostruct (0.6.1)
125
+ parallel (1.24.0)
126
+ parser (3.3.7.1)
127
+ ast (~> 2.4.1)
128
+ racc
129
+ pry (0.15.2)
130
+ coderay (~> 1.1)
131
+ method_source (~> 1.0)
132
+ public_suffix (5.1.1)
133
+ racc (1.8.1)
134
+ rack (2.2.11)
135
+ rack-test (2.2.0)
136
+ rack (>= 1.3)
137
+ rails-dom-testing (2.2.0)
138
+ activesupport (>= 5.0.0)
139
+ minitest
140
+ nokogiri (>= 1.6)
141
+ rails-html-sanitizer (1.5.0)
142
+ loofah (~> 2.19, >= 2.19.1)
143
+ railties (6.1.7.10)
144
+ actionpack (= 6.1.7.10)
145
+ activesupport (= 6.1.7.10)
146
+ method_source
147
+ rake (>= 12.2)
148
+ thor (~> 1.0)
149
+ rainbow (3.1.1)
150
+ rake (13.2.1)
151
+ rb-fsevent (0.11.2)
152
+ rb-inotify (0.11.1)
153
+ ffi (~> 1.0)
154
+ regexp_parser (2.10.0)
155
+ rexml (3.4.1)
156
+ rspec (3.13.0)
157
+ rspec-core (~> 3.13.0)
158
+ rspec-expectations (~> 3.13.0)
159
+ rspec-mocks (~> 3.13.0)
160
+ rspec-core (3.13.3)
161
+ rspec-support (~> 3.13.0)
162
+ rspec-expectations (3.13.3)
163
+ diff-lcs (>= 1.2.0, < 2.0)
164
+ rspec-support (~> 3.13.0)
165
+ rspec-mocks (3.13.2)
166
+ diff-lcs (>= 1.2.0, < 2.0)
167
+ rspec-support (~> 3.13.0)
168
+ rspec-support (3.13.2)
169
+ rubocop (1.50.2)
170
+ json (~> 2.3)
171
+ parallel (~> 1.10)
172
+ parser (>= 3.2.0.0)
173
+ rainbow (>= 2.2.2, < 4.0)
174
+ regexp_parser (>= 1.8, < 3.0)
175
+ rexml (>= 3.2.5, < 4.0)
176
+ rubocop-ast (>= 1.28.0, < 2.0)
177
+ ruby-progressbar (~> 1.7)
178
+ unicode-display_width (>= 2.4.0, < 3.0)
179
+ rubocop-ast (1.30.0)
180
+ parser (>= 3.2.1.0)
181
+ rubocop-performance (1.17.1)
182
+ rubocop (>= 1.7.0, < 2.0)
183
+ rubocop-ast (>= 0.4.0)
184
+ rubocop-rails (2.19.1)
185
+ activesupport (>= 4.2.0)
186
+ rack (>= 1.1)
187
+ rubocop (>= 1.33.0, < 2.0)
188
+ ruby-progressbar (1.13.0)
189
+ ruby2_keywords (0.0.5)
190
+ shellany (0.0.1)
191
+ simplecov (0.22.0)
192
+ docile (~> 1.1)
193
+ simplecov-html (~> 0.11)
194
+ simplecov_json_formatter (~> 0.1)
195
+ simplecov-html (0.13.1)
196
+ simplecov_json_formatter (0.1.4)
197
+ thor (1.3.2)
198
+ tzinfo (2.0.6)
199
+ concurrent-ruby (~> 1.0)
200
+ unicode-display_width (2.6.0)
201
+ vcr (6.1.0)
202
+ webmock (3.25.0)
203
+ addressable (>= 2.8.0)
204
+ crack (>= 0.3.2)
205
+ hashdiff (>= 0.4.0, < 2.0.0)
206
+ zeitwerk (2.6.18)
207
+
208
+ PLATFORMS
209
+ -darwin-22
210
+
211
+ DEPENDENCIES
212
+ dotenv-rails
213
+ fuubar (~> 2.5.1)
214
+ generator_spec
215
+ guard-rspec
216
+ rake (~> 13.2)
217
+ rspec (~> 3.13)
218
+ rubocop (~> 1.50.2)
219
+ rubocop-performance (~> 1.17.1)
220
+ rubocop-rails (~> 2.19.1)
221
+ simplecov (~> 0.22.0)
222
+ tamara!
223
+ vcr
224
+ webmock (~> 3.24)
225
+
226
+ BUNDLED WITH
227
+ 2.4.22
data/Guardfile ADDED
@@ -0,0 +1,42 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ directories(%w[lib config spec] \
6
+ .select { |d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist") })
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # NOTE: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Joe Kaldas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.