BnmAPI 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bnmapi.gemspec +0 -21
- data/lib/bnmapi/base_rate.rb +6 -1
- data/lib/bnmapi/error/invalid_bank_code.rb +10 -0
- data/lib/bnmapi/version.rb +1 -1
- data/lib/bnmapi.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e807a48dfef08fab1c7ff16cbf87ef4fa4126b88db25fd89845bca0ce30b7cb
|
4
|
+
data.tar.gz: 6f1a037f5240ee78464a746173d1d34a3496ffcf18890ca3cd635835524eaa80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc11fd9bc51ca071f3e1981825d8b05fb64a6da0dd8be77a35574670ba913dd113a02211445ef218b479b7566197342770c799b993f0a1ffdfc9ab25cbedef36
|
7
|
+
data.tar.gz: 9a484fbdcac03ee856ed1e8b6961e835217a02bfeaaadbfd9e3087182108791070d2dd8c3ca573d6535d52679d8df673dcb9f797814fd062d78ce6497fa4bc12
|
data/Gemfile.lock
CHANGED
data/bnmapi.gemspec
CHANGED
@@ -14,26 +14,6 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/jibone/bnmapi"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
#if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
|
22
|
-
# spec.metadata["homepage_uri"] = spec.homepage
|
23
|
-
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
24
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
25
|
-
#else
|
26
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
-
# "public gem pushes."
|
28
|
-
#end
|
29
|
-
|
30
|
-
## Specify which files should be added to the gem when it is released.
|
31
|
-
## The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
-
#spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
-
# `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
-
#end
|
35
|
-
#spec.bindir = "exe"
|
36
|
-
#spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
38
18
|
f.match(%r{^(test|spec|features)/})
|
39
19
|
end
|
@@ -49,5 +29,4 @@ Gem::Specification.new do |spec|
|
|
49
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
50
30
|
spec.add_development_dependency 'webmock'
|
51
31
|
spec.add_development_dependency 'vcr'
|
52
|
-
|
53
32
|
end
|
data/lib/bnmapi/base_rate.rb
CHANGED
@@ -28,7 +28,12 @@ module BnmAPI
|
|
28
28
|
def self.by_bank_code(bank_code)
|
29
29
|
http = BnmAPI::HTTP::Client.new(endpoint: ENDPOINT + '/' + bank_code)
|
30
30
|
|
31
|
-
|
31
|
+
response = http.request
|
32
|
+
if response.code == '404'
|
33
|
+
raise BnmAPI::Error::InvalidBankCode.new(bank_code: bank_code)
|
34
|
+
end
|
35
|
+
|
36
|
+
res = JSON.parse(response.read_body)
|
32
37
|
|
33
38
|
BnmAPI::Data::BankBaseRate.new(
|
34
39
|
res['data']['bank_code'],
|
data/lib/bnmapi/version.rb
CHANGED
data/lib/bnmapi.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'bnmapi/version'
|
2
2
|
require 'bnmapi/http/client'
|
3
3
|
require 'bnmapi/data/bank_base_rate'
|
4
|
+
require 'bnmapi/error/invalid_bank_code'
|
4
5
|
require 'bnmapi/welcome'
|
5
6
|
require 'bnmapi/base_rate'
|
6
7
|
|
7
8
|
module BnmAPI
|
8
|
-
class Error < StandardError; end
|
9
9
|
# Your code goes here...
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: BnmAPI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J Shamsul Bahri (jibone))
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/bnmapi.rb
|
105
105
|
- lib/bnmapi/base_rate.rb
|
106
106
|
- lib/bnmapi/data/bank_base_rate.rb
|
107
|
+
- lib/bnmapi/error/invalid_bank_code.rb
|
107
108
|
- lib/bnmapi/http/client.rb
|
108
109
|
- lib/bnmapi/version.rb
|
109
110
|
- lib/bnmapi/welcome.rb
|