powercash21 0.0.2 → 0.0.3

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
  SHA256:
3
- metadata.gz: e6008767146f6847216a56c3e260efdd669600ef6f2026c4babcf91d6a69dc33
4
- data.tar.gz: b6daf6ef158516169c5d7ce88c78a1c2c170c9efed5828cef9fd3e25ca5c44be
3
+ metadata.gz: 3dbe2d1ebd784e210b1e6997a9ef1c4eec673801ef523419cd1f1301f20b18df
4
+ data.tar.gz: 9c44deffa1ee4b357c6f1544b1ee58e5de2d6b63f657956bb01e8985c3560f43
5
5
  SHA512:
6
- metadata.gz: 63df6a8347ee5c8005427a8c0977a23b391e542322caca504b02cc485f5bcbfcb2826301aba1a4d45d7e3eadb3f68430686da3e9d8b33597f60671f8b53218f1
7
- data.tar.gz: 4d26d18cec45a2a32b4f357d444eb5e118823301d52d7e431f739a2c2b1c1691dfef7d1f97d314a7f77b1069499d1b0af6592ff4ec4260aeca472b82d0bdb81e
6
+ metadata.gz: 71a4fa5b615e648a9ce60928741ebd07ba20d451147cb302f467500d9bad41af82e42c31dede4a5a42cf94b2ec606425136da9170ed41fa9fdec9472babc6863
7
+ data.tar.gz: 2878ad1c9500ee2a8c04f9ad0dd48591e4912052c6cec96c98a8c4f721d042b5b22a674d8cbd933228a79d825730c108793c218638b99e00f6fc6636e3c8236f
File without changes
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ powercash21 (0.0.3)
5
+ faraday (~> 0.15.3)
6
+ faraday_middleware (~> 0.12.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.3)
12
+ faraday (0.15.4)
13
+ multipart-post (>= 1.2, < 3)
14
+ faraday_middleware (0.12.2)
15
+ faraday (>= 0.7.4, < 1.0)
16
+ multipart-post (2.0.0)
17
+ rake (10.5.0)
18
+ rspec (3.8.0)
19
+ rspec-core (~> 3.8.0)
20
+ rspec-expectations (~> 3.8.0)
21
+ rspec-mocks (~> 3.8.0)
22
+ rspec-core (3.8.0)
23
+ rspec-support (~> 3.8.0)
24
+ rspec-expectations (3.8.2)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.8.0)
27
+ rspec-mocks (3.8.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.8.0)
30
+ rspec-support (3.8.0)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ bundler (~> 1.17)
37
+ powercash21!
38
+ rake (~> 10.0)
39
+ rspec (~> 3.0)
40
+
41
+ BUNDLED WITH
42
+ 1.17.1
data/README.md CHANGED
@@ -30,6 +30,7 @@ Or create ENV variable POWERCASH21_SECRET_KEY ( ENV['POWERCASH21_SECRET_KEY'] )
30
30
 
31
31
  ## Usage
32
32
 
33
+ ```ruby
33
34
  powercash_client = Powercash21::Client.new
34
35
 
35
36
  url = 'pay/backoffice/tx_diagnose'
@@ -43,11 +44,11 @@ params = {
43
44
 
44
45
  response = powercash_client.post(url, params)
45
46
  response.body
46
-
47
+ ```
47
48
 
48
49
  ## Contributing
49
50
 
50
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/powercash21. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/zinggg/powercash21. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
52
 
52
53
  ## License
53
54
 
@@ -55,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
55
56
 
56
57
  ## Code of Conduct
57
58
 
58
- Everyone interacting in the Powercash21 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/powercash21/blob/master/CODE_OF_CONDUCT.md).
59
+ Everyone interacting in the Powercash21 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/zinggg/powercash21/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,35 @@
1
+ module Powercash21
2
+ class Client
3
+ require 'digest'
4
+ attr_accessor :secret_key
5
+
6
+ def initialize(secret_key: nil)
7
+ @secret_key = secret_key || Powercash21.secret_key
8
+ end
9
+
10
+ def connection
11
+ @connection ||= begin
12
+ Faraday.new(:url => 'https://sandbox.powerpay21.com') do |faraday|
13
+ faraday.request :url_encoded
14
+ faraday.adapter Faraday.default_adapter
15
+ end
16
+ end
17
+ end
18
+
19
+ def post(url, data = {})
20
+ connection.post(url, data)
21
+ end
22
+
23
+ def get(url, data = {})
24
+ connection.get(url, data)
25
+ end
26
+
27
+ private
28
+
29
+ def format_data(data)
30
+ sorted_hash = Hash[data.map{|k, v| [k.to_s.downcase, v]}.sort]
31
+ signature = sorted_hash.map {|kay,val| val}.join("").to_s + @secret_key
32
+ sorted_hash['signature'] = Digest::SHA1.hexdigest(signature)
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module Powercash21
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powercash21
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugeniu Tambur
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,14 +90,17 @@ files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
92
  - ".travis.yml"
93
+ - CHANGELOG.md
93
94
  - CODE_OF_CONDUCT.md
94
95
  - Gemfile
96
+ - Gemfile.lock
95
97
  - LICENSE.txt
96
98
  - README.md
97
99
  - Rakefile
98
100
  - bin/console
99
101
  - bin/setup
100
102
  - lib/powercash21.rb
103
+ - lib/powercash21/client.rb
101
104
  - lib/powercash21/version.rb
102
105
  - powercash21.gemspec
103
106
  homepage: https://github.com/zinggg/powercash21