binchecker
is a simple golang wrapper for bincheck-api.
- You need to signup for Prompt API
- You need to subscribe bincheck-api, test drive is free!!!
- You need to set
PROMPTAPI_TOKEN
environment variable after subscription.
$ go get -u github.com/promptapi/bin-checker-go
// main.go
package main
import (
"fmt"
"os"
binchecker "github.com/promptapi/bin-checker-go"
)
func main() {
result := new(binchecker.Result)
if err := binchecker.BinChecker("302596", result); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Printf("%+v\n", result)
fmt.Printf("BankName: %s\n", result.BankName)
fmt.Printf("Country: %s\n", result.Country)
fmt.Printf("URL: %s\n", result.URL)
fmt.Printf("Type: %s\n", result.Type)
fmt.Printf("Scheme: %s\n", result.Scheme)
fmt.Printf("Bin: %s\n", result.Bin)
}
Run from cli:
$ PROMPTAPI_TOKEN="YOUR-PROMPTAPI-TOKEN" go run main.go
&{BankName:Diners Club International Country:United States Of America URL:www.dinersclub.com Type:Credit Scheme:Discover Bin:302596}
BankName: Diners Club International
Country: United States Of America
URL: www.dinersclub.com
Type: Credit
Scheme: Discover
Bin: 302596
Create a fake web-server under /tmp/
;
$ mkdir /tmp/server/
$ cp test.json /tmp/server/
$ cd /tmp/server/
$ python -m http.server 8000
And use:
$ PROMPTAPI_TOKEN="fake" \
PROMPTAPI_TEST_ENDPOINT="http://localhost:8000/test.json" \
go run main.go
User rake tasks:
$ rake
rake default # Default task, show avaliable tasks
rake release:check # Do release check
rake release:publish[revision] # Publish project with revision: major,minor,patch, default: patch
rake serve_doc[port] # Run doc server
rake test[verbose] # Run tests
- Run tests:
rake test
orrake test[-v]
- Run doc server:
rake serve_doc
orrake serve_doc[9000]
Release package (if you have write access):
- Commit your changes
- Run
rake release:check
- If all goes ok, run
rake release:publish
This project is licensed under MIT
- Prompt API - Creator, maintainer
All PR’s are welcome!
fork
(https://github.com/promptapi/bin-checker-go/fork)- Create your
branch
(git checkout -b my-feature
) commit
yours (git commit -am 'Add awesome features...'
)push
yourbranch
(git push origin my-feature
)- Than create a new Pull Request!
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.