billplz-api 0.2.0 → 0.2.1

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: b3b2626f1b890903f400a3f7ee2504361be696a9
4
- data.tar.gz: b254c525480982c46e48672721222c55a2ba59c6
3
+ metadata.gz: 2db165a37f155d3cc88cf5c46420f2fa5bd49092
4
+ data.tar.gz: c9a43c8373e19317249f568ec65de1896a3824eb
5
5
  SHA512:
6
- metadata.gz: 4ecef2cd79268cd614d504e4cb8c88649a801cc49aabb318fc6527ceccf42ade6ee043c005fbc41f93a2393d279ad01fb5eff7deedce74e1ffa465d7c51134c4
7
- data.tar.gz: 84360b128b3f57ea95302d2bf0f6df797bcc4dc53f14526ee856854cf6bf62652e0dc83b3173457fb70067ff7df93ecc3fc78b98996788cd593e373a78e3e692
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
@@ -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,:api_url, :http_timeout, :mode
3
+ attr_accessor :api_key, :api_url, :verbose, :perform_caching
4
4
 
5
5
  def initialize(options={})
6
- @http_timeout = 30
7
- @mode = 'live'
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 http_timeout mode].map{|key| hash[key.to_sym] = send(key) }
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
@@ -1,11 +1,11 @@
1
1
  module Billplz
2
2
  class Model < Flexirest::Base
3
- perform_caching false
4
- #verbose!
3
+
4
+
5
5
  request_body_type :json
6
- before_request :set_base_url
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 set_base_url(name, request)
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
@@ -1,3 +1,3 @@
1
1
  module Billplz
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  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.2.0
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-21 00:00:00.000000000 Z
12
+ date: 2017-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake