cobrato-client 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44745d96c828606a378b48c3eec185a933eeb0f5
4
- data.tar.gz: 483805f4fafb4cfccadc426fc081d7dfebbbd0be
3
+ metadata.gz: 60bd1d0603336c202bdd09716f01067fdf7bd706
4
+ data.tar.gz: 926a5e992a191427aa4959b3602c4d6643561666
5
5
  SHA512:
6
- metadata.gz: f3d886fe9dffaf436e0d544da17950dffaec58d0602595dbcf69ceb55f81c9f19cd4f516e24b8402b001000c9a218f64501eccd7172fe4573d030fae47c5c3c2
7
- data.tar.gz: 444b17d28d89f3dbfca4c2518fa86ff51d8c89fa473902fd0676a6cfac79f86113b64da62bfca0f97f69635aef360de3281a65e1b4c13d1bf6ee0fe375998193
6
+ metadata.gz: 162f90efc92c60d7132221b1adbf5ccfa0be5f267b27dedeafd473893380a087d7a060c07d02667e66be5c82b3e95bb8a9894d337c2b5239d16572b64efaaa0c
7
+ data.tar.gz: ab07b21905f923dc22cd41c53f88fe72607151d5b3a6d0c61aff22be39b8000d70a6f39f84218b3892db907fe3173d3e4b81e4502d78fbc1820814d286995615
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1.6
5
- - 2.2.2
3
+ - 2.1.8
4
+ - 2.2.4
5
+ - 2.3.0
6
6
  env:
7
7
  global:
8
8
  # CODECLIMATE_REPO_TOKEN
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cobrato-client (0.2.9)
4
+ cobrato-client (0.2.10)
5
5
  multi_json (~> 1.11.1)
6
6
  typhoeus (~> 0.7.2)
7
7
  virtus (~> 1.0.5)
data/lib/cobrato.rb CHANGED
@@ -6,6 +6,7 @@ require "cobrato/version"
6
6
  require "cobrato/configuration"
7
7
  require "cobrato/client"
8
8
  require "cobrato/http"
9
+ require "cobrato/signature"
9
10
 
10
11
  require "cobrato/entities/base"
11
12
  require "cobrato/entities/payee"
@@ -43,4 +44,8 @@ module Cobrato
43
44
  def self.subscribe(event, callback)
44
45
  Wisper.subscribe(callback, on: event, with: :call)
45
46
  end
47
+
48
+ def self.signature(secret)
49
+ Signature.new(secret)
50
+ end
46
51
  end
@@ -4,6 +4,7 @@ module Cobrato
4
4
  attribute :id, Integer
5
5
  attribute :description, String
6
6
  attribute :url, String
7
+ attribute :secret, String
7
8
  end
8
9
  end
9
- end
10
+ end
@@ -0,0 +1,14 @@
1
+ module Cobrato
2
+ class Signature
3
+ attr_accessor :secret
4
+
5
+ def initialize(secret)
6
+ @secret = secret
7
+ end
8
+
9
+ def check?(cobrato_request_id, signature_to_check, body)
10
+ cobrato_signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret, "#{cobrato_request_id}#{body}")
11
+ signature_to_check == cobrato_signature
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Cobrato
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobrato-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcio Ricardo Santos
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-02-01 00:00:00.000000000 Z
13
+ date: 2016-03-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
@@ -214,6 +214,7 @@ files:
214
214
  - lib/cobrato/resources/remittance_cnab.rb
215
215
  - lib/cobrato/resources/webhook.rb
216
216
  - lib/cobrato/response.rb
217
+ - lib/cobrato/signature.rb
217
218
  - lib/cobrato/version.rb
218
219
  homepage: https://github.com/myfreecomm/cobrato-client-ruby/
219
220
  licenses: []
@@ -235,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
236
  version: '0'
236
237
  requirements: []
237
238
  rubyforge_project:
238
- rubygems_version: 2.4.5.1
239
+ rubygems_version: 2.6.1
239
240
  signing_key:
240
241
  specification_version: 4
241
242
  summary: This is the official Ruby client for the Cobrato API.