billplz-api 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 3c8e7487e7ab2562d1b626736595fea3e9c2ace7
4
- data.tar.gz: 76ca3c83e80279763ed03b9331fded601c61092e
3
+ metadata.gz: b3b2626f1b890903f400a3f7ee2504361be696a9
4
+ data.tar.gz: b254c525480982c46e48672721222c55a2ba59c6
5
5
  SHA512:
6
- metadata.gz: 5582ce59f03a11e37b455dea2edb60687f099ea1fe4e70ce11b12679804f4d233603fa3e93f196cfe136ebe8b56dd04c66dd4326cf9b419c2bbd5817657edeae
7
- data.tar.gz: ac5d267d9bb9316c79ab5f17530b2a01759b0ebacac281f2c968224932f73690d02ce76cd17da79fd17bed711003346ac25088fb04aac07fbd482e517ac90829
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
- **Collection**
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
- **Open Collection**
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::Collection.create_open_collection(title: "Billplz Testing Collection",description: "Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.", amount: 299)
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
- **Bill**
88
+ ###Bill
62
89
 
63
90
  **Create a bill**
64
91
  ```ruby
65
- bill = Billplz::Bill.create( collection_id: "ajij091j",email: "admin@billplz.com",name:"Admin BillPlz",amount: 200,callback_url: "billplz.com",description: "Shopping Items")
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
- **Registration Check**
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::RegistrationCheck.find("123465782312")
114
+ registration_check = Billplz::Registration.check(account_number: "123465782312")
83
115
  ```
84
116
 
85
117
 
data/billplz-api.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_development_dependency "rake"
20
- spec.add_dependency "flexirest"
20
+ spec.add_runtime_dependency "flexirest"
21
21
  end
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
- post :create, ""
9
- delete :delete, "/:id"
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
@@ -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
- post :create, "/collections/"
7
- post :create_open_collection, "/open_collections"
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
@@ -0,0 +1,9 @@
1
+ module Billplz
2
+ class OpenCollection < Model
3
+
4
+ get :all, "/open_collections"
5
+ get :find, "/open_collections/:id"
6
+ post :create, "/open_collections"
7
+
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Billplz
2
+ class Registration < Model
3
+
4
+ get :check, "/check/bank_account_number/:account_number"
5
+
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Billplz
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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/registration_check"
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.1.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: 2016-11-10 00:00:00.000000000 Z
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/registration_check.rb
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