stone-ruby 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +21 -0
  3. data/.rubocop.yml +28 -0
  4. data/Gemfile +4 -2
  5. data/Gemfile.lock +56 -2
  6. data/Rakefile +5 -3
  7. data/bin/console +4 -3
  8. data/lib/stone-ruby.rb +3 -1
  9. data/lib/stone.rb +7 -2
  10. data/lib/stone/conciliation.rb +3 -1
  11. data/lib/stone/conciliation/client.rb +5 -6
  12. data/lib/stone/conciliation/client/access_authorization.rb +3 -3
  13. data/lib/stone/conciliation/error.rb +2 -0
  14. data/lib/stone/siclos.rb +4 -1
  15. data/lib/stone/siclos/client.rb +40 -39
  16. data/lib/stone/siclos/client/claim_check.rb +8 -8
  17. data/lib/stone/siclos/client/danfe.rb +8 -8
  18. data/lib/stone/siclos/client/establishment.rb +7 -7
  19. data/lib/stone/siclos/client/finance.rb +3 -3
  20. data/lib/stone/siclos/client/pos.rb +10 -10
  21. data/lib/stone/siclos/client/pre_transaction.rb +8 -8
  22. data/lib/stone/siclos/client/recipient.rb +7 -7
  23. data/lib/stone/siclos/client/token.rb +2 -0
  24. data/lib/stone/siclos/client/transaction.rb +7 -7
  25. data/lib/stone/siclos/client/webhook.rb +15 -15
  26. data/lib/stone/siclos/entity.rb +25 -0
  27. data/lib/stone/siclos/entity/address.rb +17 -0
  28. data/lib/stone/siclos/entity/anticipation.rb +13 -0
  29. data/lib/stone/siclos/entity/bank.rb +16 -0
  30. data/lib/stone/siclos/entity/capture_method.rb +14 -0
  31. data/lib/stone/siclos/entity/card_rate.rb +16 -0
  32. data/lib/stone/siclos/entity/contact.rb +13 -0
  33. data/lib/stone/siclos/entity/contact_recipient.rb +11 -0
  34. data/lib/stone/siclos/entity/create_establishment.rb +28 -0
  35. data/lib/stone/siclos/entity/create_establishment_existing.rb +17 -0
  36. data/lib/stone/siclos/entity/create_recipient.rb +24 -0
  37. data/lib/stone/siclos/entity/create_recipient_existing.rb +18 -0
  38. data/lib/stone/siclos/entity/responsible.rb +12 -0
  39. data/lib/stone/siclos/entity/responsible_recipient.rb +14 -0
  40. data/lib/stone/siclos/error.rb +2 -0
  41. data/lib/stone/types.rb +15 -0
  42. data/lib/stone/version.rb +4 -2
  43. data/stone-ruby.gemspec +8 -4
  44. metadata +64 -5
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class CreateEstablishment < Base
7
+ attribute :is_establishment_to_production, Types::Params::Bool.optional.default(false)
8
+ attribute :legal_name, Types::Coercible::String
9
+ attribute :business_name, Types::Coercible::String
10
+ attribute :document_number, Types::OnlyNumbersString
11
+ attribute :tpv, Types::AmountFormatted
12
+ attribute :mcc, Types::Coercible::Integer
13
+ attribute :email_access_stone, Types::Coercible::String
14
+ attribute :cell_phone, Types::OnlyNumbersString.optional.default(nil)
15
+ attribute :partner_stone_id, Types::Coercible::Integer.optional.default(nil)
16
+
17
+ attribute :capture_method, CaptureMethod
18
+ attribute :responsible, Responsible.optional.default(nil)
19
+ attribute :contact, Contact.optional.default(nil)
20
+ attribute :anticipation, Anticipation.optional.default(nil)
21
+ attribute :cards_rate, Types::Coercible::Array.of(CardRate)
22
+
23
+ attribute :address, Address
24
+ attribute :bank, Bank
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class CreateEstablishmentExisting < Base
7
+ attribute :is_establishment_to_production, Types::Params::Bool.optional.default(false)
8
+ attribute :legal_name, Types::Coercible::String
9
+ attribute :business_name, Types::Coercible::String
10
+ attribute :document_number, Types::Coercible::String
11
+ attribute :stone_code, Types::Coercible::String
12
+ attribute :cards_rate, Types::Coercible::Array.of(CardRate).optional.default(nil)
13
+ attribute :address, Address
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class CreateRecipient < Base
7
+ attribute :establishment_id, Types::Coercible::String
8
+ attribute :is_recipient_to_production, Types::Params::Bool.optional.default(false)
9
+ attribute :recipient_name_abbreviated, Types::Coercible::String
10
+ attribute :recipient_name, Types::Coercible::String
11
+ attribute :document_number, Types::Coercible::String
12
+ attribute :business_name, Types::Coercible::String
13
+ attribute :mcc, Types::Coercible::Integer
14
+ attribute :partner_stone_id, Types::Coercible::Integer.optional.default(nil)
15
+
16
+ attribute :anticipation, Anticipation.optional.default(nil)
17
+ attribute :address, Address
18
+ attribute :bank, Bank
19
+ attribute :contact, ContactRecipient.optional.default(nil)
20
+ attribute :responsible, ResponsibleRecipient.optional.default(nil)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class CreateRecipientExisting < Base
7
+ attribute :establishment_id, Types::Coercible::String
8
+ attribute :is_recipient_to_production, Types::Params::Bool.optional.default(false)
9
+ attribute :recipient_name, Types::Coercible::String
10
+ attribute :document_number, Types::Coercible::String
11
+ attribute :business_name, Types::Coercible::String
12
+ attribute :stone_code, Types::Coercible::String
13
+
14
+ attribute :address, Address
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class Responsible < Base
7
+ attribute :name, Types::Coercible::String.optional.default(nil)
8
+ attribute :cpf, Types::Coercible::String.optional.default(nil)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class ResponsibleRecipient < Base
7
+ attribute :name, Types::Coercible::String
8
+ attribute :cell_phone, Types::OnlyNumbersString.optional.default(nil)
9
+ attribute :document_number, Types::Coercible::String.optional.default(nil)
10
+ attribute :name, Types::Coercible::String.optional.default(nil)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  class Error < StandardError
3
5
  class TokenError < Error; end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Types
5
+ include Dry.Types(default: :nominal)
6
+
7
+ AmountFormatted = Integer.constructor(lambda do |value|
8
+ ActiveSupport::NumberHelper.number_to_currency(value, unit: '', separator: '', delimiter: '').to_i
9
+ end)
10
+
11
+ OnlyNumbersString = String.constructor(lambda do |value|
12
+ String(value).gsub(/[^\d]/, '').to_s
13
+ end)
14
+ end
15
+ end
data/lib/stone/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone
2
- VERSION = '0.0.2'
3
- end
4
+ VERSION = '0.1.0'
5
+ end
data/stone-ruby.gemspec CHANGED
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
5
6
  require 'stone/version'
@@ -12,7 +13,7 @@ Gem::Specification.new do |spec|
12
13
 
13
14
  spec.summary = 'API Wrapper for Stone Payments'
14
15
  spec.description = 'API Wrapper for Stone Payments'
15
- spec.homepage = "https://github.com/marcosgugs/stone-ruby"
16
+ spec.homepage = 'https://github.com/marcosgugs/stone-ruby'
16
17
 
17
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
19
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -29,7 +30,7 @@ Gem::Specification.new do |spec|
29
30
 
30
31
  # Specify which files should be added to the gem when it is released.
31
32
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
33
34
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
35
  end
35
36
  spec.bindir = 'exe'
@@ -37,10 +38,13 @@ Gem::Specification.new do |spec|
37
38
  spec.require_paths = ['lib']
38
39
 
39
40
  spec.add_dependency 'dry-configurable', '~> 0.8.3'
40
- spec.add_dependency 'typhoeus', '~> 1.0.2'
41
+ spec.add_dependency 'dry-struct', '~> 0.7'
41
42
  spec.add_dependency 'request_store_rails', '~> 2.0.0'
43
+ spec.add_dependency 'typhoeus', '~> 1.0.2'
44
+ spec.add_dependency 'activesupport', '~> 4.2'
42
45
 
43
46
  spec.add_development_dependency 'bundler', '~> 1.17'
44
47
  spec.add_development_dependency 'rake', '~> 10.0'
45
48
  spec.add_development_dependency 'rspec', '~> 3.0'
49
+ spec.add_development_dependency 'rubocop', '0.80.1'
46
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stone-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Junior
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.3
27
27
  - !ruby/object:Gem::Dependency
28
- name: typhoeus
28
+ name: dry-struct
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.2
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.2
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: request_store_rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: typhoeus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.2
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.2'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: bundler
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +122,20 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: '3.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.80.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.80.1
97
139
  description: API Wrapper for Stone Payments
98
140
  email:
99
141
  - marcos.junior@rhsoftware.com.br
@@ -102,6 +144,7 @@ extensions: []
102
144
  extra_rdoc_files: []
103
145
  files:
104
146
  - ".DS_Store"
147
+ - ".editorconfig"
105
148
  - ".gitignore"
106
149
  - ".idea/.gitignore"
107
150
  - ".idea/.rakeTasks"
@@ -111,6 +154,7 @@ files:
111
154
  - ".idea/vcs.xml"
112
155
  - ".rakeTasks"
113
156
  - ".rspec"
157
+ - ".rubocop.yml"
114
158
  - ".tool-versions"
115
159
  - ".travis.yml"
116
160
  - Gemfile
@@ -138,7 +182,22 @@ files:
138
182
  - lib/stone/siclos/client/token.rb
139
183
  - lib/stone/siclos/client/transaction.rb
140
184
  - lib/stone/siclos/client/webhook.rb
185
+ - lib/stone/siclos/entity.rb
186
+ - lib/stone/siclos/entity/address.rb
187
+ - lib/stone/siclos/entity/anticipation.rb
188
+ - lib/stone/siclos/entity/bank.rb
189
+ - lib/stone/siclos/entity/capture_method.rb
190
+ - lib/stone/siclos/entity/card_rate.rb
191
+ - lib/stone/siclos/entity/contact.rb
192
+ - lib/stone/siclos/entity/contact_recipient.rb
193
+ - lib/stone/siclos/entity/create_establishment.rb
194
+ - lib/stone/siclos/entity/create_establishment_existing.rb
195
+ - lib/stone/siclos/entity/create_recipient.rb
196
+ - lib/stone/siclos/entity/create_recipient_existing.rb
197
+ - lib/stone/siclos/entity/responsible.rb
198
+ - lib/stone/siclos/entity/responsible_recipient.rb
141
199
  - lib/stone/siclos/error.rb
200
+ - lib/stone/types.rb
142
201
  - lib/stone/version.rb
143
202
  - stone-ruby.gemspec
144
203
  homepage: https://github.com/marcosgugs/stone-ruby