This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.0.0 - complete overhaul for v2 API (#6)
* v3.0.0 - complete overhaul for v2 API * fix: swap io for ioutil * Added unit tests and VCR * Full test suite * Fix lint * Adds code coverage and test to build * Adds README badges * Fix code coverage commands * fix: change device string * Update CHANGELOG date
- Loading branch information
1 parent
2ab0038
commit 08409b8
Showing
47 changed files
with
1,603 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.DS_Store | ||
.idea | ||
covprofile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## help - Display help about make targets for this Makefile | ||
help: | ||
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t | ||
|
||
## install - Install globally from source | ||
install: | ||
go build -o $(go env GOPATH)/bin/tuneuptechnology-go | ||
|
||
## clean - Clean the project | ||
clean: | ||
rm dist | ||
rm $(go env GOPATH)/bin/tuneuptechnology-go | ||
|
||
## build - Build the project | ||
build: | ||
go build -o dist/tuneuptechnology-go | ||
|
||
## test - Test the project | ||
test: | ||
go test ./test | ||
|
||
## coverage - Get test coverage | ||
coverage: | ||
go test ./test -coverprofile=covprofile -coverpkg=./... | ||
|
||
## lint - Lint the project | ||
lint: | ||
golangci-lint run | ||
|
||
.PHONY: help install clean build test lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
The Go client library for the Tuneup Technology App. | ||
|
||
[![Build Status](https://github.com/tuneuptechnology/tuneuptechnology-go/workflows/build/badge.svg)](https://github.com/tuneuptechnology/tuneuptechnology-go/actions) | ||
[![Coverage Status](https://coveralls.io/repos/github/tuneuptechnology/tuneuptechnology-go/badge.svg?branch=main)](https://coveralls.io/github/tuneuptechnology/tuneuptechnology-go?branch=main) | ||
[![Version](https://img.shields.io/github/v/tag/tuneuptechnology/tuneuptechnology-go)](https://github.com/tuneuptechnology/tuneuptechnology-go/releases) | ||
[![Licence](https://img.shields.io/github/license/tuneuptechnology/tuneuptechnology-go)](LICENSE) | ||
|
||
This library allows you to interact with the customers, tickets, inventory, and locations objects without needing to do the hard work of binding your calls and data to endpoints. Simply call an action such as `CreateCustomer` and pass some data and let the library do the rest. | ||
|
@@ -19,20 +21,18 @@ go get -u github.com/tuneuptechnology/tuneuptechnology-go | |
package main | ||
|
||
import ( | ||
"github.com/tuneuptechnology/tuneuptechnology-go" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/tuneuptechnology/tuneuptechnology-go" | ||
) | ||
|
||
func main() { | ||
// Setup your email and API key | ||
apiEmail := os.Getenv("API_EMAIL") | ||
apiKey := os.Getenv("API_KEY") | ||
client := tuneuptechnology.New(os.Getenv("API_EMAIL"), os.Getenv("API_KEY")) | ||
|
||
// Create a customer passing in all required params | ||
customer := tuneuptechnology.CreateCustomer( | ||
customer := client.CreateCustomer( | ||
&tuneuptechnology.Customer{ | ||
Auth: apiEmail, | ||
APIKey: apiKey, | ||
Firstname: "Jake", | ||
Lastname: "Peralta", | ||
Email: "[email protected]", | ||
|
@@ -43,9 +43,12 @@ func main() { | |
}, | ||
) | ||
|
||
tuneuptechnology.PrettyPrint(customer) | ||
prettyJSON, err := json.MarshalIndent(customer, "", " ") | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, "error creating JSON:", err) | ||
} | ||
fmt.Printf("%s\n", string(prettyJSON)) | ||
} | ||
|
||
``` | ||
|
||
Other examples can be found in the `/examples` directory. Alter according to your needs. | ||
|
@@ -60,10 +63,34 @@ [email protected] API_KEY=123... go run create_customer.go | |
|
||
Up-to-date API documentation can be [found here](https://app.tuneuptechnology.com/docs/api). | ||
|
||
## Development | ||
|
||
When re-recording cassettes, comment out the `delete` tests until all other tests have recorded cassettes. This ensures the records that are required to exist will still be active. Once the retrieve and update cassettes have been recorded, uncomment the delete tests and run again to record those cassettes. | ||
|
||
```bash | ||
# Build the project | ||
make build | ||
|
||
# Install the project globally from source | ||
make install | ||
|
||
# Clean the executables | ||
make clean | ||
|
||
# Test the project | ||
[email protected] API_KEY=123... make test | ||
|
||
## Get test coverage | ||
[email protected] API_KEY=123... make coverage | ||
|
||
# Lint the project (requires golangci-lint be installed) | ||
make lint | ||
``` | ||
|
||
## Releasing | ||
|
||
As a separate PR from the feature/bug PR: | ||
|
||
1. Update the Version constant in `version.go` | ||
1. Update the Version constant in `client.go` | ||
1. Update `CHANGELOG` | ||
1. Create a GitHub tag with proper Go version semantics (eg: v1.0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.