billplz-api 0.1.0 → 0.2.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/README.md +41 -9
- data/billplz-api.gemspec +1 -1
- data/lib/billplz/bill.rb +4 -7
- data/lib/billplz/collection.rb +3 -9
- data/lib/billplz/model.rb +4 -1
- data/lib/billplz/open_collection.rb +9 -0
- data/lib/billplz/registration.rb +7 -0
- data/lib/billplz/version.rb +1 -1
- data/lib/billplz-api.rb +3 -2
- metadata +4 -3
- data/lib/billplz/registration_check.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3b2626f1b890903f400a3f7ee2504361be696a9
|
4
|
+
data.tar.gz: b254c525480982c46e48672721222c55a2ba59c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ecef2cd79268cd614d504e4cb8c88649a801cc49aabb318fc6527ceccf42ade6ee043c005fbc41f93a2393d279ad01fb5eff7deedce74e1ffa465d7c51134c4
|
7
|
+
data.tar.gz: 84360b128b3f57ea95302d2bf0f6df797bcc4dc53f14526ee856854cf6bf62652e0dc83b3173457fb70067ff7df93ecc3fc78b98996788cd593e373a78e3e692
|
data/README.md
CHANGED
@@ -24,21 +24,36 @@ $ gem install billplz-api
|
|
24
24
|
|
25
25
|
##Configuration
|
26
26
|
You need to store your Billplz configuration setting in billplz.rb
|
27
|
-
```
|
27
|
+
```ruby
|
28
28
|
# config/initializers/billplz.rb
|
29
29
|
Billplz.configure do |config|
|
30
30
|
config.api_key = ENV['API_KEY_BILLPLZ']
|
31
|
-
config.api_url = ENV['API_URL_BILLPLZ']
|
31
|
+
config.api_url = ENV['API_URL_BILLPLZ']
|
32
|
+
#staging api url https://billplz-staging.herokuapp.com
|
33
|
+
#production api url https://www.billplz.com/
|
32
34
|
end
|
33
35
|
```
|
34
36
|
|
35
37
|
##Usage
|
36
|
-
|
38
|
+
###Collection
|
39
|
+
|
40
|
+
**Find all collection**
|
41
|
+
```ruby
|
42
|
+
collections = Billplz::Collection.all
|
43
|
+
#or
|
44
|
+
collections = Billplz::Collection.all(page: 1)
|
45
|
+
```
|
37
46
|
|
38
47
|
**Create a collection**
|
39
48
|
```ruby
|
40
49
|
collection = Billplz::Collection.create(title: "Billplz Testing Collection")
|
41
50
|
# { "id": "inbmmepb", "title": "Billplz Testing Collection"}
|
51
|
+
#get data from collection
|
52
|
+
collection.id # "inbmmepb"
|
53
|
+
collection.title # "Billplz Testing Collection"
|
54
|
+
#or
|
55
|
+
collection['id'] # "inbmmepb"
|
56
|
+
collection['title'] # "Billplz Testing Collection"
|
42
57
|
```
|
43
58
|
|
44
59
|
**Deactivate a collection**
|
@@ -51,18 +66,30 @@ collection = Billplz::Collection.deactivate(id: "alocpanfu")
|
|
51
66
|
collection = Billplz::Collection.activate(id: "alocpanfu")
|
52
67
|
```
|
53
68
|
|
54
|
-
|
69
|
+
###Open Collection
|
70
|
+
|
71
|
+
**Find all open collection**
|
72
|
+
```ruby
|
73
|
+
open_collections = Billplz::OpenCollection.all
|
74
|
+
#or
|
75
|
+
open_collections = Billplz::OpenCollection.all(page: 2)
|
76
|
+
```
|
55
77
|
|
56
78
|
**Create an open collection**
|
57
79
|
```ruby
|
58
|
-
open_collection = Billplz::
|
80
|
+
open_collection = Billplz::OpenCollection.create(title: "Billplz Testing Collection", description: "Membayar Zakat merupakan kewajiban semua umat Islam bagi yang mampu.", amount: 299)
|
81
|
+
```
|
82
|
+
|
83
|
+
**Find an open collection**
|
84
|
+
```ruby
|
85
|
+
open_collection = Billplz::OpenCollection.find(id: 0pp87t_6)
|
59
86
|
```
|
60
87
|
|
61
|
-
|
88
|
+
###Bill
|
62
89
|
|
63
90
|
**Create a bill**
|
64
91
|
```ruby
|
65
|
-
bill = Billplz::Bill.create(
|
92
|
+
bill = Billplz::Bill.create(collection_id: "ajij091j", email: "admin@billplz.com", name:"Admin BillPlz", amount: 200, callback_url: "billplz.com", description: "Shopping Items")
|
66
93
|
```
|
67
94
|
|
68
95
|
**Get a bill**
|
@@ -75,11 +102,16 @@ bill = Billplz::Bill.find(id: "arutnv89")
|
|
75
102
|
bill = Billplz::Bill.delete(id: "arutnv89")
|
76
103
|
```
|
77
104
|
|
78
|
-
**
|
105
|
+
**Get transactions of a bill**
|
106
|
+
```ruby
|
107
|
+
transactions = Billplz::Bill.transactions(bill_id: "arutnv89")
|
108
|
+
```
|
109
|
+
|
110
|
+
###Registration Check
|
79
111
|
|
80
112
|
Enter bank account number
|
81
113
|
```ruby
|
82
|
-
registration_check = Billplz::
|
114
|
+
registration_check = Billplz::Registration.check(account_number: "123465782312")
|
83
115
|
```
|
84
116
|
|
85
117
|
|
data/billplz-api.gemspec
CHANGED
data/lib/billplz/bill.rb
CHANGED
@@ -4,16 +4,13 @@ module Billplz
|
|
4
4
|
before_request :set_base_url
|
5
5
|
before_request :replace_body
|
6
6
|
|
7
|
-
get :find, "/:id"
|
8
|
-
|
9
|
-
|
7
|
+
get :find, "/bills/:id"
|
8
|
+
get :transactions, "/bills/:bill_id/transactions"
|
9
|
+
post :create, "/bills"
|
10
|
+
delete :delete, "/bills/:id"
|
10
11
|
|
11
12
|
private
|
12
13
|
|
13
|
-
def set_base_url(name, request)
|
14
|
-
Flexirest::Base.base_url = "#{Billplz.configuration.api_url}/bills"
|
15
|
-
end
|
16
|
-
|
17
14
|
def replace_body(name, request)
|
18
15
|
if name == :create
|
19
16
|
#add collection id here
|
data/lib/billplz/collection.rb
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
module Billplz
|
2
2
|
class Collection < Model
|
3
|
-
before_request :set_base_url
|
4
|
-
#before_request :replace_body
|
5
3
|
|
6
|
-
|
7
|
-
|
4
|
+
get :all, "/collections"
|
5
|
+
get :find, "/collections/:id"
|
6
|
+
post :create, "/collections"
|
8
7
|
post :deactivate, "/collections/:id/deactivate"
|
9
8
|
post :activate, "/collections/:id/activate"
|
10
9
|
|
11
|
-
private
|
12
|
-
|
13
|
-
def set_base_url(name, request)
|
14
|
-
Flexirest::Base.base_url = "#{Billplz.configuration.api_url}"
|
15
|
-
end
|
16
10
|
|
17
11
|
end
|
18
12
|
end
|
data/lib/billplz/model.rb
CHANGED
@@ -3,7 +3,7 @@ module Billplz
|
|
3
3
|
perform_caching false
|
4
4
|
#verbose!
|
5
5
|
request_body_type :json
|
6
|
-
|
6
|
+
before_request :set_base_url
|
7
7
|
before_request :replace_token_in_url
|
8
8
|
|
9
9
|
|
@@ -14,6 +14,9 @@ module Billplz
|
|
14
14
|
request.headers["Authorization"] = auth
|
15
15
|
end
|
16
16
|
|
17
|
+
def set_base_url(name, request)
|
18
|
+
Flexirest::Base.base_url = "#{Billplz.configuration.api_url}"
|
19
|
+
end
|
17
20
|
|
18
21
|
end
|
19
22
|
end
|
data/lib/billplz/version.rb
CHANGED
data/lib/billplz-api.rb
CHANGED
@@ -2,13 +2,14 @@ require 'net/http'
|
|
2
2
|
require 'uri'
|
3
3
|
require 'json'
|
4
4
|
require 'base64'
|
5
|
-
|
5
|
+
require "flexirest"
|
6
6
|
require "billplz/version"
|
7
7
|
require "billplz/configuration"
|
8
8
|
require "billplz/model"
|
9
9
|
require "billplz/bill"
|
10
10
|
require "billplz/collection"
|
11
|
-
require "billplz/
|
11
|
+
require "billplz/open_collection"
|
12
|
+
require "billplz/registration"
|
12
13
|
|
13
14
|
module Billplz
|
14
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billplz-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mkhairi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -59,7 +59,8 @@ files:
|
|
59
59
|
- lib/billplz/collection.rb
|
60
60
|
- lib/billplz/configuration.rb
|
61
61
|
- lib/billplz/model.rb
|
62
|
-
- lib/billplz/
|
62
|
+
- lib/billplz/open_collection.rb
|
63
|
+
- lib/billplz/registration.rb
|
63
64
|
- lib/billplz/version.rb
|
64
65
|
homepage: https://github.com/mkhairi/billplz-api
|
65
66
|
licenses:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Billplz
|
2
|
-
class RegistrationCheck < Model
|
3
|
-
before_request :set_base_url
|
4
|
-
#before_request :replace_body
|
5
|
-
|
6
|
-
get :find, "/:id"
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
|
-
def set_base_url(name, request)
|
11
|
-
Flexirest::Base.base_url = "#{Billplz.configuration.api_url}/check/bank_account_number"
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|