quickpay-ruby-client 1.0.1 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +16 -0
- data/lib/quickpay.rb +0 -1
- data/lib/quickpay/api/request.rb +22 -14
- data/lib/quickpay/version.rb +1 -1
- data/quickpay-ruby-client.gemspec +4 -4
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39558975bb71b21a24e23dbb26e5061b89bd9f35
|
4
|
+
data.tar.gz: d83d53373168bbc250d98b3b802a3660011626e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dda9b126b854573119981d6e525a0e17e02b4096656d3db7ec68ed9bf4caed4ddbb5281b16e189ef4d530b3758a8753a5c7465b5c935c5ac5097060d41651a3
|
7
|
+
data.tar.gz: 6ba50abace736d75a9f470e7ee1a51aa05fd837a343fb05f337953d74dbe691e303a53f78eb3420e2d95969ff1323494343598bbb213d9f9ccc4746bef6fc340
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
|
4
|
+
## Unreleased
|
5
|
+
|
6
|
+
### Features:
|
7
|
+
|
8
|
+
(your contribution here)
|
9
|
+
|
10
|
+
### Bugfixes
|
11
|
+
|
12
|
+
(your contribution here)
|
13
|
+
|
14
|
+
|
15
|
+
## v1.1.0 (2016-01-11)
|
16
|
+
|
17
|
+
### Features:
|
18
|
+
|
19
|
+
- Send options to the underlaying HTTParty (https://github.com/QuickPay/quickpay-ruby-client/pull/16)
|
20
|
+
- Be able to upload files (https://github.com/QuickPay/quickpay-ruby-client/pull/17<Paste>)
|
data/README.md
CHANGED
@@ -111,3 +111,19 @@ end
|
|
111
111
|
```
|
112
112
|
|
113
113
|
You can read more about api responses at [http://tech.quickpay.net/api/](http://tech.quickpay.net/api).
|
114
|
+
|
115
|
+
## Contributions
|
116
|
+
|
117
|
+
To contribute:
|
118
|
+
|
119
|
+
1. Write a spec that fails
|
120
|
+
2. Fix spec by adding/changing code
|
121
|
+
3. Add feature or bugfix to changelog in the "Unreleased" section
|
122
|
+
4. Submit a pull request
|
123
|
+
5. World is now a better place! :)
|
124
|
+
|
125
|
+
### Running the specs
|
126
|
+
|
127
|
+
```
|
128
|
+
bundle exec rspec
|
129
|
+
```
|
data/lib/quickpay.rb
CHANGED
data/lib/quickpay/api/request.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
require 'httmultiparty'
|
1
2
|
|
2
3
|
module QuickPay
|
3
4
|
module API
|
4
5
|
class Request
|
5
|
-
include
|
6
|
+
include HTTMultiParty
|
7
|
+
|
8
|
+
attr_reader :options, :secret
|
6
9
|
|
7
10
|
def initialize (options = {})
|
8
|
-
@
|
11
|
+
@options = options.dup
|
12
|
+
@secret = @options.delete(:secret)
|
9
13
|
self.class.base_uri(options[:base_uri] || BASE_URI)
|
10
14
|
end
|
11
15
|
|
@@ -13,19 +17,23 @@ module QuickPay
|
|
13
17
|
raw = data.delete(:raw)
|
14
18
|
req_headers = headers.merge(data.delete(:headers) || {})
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
options = { body: data.to_json }
|
21
|
-
req_headers["Content-Type"] = "application/json"
|
20
|
+
http_options = options.dup
|
21
|
+
if data.any? { |_key, value| value.is_a?(File) }
|
22
|
+
http_options[:body] = data
|
23
|
+
http_options[:detect_mime_type] = true
|
22
24
|
else
|
23
|
-
|
25
|
+
case method
|
26
|
+
when :get, :delete
|
27
|
+
http_options[:query] = data
|
28
|
+
when :post, :patch, :put
|
29
|
+
http_options[:body] = data.to_json
|
30
|
+
req_headers["Content-Type"] = "application/json"
|
31
|
+
end
|
24
32
|
end
|
25
33
|
|
26
|
-
|
27
|
-
QuickPay.logger.debug { "#{method.to_s.upcase} #{base_uri}#{path} #{
|
28
|
-
create_response(raw, self.class.send(method, path,
|
34
|
+
http_options[:headers] = headers.merge(req_headers)
|
35
|
+
QuickPay.logger.debug { "#{method.to_s.upcase} #{base_uri}#{path} #{http_options}" }
|
36
|
+
create_response(raw, self.class.send(method, path, http_options))
|
29
37
|
end
|
30
38
|
|
31
39
|
def create_response raw, res
|
@@ -69,7 +77,7 @@ module QuickPay
|
|
69
77
|
'User-Agent' => user_agent,
|
70
78
|
'Accept-Version' => "v#{QuickPay::API_VERSION}"
|
71
79
|
}
|
72
|
-
heads['Authorization'] = "Basic #{authorization}" if
|
80
|
+
heads['Authorization'] = "Basic #{authorization}" if secret != nil
|
73
81
|
heads
|
74
82
|
end
|
75
83
|
|
@@ -83,7 +91,7 @@ module QuickPay
|
|
83
91
|
end
|
84
92
|
|
85
93
|
def authorization
|
86
|
-
Base64.strict_encode64(
|
94
|
+
Base64.strict_encode64(secret)
|
87
95
|
end
|
88
96
|
end
|
89
97
|
end
|
data/lib/quickpay/version.rb
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = QuickPay::VERSION
|
9
9
|
spec.authors = ["QuickPay Developers"]
|
10
10
|
spec.email = ["support@quickpay.net"]
|
11
|
-
|
11
|
+
|
12
12
|
spec.summary = "Ruby client for QuickPay API"
|
13
13
|
spec.description = "Embed QuickPay's secure payments directly into your Ruby applications. more at https://tech.quickpay.net"
|
14
14
|
spec.homepage = "https://github.com/QuickPay/quickpay-ruby-client"
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.2"
|
24
24
|
spec.add_development_dependency "rspec-mocks"
|
25
25
|
spec.add_development_dependency "webmock"
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
spec.add_development_dependency "pry-byebug"
|
27
|
+
|
28
|
+
spec.add_dependency "httmultiparty", "~> 0.3.16"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickpay-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QuickPay Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,19 +81,33 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: httmultiparty
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ~>
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 0.3.16
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - ~>
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 0.3.16
|
97
111
|
description: Embed QuickPay's secure payments directly into your Ruby applications.
|
98
112
|
more at https://tech.quickpay.net
|
99
113
|
email:
|
@@ -105,6 +119,7 @@ files:
|
|
105
119
|
- .gitignore
|
106
120
|
- .rspec
|
107
121
|
- .travis.yml
|
122
|
+
- CHANGELOG.md
|
108
123
|
- Gemfile
|
109
124
|
- LICENSE.txt
|
110
125
|
- README.md
|