Skip to content

Commit

Permalink
fix some doc issues and misspellings
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy-Schmitz committed Nov 12, 2018
1 parent de17d3b commit 5526aeb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Go Lazada [![GoDoc](https://godoc.org/github.com/teddy-schmitz/go-lazada/lazada?status.png)](https://godoc.org/github.com/teddy-schmitz/go-lazada/lazada)
# Go Lazada [![GoDoc](https://godoc.org/github.com/Teddy-Schmitz/go-lazada/lazada?status.png)](https://godoc.org/github.com/Teddy-Schmitz/go-lazada/lazada)
Unofficial Go library for the [Lazada Open Platform]("https://open.lazada.com/")

## Install

```
go get github.com/teddy-schmitz/go-lazada
go get github.com/Teddy-Schmitz/go-lazada
```

## Usage

```go
import "github.com/teddy-schmitz/go-lazada/lazada"
import "github.com/Teddy-Schmitz/go-lazada/lazada"
```

Construct a client with a specific region
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/teddy-schmitz/go-lazada
module github.com/Teddy-Schmitz/go-lazada

require (
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
5 changes: 2 additions & 3 deletions lazada/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ var apiNames = map[string]string{
"GetProducts": "/products/get",
}

// Lazada Regions
type Region string

const (
SriLanka Region = "lk"
Phillipines = "ph"
Philippines = "ph"
Bangladesh = "bd"
Thailand = "th"
Vietnam = "vn"
Expand All @@ -33,7 +32,7 @@ const (
// endpoints maps a regions shortcode to its URL
var endpoints = map[Region]string{
SriLanka: "https://api.daraz.lk/",
Phillipines: "https://api.lazada.com.ph/",
Philippines: "https://api.lazada.com.ph/",
Bangladesh: "https://api.daraz.com.bd/",
Thailand: "https://api.lazada.co.th/",
Vietnam: "https://api.lazada.vn/",
Expand Down
16 changes: 8 additions & 8 deletions lazada/createProduct.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ type ProductRequest struct {

type Attributes struct {
XMLName xml.Name `xml:"Attributes,omitempty"`
Attrs StringMap
Attrs StringMap
}

type Images struct {
XMLName xml.Name `xml:"Images,omitempty"`
Image []string `xml:"Image,omitempty"`
Image []string `xml:"Image,omitempty"`
}

type Product struct {
XMLName xml.Name `xml:"Product,omitempty"`
Attributes *Attributes `xml:"Attributes,omitempty"`
PrimaryCategory string `xml:"PrimaryCategory,omitempty"`
Skus []*Sku `xml:"Skus>Sku,omitempty"`
XMLName xml.Name `xml:"Product,omitempty"`
Attributes *Attributes `xml:"Attributes,omitempty"`
PrimaryCategory string `xml:"PrimaryCategory,omitempty"`
Skus []*Sku `xml:"Skus>Sku,omitempty"`
}

type Sku struct {
XMLName xml.Name `xml:"Sku,omitempty"`
Images *Images `xml:"Images,omitempty"`
SellerSku string `xml:"SellerSku"`
Images *Images `xml:"Images,omitempty"`
SellerSku string `xml:"SellerSku"`
SkuAttrs StringMap
}
4 changes: 2 additions & 2 deletions lazada/stringmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
tokens := []xml.Token{}

for key, value := range s {
t := xml.StartElement{Name: xml.Name{"", key}}
tokens = append(tokens, t, xml.CharData(value), xml.EndElement{t.Name})
t := xml.StartElement{Name: xml.Name{Space: "", Local: key}}
tokens = append(tokens, t, xml.CharData(value), xml.EndElement{Name: t.Name})
}

for _, t := range tokens {
Expand Down
2 changes: 1 addition & 1 deletion tests/products_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/teddy-schmitz/go-lazada/lazada"
"gitlab.com/Teddy-Schmitz/go-lazada/lazada"
)

var AppKey = os.Getenv("APP_KEY")
Expand Down

0 comments on commit 5526aeb

Please sign in to comment.