billplz-api 0.2.0 → 0.2.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 +4 -4
- data/README.md +6 -6
- data/lib/billplz/bill.rb +0 -13
- data/lib/billplz/configuration.rb +4 -4
- data/lib/billplz/model.rb +6 -5
- data/lib/billplz/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2db165a37f155d3cc88cf5c46420f2fa5bd49092
|
4
|
+
data.tar.gz: c9a43c8373e19317249f568ec65de1896a3824eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65d19f707655171203b97922734450142135ebe947587368b058ce99b1e724db547d2d81824b264a616ffe3cc6ac7b4845cf9f308a30403df4c9fa5aaf14e8ba
|
7
|
+
data.tar.gz: b5b3a5d4eb3bb222c142a7563bfcc0dd4952d49406e1e778b6fe7e713d474ffbf7634c1fb438b125c181e4d913c2f527e1e7221e98beb9bbb708742a70f26d27
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Or manually install
|
|
22
22
|
$ gem install billplz-api
|
23
23
|
```
|
24
24
|
|
25
|
-
##Configuration
|
25
|
+
## Configuration
|
26
26
|
You need to store your Billplz configuration setting in billplz.rb
|
27
27
|
```ruby
|
28
28
|
# config/initializers/billplz.rb
|
@@ -34,8 +34,8 @@ Billplz.configure do |config|
|
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
37
|
-
##Usage
|
38
|
-
###Collection
|
37
|
+
## Usage
|
38
|
+
### Collection
|
39
39
|
|
40
40
|
**Find all collection**
|
41
41
|
```ruby
|
@@ -66,7 +66,7 @@ collection = Billplz::Collection.deactivate(id: "alocpanfu")
|
|
66
66
|
collection = Billplz::Collection.activate(id: "alocpanfu")
|
67
67
|
```
|
68
68
|
|
69
|
-
###Open Collection
|
69
|
+
### Open Collection
|
70
70
|
|
71
71
|
**Find all open collection**
|
72
72
|
```ruby
|
@@ -85,7 +85,7 @@ open_collection = Billplz::OpenCollection.create(title: "Billplz Testing Collect
|
|
85
85
|
open_collection = Billplz::OpenCollection.find(id: 0pp87t_6)
|
86
86
|
```
|
87
87
|
|
88
|
-
###Bill
|
88
|
+
### Bill
|
89
89
|
|
90
90
|
**Create a bill**
|
91
91
|
```ruby
|
@@ -107,7 +107,7 @@ bill = Billplz::Bill.delete(id: "arutnv89")
|
|
107
107
|
transactions = Billplz::Bill.transactions(bill_id: "arutnv89")
|
108
108
|
```
|
109
109
|
|
110
|
-
###Registration Check
|
110
|
+
### Registration Check
|
111
111
|
|
112
112
|
Enter bank account number
|
113
113
|
```ruby
|
data/lib/billplz/bill.rb
CHANGED
@@ -1,23 +1,10 @@
|
|
1
1
|
module Billplz
|
2
2
|
class Bill < Model
|
3
3
|
|
4
|
-
before_request :set_base_url
|
5
|
-
before_request :replace_body
|
6
|
-
|
7
4
|
get :find, "/bills/:id"
|
8
5
|
get :transactions, "/bills/:bill_id/transactions"
|
9
6
|
post :create, "/bills"
|
10
7
|
delete :delete, "/bills/:id"
|
11
8
|
|
12
|
-
private
|
13
|
-
|
14
|
-
def replace_body(name, request)
|
15
|
-
if name == :create
|
16
|
-
#add collection id here
|
17
|
-
request.post_params = request.post_params.merge(collection_id: "#{ENV['BILLPLZ_COLLECTION_ID']}")
|
18
|
-
request.body = request.post_params.to_json
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
9
|
end
|
23
10
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Billplz
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :api_key
|
3
|
+
attr_accessor :api_key, :api_url, :verbose, :perform_caching
|
4
4
|
|
5
5
|
def initialize(options={})
|
6
|
-
@
|
7
|
-
@
|
6
|
+
@verbose = false
|
7
|
+
@perform_caching = true
|
8
8
|
end
|
9
9
|
|
10
10
|
def options
|
11
11
|
hash = Hash.new
|
12
|
-
%w[api_key api_url
|
12
|
+
%w[api_key api_url verbose perform_caching].map{|key| hash[key.to_sym] = send(key) }
|
13
13
|
hash
|
14
14
|
end
|
15
15
|
end
|
data/lib/billplz/model.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Billplz
|
2
2
|
class Model < Flexirest::Base
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
|
5
5
|
request_body_type :json
|
6
|
-
before_request :
|
6
|
+
before_request :set_base_option
|
7
7
|
before_request :replace_token_in_url
|
8
|
-
|
8
|
+
|
9
9
|
|
10
10
|
private
|
11
11
|
|
@@ -14,8 +14,9 @@ module Billplz
|
|
14
14
|
request.headers["Authorization"] = auth
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def set_base_option(name, request)
|
18
18
|
Flexirest::Base.base_url = "#{Billplz.configuration.api_url}"
|
19
|
+
Flexirest::Base.perform_caching = "#{Billplz.configuration.perform_caching}"
|
19
20
|
end
|
20
21
|
|
21
22
|
end
|
data/lib/billplz/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.1
|
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: 2017-03-
|
12
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|