cieloz 0.0.20 → 0.0.21

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77964f0f33904c8eb3964429c696916c43da5a91
4
- data.tar.gz: 6f65d196587d27f886c781c0a049b1290c65b601
3
+ metadata.gz: 4c6abab787494fb941d6bfa10208971d50d430ac
4
+ data.tar.gz: e597e34b03aec7cc047f3cc66ed25c32e496d7f2
5
5
  SHA512:
6
- metadata.gz: 2cbc6e83a74d127cfe2c46bfdd570d0feb60eca2f6f9a9b2a423316988217725c36a98029e6974281151842eacd682d5ce4a0b6f55a68f3ab0130557d66ee9b5
7
- data.tar.gz: 75b0c51b42376501a1d7e255ee266f35a55bc493729c40a6f910cfb38b38d8eb2e2937491f6e2fe6aef3ab1c51efb5497eb3003bf6e753aafc752dfeb926f18d
6
+ metadata.gz: 55bd65325bd4bd7ef671d83d1c6df2f10ed5399dea6e3ec057815d32a73729f9eb34112974b7c7eeb4437e1a8e420c394277468dd332cb5a7ba2539b3f168e99
7
+ data.tar.gz: aa9053791efa6953a6d307ab6d49c1c6557c29ef3035bd013d6998bd35274edbe724a0157494cacba82136a049751d09aa37d0db4aa57b2e5bd4d4018f4f70a5
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
data/README.md CHANGED
@@ -216,56 +216,30 @@ When you provide values.
216
216
  ## Configuration
217
217
 
218
218
  Your application can configure Cieloz::Configuracao default values.
219
- In a Rails application, it can be done in a config/initializers/cieloz.rb file.
220
219
 
221
- If you don't provide ```credenciais```, all operations will be requested against Cielo Homologation Environment.
220
+ * If you don't provide ```credenciais```, all operations will be requested against Cielo Homologation Environment.
221
+ * When you go to production, you MUST configure ```credenciais``` with your Cielo ```numero``` and ```chave```.
222
222
 
223
- When you go to production, you MUST configure ```credenciais``` with your Cielo ```numero``` and ```chave```.
223
+ General settings can be placed in ```config/application.rb```:
224
224
 
225
- YourApp::Application.class_eval do
226
- # Runs in after initialize block to be able to access url helpers
227
- config.after_initialize do
228
- # must reload routes to initialize routes.url_helpers
229
- reload_routes!
225
+ module MyStore
226
+ class Application < Rails::Application
227
+ # ...
230
228
 
231
- # These are Global Default Settings, and can be overriden at Bulder / Requisicao method levels
232
- Cieloz::Configuracao.tap { |c|
233
- # 13 letters descriptor to be printed on the buyer's credit card billing
234
- c.soft_descriptor = "Your App name"
235
-
236
- # Callback url: in Cielo Mode this is the location to where Cielo redirects a transaction
237
- # after the user types this Credit card data.
238
- #
239
- # NOTICE: In order to *_url methods to work, it's required to set
240
- # in config/application.rb or in one of config/environment initializers:
241
- #
242
- # [Rails.application.]routes.default_url_options = { host: "HOSTNAME[:PORT]" }
243
- #
244
- c.url_retorno = routes.url_helpers.root_url
245
-
246
- # Credit card data is asked to the user in a page hosted by Cielo. This is the default mode
247
- # c.cielo_mode!
248
-
249
- # Your application must provide a view asking credit card data, and provide additional security,
250
- # in conformance with PCI Standards: http://www.cielo.com.br/portal/cielo/solucoes-de-tecnologia/o-que-e-ais.html
251
- # c.store_mode!
252
-
253
- # default to Cieloz::Homologacao::Credenciais::LOJA if store_mode? and ::CIELO if cielo_mode?
254
- # c.credenciais = { numero: "", chave: "" }
255
-
256
- # c.moeda = 986 # ISO 4217 - Manual Cielo, p 11
257
- # c.idioma = "PT" # EN and ES available - language to Cielo use in this pages
229
+ Cieloz::Configuracao.tap do |c|
230
+ c.store_mode!
231
+ c.soft_descriptor = "My Store Descriptor"
232
+ end
233
+ end
234
+ end
258
235
 
259
- # http://www.cielo.com.br/portal/cielo/produtos/cielo/parcelado-loja.html
260
- # c.max_parcelas = 3 # no additional interest rates
236
+ and settings specific per environment in respective config at ```config/environments``` directory.
261
237
 
262
- # http://www.cielo.com.br/portal/cielo/produtos/cielo/parcelado-administradora.html
263
- # c.max_adm_parcelas = 10 # available with Cielo interest rate
238
+ If you configure your server with environment variables, ```config/environments/production.rb``` can configure Cieloz:
264
239
 
265
- # if true, payments are automatically captured by authorization request
266
- # c.captura_automatica = false
267
- }
268
- end
240
+ Cieloz::Configuracao.credenciais.tap do |c|
241
+ c.numero = ENV["MY_STORE_CIELO_NUMERO"]
242
+ c.chave = ENV["MY_STORE_CIELO_CHAVE"]
269
243
  end
270
244
 
271
245
  ## Getting Started
@@ -25,6 +25,4 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency "turn"
26
26
  gem.add_development_dependency "vcr"
27
27
  gem.add_development_dependency "webmock"
28
-
29
- gem.add_development_dependency "debugger"
30
28
  end
@@ -39,7 +39,7 @@ class Cieloz::RequisicaoTransacao < Cieloz::Requisicao
39
39
  # validates string values because false.blank? is true, failing presence validation
40
40
  validates :capturar, inclusion: { in: ["true", "false"] }
41
41
 
42
- with_options if: "@autorizar != AUTORIZACAO_DIRETA" do |txn|
42
+ with_options if: -> { @autorizar != AUTORIZACAO_DIRETA } do |txn|
43
43
  txn.validates :url_retorno, presence: true
44
44
  txn.validates :url_retorno, length: { maximum: 1024 }
45
45
  end
@@ -19,18 +19,18 @@ class Cieloz::RequisicaoTransacao
19
19
  validates :parcelas, numericality: {
20
20
  only_integer: true, greater_than: 0,
21
21
  less_than_or_equal_to: Cieloz::Configuracao.max_parcelas
22
- }, if: "produto == PARCELADO_LOJA"
22
+ }, if: -> { produto == PARCELADO_LOJA }
23
23
 
24
24
  validates :parcelas, numericality: {
25
25
  only_integer: true,
26
26
  greater_than: Cieloz::Configuracao.max_parcelas,
27
27
  less_than_or_equal_to: Cieloz::Configuracao.max_adm_parcelas
28
- }, if: "produto == PARCELADO_ADM"
28
+ }, if: -> { produto == PARCELADO_ADM }
29
29
 
30
- validates :bandeira, inclusion: { in: BANDEIRAS_DEBITO }, if: "@produto == DEBITO"
31
- validates :bandeira, inclusion: { in: Cieloz::Bandeiras::ALL }, if: "@produto == CREDITO"
30
+ validates :bandeira, inclusion: { in: BANDEIRAS_DEBITO }, if: -> { @produto == DEBITO }
31
+ validates :bandeira, inclusion: { in: Cieloz::Bandeiras::ALL }, if: -> { @produto == CREDITO }
32
32
  validates :bandeira, inclusion: { in: BANDEIRAS_PARCELAMENTO },
33
- if: "[ PARCELADO_LOJA, PARCELADO_ADM ].include? @produto"
33
+ if: -> { [ PARCELADO_LOJA, PARCELADO_ADM ].include? @produto }
34
34
 
35
35
 
36
36
  def self.map_debito(source, opts={})
@@ -1,3 +1,3 @@
1
1
  module Cieloz
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
@@ -1,4 +1,3 @@
1
- require 'debugger'
2
1
  require 'cieloz'
3
2
 
4
3
  require 'minitest/autorun'
@@ -1,6 +1,6 @@
1
1
  describe Cieloz::Configuracao do
2
2
  let(:_) { Cieloz::Configuracao }
3
- let(:hash) { { numero: 123, chave: "abc123" } }
3
+ let(:_hash) { { numero: 123, chave: "abc123" } }
4
4
 
5
5
  before do
6
6
  _.reset!
@@ -65,11 +65,11 @@ describe Cieloz::Configuracao do
65
65
  end
66
66
 
67
67
  describe "set" do
68
- before { _.credenciais = hash }
68
+ before { _.credenciais = _hash }
69
69
 
70
70
  it "returns DadosEc with credenciais attributes" do
71
- _.credenciais.numero.must_equal hash[:numero]
72
- _.credenciais.chave.must_equal hash[:chave]
71
+ _.credenciais.numero.must_equal _hash[:numero]
72
+ _.credenciais.chave.must_equal _hash[:chave]
73
73
  end
74
74
 
75
75
  it "returns the same DadosEc in subsequent calls" do
@@ -84,7 +84,7 @@ describe Cieloz::Configuracao do
84
84
  end
85
85
 
86
86
  it "returns production host when credenciais is set" do
87
- _.credenciais = hash
87
+ _.credenciais = _hash
88
88
  _.host.must_equal Cieloz::Configuracao::HOST
89
89
  end
90
90
  end
metadata CHANGED
@@ -1,125 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cieloz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fábio Luiz Nery de Miranda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activemodel
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: turn
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: vcr
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: debugger
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '>='
108
+ - - ">="
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  description: A utility gem for Cielo Integration
@@ -129,7 +115,8 @@ executables: []
129
115
  extensions: []
130
116
  extra_rdoc_files: []
131
117
  files:
132
- - .gitignore
118
+ - ".gitignore"
119
+ - ".travis.yml"
133
120
  - Gemfile
134
121
  - LICENSE.txt
135
122
  - README.md
@@ -199,17 +186,17 @@ require_paths:
199
186
  - lib
200
187
  required_ruby_version: !ruby/object:Gem::Requirement
201
188
  requirements:
202
- - - '>='
189
+ - - ">="
203
190
  - !ruby/object:Gem::Version
204
191
  version: '0'
205
192
  required_rubygems_version: !ruby/object:Gem::Requirement
206
193
  requirements:
207
- - - '>='
194
+ - - ">="
208
195
  - !ruby/object:Gem::Version
209
196
  version: '0'
210
197
  requirements: []
211
198
  rubyforge_project:
212
- rubygems_version: 2.0.3
199
+ rubygems_version: 2.2.2
213
200
  signing_key:
214
201
  specification_version: 4
215
202
  summary: ''