Skip to content

Commit

Permalink
Updated CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-go committed Feb 17, 2018
1 parent e0d0fcc commit 8d117d7
Show file tree
Hide file tree
Showing 25 changed files with 310 additions and 299 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
coverage.out
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ sudo: required
language: go

go:
- 1.5.3
- 1.6.3
- 1.7.3
- tip

# allow failures only on last version of go.
matrix:
allow_failures:
- go: tip
- 1.9.3

before_install:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi

before_script:
- go get github.com/Masterminds/glide
- glide install

script:
- $HOME/gopath/bin/goveralls -service=travis-ci
- make
- make test
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.9.3-alpine
# DeGOps 0.0.4

# NOTE: added apk for CGO too.
RUN apk --update --no-cache add curl bash git alpine-sdk util-linux gcc musl-dev
# Install glide
RUN curl https://glide.sh/get | sh

WORKDIR /go/src
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

help:
@echo "Go CI 0.0.4:"
@echo "Available commands:"
@echo "\tmake install Install dependencies."
@echo "\tmake run Run default command."
@echo "\tmake test Run tests."
@echo "\tmake coverage Show coverage in html."
@echo "\tmake clean Clean build files."

install:
@echo "Make: Install"
./scripts/install.sh

run:
@echo "Make: Run"
./scripts/run.sh

.PHONY: test
test:
@echo "Make: Test"
./scripts/test.sh

coverage:
@echo "Make: Coverage"
./scripts/cover.sh

clean:
@echo "Make: Clean"
./scripts/clean.sh


## Container related commands.

container-install:
@echo "Make: Install"
./container/install.sh

.PHONY: test
container-test:
@echo "Make: Test"
./container/test.sh

container-coverage:
@echo "Make: Coverage"
./container/cover.sh

container-clean:
@echo "Make: Clean"
./container/clean.sh
27 changes: 4 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,32 @@
####Nexmo client written in Go.

Not tested with credentials.
## [Nexmo](https://www.nexmo.com/) client written in Go.

[![License MIT](https://img.shields.io/npm/l/express.svg)](http://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.org/jimmy-go/nexmo.svg?branch=master)](https://travis-ci.org/jimmy-go/nexmo)
[![Go Report Card](https://goreportcard.com/badge/github.com/jimmy-go/nexmo)](https://goreportcard.com/report/github.com/jimmy-go/nexmo)
[![GoDoc](http://godoc.org/github.com/jimmy-go/nexmo?status.png)](http://godoc.org/github.com/jimmy-go/nexmo)
[![Coverage Status](https://coveralls.io/repos/github/jimmy-go/nexmo/badge.svg?branch=master)](https://coveralls.io/github/jimmy-go/nexmo?branch=master)

#####Install:
### Install:
```
go get gopkg.in/jimmy-go/nexmo.v0
```

#####Usage:
Call `nexmo.New` method to get a new Nexmo client.
For every Nexmo feature there is a package with that name
that contains his Request and Response type.

E.g.: For method SMS you need a nexmo.sms.Request{} that returns
nexmo.sms.Response{}
### Usage:

```
# declare a new client
client, err := nexmo.New("APIKEY", "APISECRET")
// check errors...
# use it
msg := nexmo.NewSMS("5215522334455", "NexmoTest", "Hello world!")
resp, err := client.SMS(msg)
// resp = nexmo.sms.Response
req := nexmo.NewCall("5215522334455", "http://someurl/answer.xml")
resp, err := client.Call(req)
// resp = nexmo.call.Response
t2s := nexmo.NewText2Speech("5215522334455", "NexmoTest", "Hello my world!", "en-us", "female")
resp, err := client.Text2Speech(t2s)
// resp = nexmo.text2speech.Response
```

#####Credits:

* [NEXMO](https://www.nexmo.com)
* [NEXMO DOC](https://docs.nexmo.com)

#####License:
### License:

MIT License

Expand Down
File renamed without changes.
54 changes: 54 additions & 0 deletions _examples/sms/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Package main contains Nexmo SMS example usage.
package main

import (
"encoding/json"
"flag"
"log"
"time"

"github.com/jimmy-go/nexmo"
"github.com/jimmy-go/nexmo/sms"
)

func main() {
key := flag.String("api-key", "", "Nexmo API KEY.")
secret := flag.String("api-secret", "", "Nexmo API SECRET.")
to := flag.String("to", "", "Nexmo phone destination.")
from := flag.String("from", "", "Your Nexmo phone number.")
text := flag.String("text", "", "SMS message content.")
flag.Parse()
log.SetFlags(log.Lshortfile)

nclient, err := nexmo.New(*key, *secret, time.Second)
if err != nil {
panic(err)
}

// new SMS with only required parameters.
// msg := nexmo.NewSMS(*to, *from, *text)

// complete sms usage.
// see: https://docs.nexmo.com/messaging/sms-api/api-reference#request
msg := &sms.Request{
From: *from,
To: *to,
Type: "",
Text: *text,
StatusReport: "",
ClientRef: "",
Vcard: "",
Vcal: "",
}
resp, err := nclient.SMS(msg)
if err != nil {
panic(err)
}

log.Printf("SMS : response [%v]", marshal(resp))
}

func marshal(v interface{}) string {
b, _ := json.MarshalIndent(v, "", " ")
return string(b)
}
File renamed without changes.
30 changes: 30 additions & 0 deletions call/call.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Package call contains Nexmo Call Request and Response.
//
// see: https://docs.nexmo.com/voice/call
package call

// Request Nexmo TextToSpeech request.
//
// see: https://docs.nexmo.com/voice/call/request
type Request struct {
To string `url:"to"`
AnswerURL string `url:"answer_url"`
From string `url:"from"`
MachineDetection string `url:"machine_detection"`
MachineTimeout string `url:"machine_timeout"`
AnswerMethod string `url:"answer_method"`
ErrorURL string `url:"error_url"`
ErrorMethod string `url:"error_method"`
StatusURL string `url:"status_url"`
StatusMethod string `url:"status_method"`
}

// Response Nexmo TextToSpeech response.
//
// see: https://docs.nexmo.com/voice/call/response
type Response struct {
CallID string `json:"call-id"`
To string `json:"to"`
Status int `json:"status"`
ErrorText string `json:"error-text"`
}
76 changes: 0 additions & 76 deletions examples/sms/main.go

This file was deleted.

4 changes: 2 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 0 additions & 52 deletions nexmo.call/call.go

This file was deleted.

0 comments on commit 8d117d7

Please sign in to comment.