paylike 0.1.1
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 +7 -0
- data/lib/paylike.rb +15 -0
- data/lib/paylike/api.rb +37 -0
- data/lib/paylike/configuration.rb +25 -0
- data/lib/paylike/endpoints.rb +21 -0
- data/lib/paylike/request.rb +9 -0
- data/lib/paylike/version.rb +3 -0
- data/paylike.gemspec +15 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d0dc4c788a00dd202f5c17073e332e157d66b907
|
4
|
+
data.tar.gz: 37624ab40652103e09ad515ae89406c7d5cc6805
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 33a3d9f6409b28161d64bc56cfdf27757d62b38e74a701b8206d799966c9559fbd3bf935007a710c82ba4752f502690bc8e141545c0df944055e69f44afed6ad
|
7
|
+
data.tar.gz: e7f3f046dfd85fa45d365a013358d9b96fc0a62fcaca3a36b4ccc017f5bee1c5ae1b101427dec8e47f7cb9fd755b2989808421b26d96ac2d4ea3a821c8fbc281
|
data/lib/paylike.rb
ADDED
data/lib/paylike/api.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Paylike
|
2
|
+
class Api
|
3
|
+
|
4
|
+
#
|
5
|
+
# Fetch current app
|
6
|
+
#
|
7
|
+
|
8
|
+
def self.me
|
9
|
+
req = Request._http(Endpoints.me)
|
10
|
+
req.body if req.code == 200
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Fetch a transaction
|
15
|
+
#
|
16
|
+
|
17
|
+
def self.transaction(transaction_id)
|
18
|
+
req = Request._http(Endpoints.transaction(transaction_id))
|
19
|
+
req.body if req.code == 200
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Generate Payment Link
|
24
|
+
#
|
25
|
+
|
26
|
+
def self.generate_payment_link(amount, currency=nil, reference=nil, text=nil, url=nil)
|
27
|
+
public_key = Configuration.public_key
|
28
|
+
currency ||= "EUR"
|
29
|
+
"#{Endpoints.pos}?key=#{public_key}&amount=#{amount}¤cy=#{currency}#{reference ? "&reference=#{reference}" : ""}#{text ? "&text=#{text}" : ""}#{url ? "&redirect=#{url}" : ""}&locale=en_US"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.generate_payment_link_encoded(amount, currency=nil, reference=nil, text=nil, url=nil)
|
33
|
+
URI.encode(generate_payment_link(amount, currency, reference, text, url))
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Paylike
|
2
|
+
class Configuration
|
3
|
+
|
4
|
+
READABLE_ATTRIBUTES = [
|
5
|
+
:public_key,
|
6
|
+
:private_key
|
7
|
+
]
|
8
|
+
|
9
|
+
WRITABLE_ATTRIBUTES = [
|
10
|
+
:public_key,
|
11
|
+
:private_key
|
12
|
+
]
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_writer *WRITABLE_ATTRIBUTES
|
16
|
+
attr_reader *READABLE_ATTRIBUTES
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def self.test_key
|
21
|
+
raise "Configuration error: Private key is missing." unless private_key
|
22
|
+
puts private_key
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Endpoints
|
2
|
+
|
3
|
+
def self.base_url
|
4
|
+
"https://api.paylike.io/"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.pos
|
8
|
+
"https://pos.paylike.io/"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.me
|
12
|
+
"#{base_url}" + "me"
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.transaction(transaction_id)
|
16
|
+
"#{base_url}" + "transactions/" + transaction_id
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
|
data/paylike.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "paylike"
|
5
|
+
s.version = "0.1.1"
|
6
|
+
s.date = "2016-12-09"
|
7
|
+
s.summary = "Paylike gem"
|
8
|
+
s.description = "Paylike"
|
9
|
+
s.authors = ["Kostas Lamprou"]
|
10
|
+
s.email = "lamprou@live.com"
|
11
|
+
#s.files = ["lib/Paylike.rb"]
|
12
|
+
s.files = Dir.glob ["lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
13
|
+
s.license = "MIT"
|
14
|
+
s.homepage = "http://rubygems.org/gems/paylike"
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paylike
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kostas Lamprou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Paylike
|
14
|
+
email: lamprou@live.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/paylike.rb
|
20
|
+
- lib/paylike/api.rb
|
21
|
+
- lib/paylike/configuration.rb
|
22
|
+
- lib/paylike/endpoints.rb
|
23
|
+
- lib/paylike/request.rb
|
24
|
+
- lib/paylike/version.rb
|
25
|
+
- paylike.gemspec
|
26
|
+
homepage: http://rubygems.org/gems/paylike
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.4.7
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: Paylike gem
|
50
|
+
test_files: []
|