Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Kiliaro/master
Added mocked implementation for use in unit tests
- Loading branch information
Showing
6 changed files
with
336 additions
and
116 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,46 +1,37 @@ | ||
package mixpanel | ||
|
||
import ( | ||
"time" | ||
) | ||
import "time" | ||
|
||
func ExampleNewMixpanel() { | ||
NewMixpanel("mytoken") | ||
func ExampleNew() { | ||
New("mytoken", "") | ||
} | ||
|
||
func ExampleMixpanel_Identify() { | ||
client := NewMixpanel("mytoken") | ||
func ExampleMixpanel() { | ||
client := New("mytoken", "") | ||
|
||
client.Identify("1") | ||
} | ||
|
||
func ExampleTrack() { | ||
client := NewMixpanel("mytoken") | ||
|
||
client.Track("1", "Sign Up", map[string]interface{}{ | ||
"from": "email", | ||
client.Track("1", "Sign Up", &Event{ | ||
Properties: map[string]interface{}{ | ||
"from": "email", | ||
}, | ||
}) | ||
} | ||
|
||
func ExamplePeople_Update() { | ||
var people *People | ||
client := NewMixpanel("mytoken") | ||
|
||
people = client.Identify("1") | ||
people.Update("$set", map[string]interface{}{ | ||
"$email": "user@email.com", | ||
"$last_login": time.Now(), | ||
"$created": time.Now().String(), | ||
"custom_field": "cool!", | ||
func ExamplePeople() { | ||
client := New("mytoken", "") | ||
|
||
client.Update("1", &Update{ | ||
Operation: "$set", | ||
Properties: map[string]interface{}{ | ||
"$email": "user@email.com", | ||
"$last_login": time.Now(), | ||
"$created": time.Now().String(), | ||
"custom_field": "cool!", | ||
}, | ||
}) | ||
} | ||
|
||
func ExamplePeople_Track() { | ||
var people *People | ||
client := NewMixpanel("mytoken") | ||
|
||
people = client.Identify("1") | ||
people.Track("Sign Up", map[string]interface{}{ | ||
"from": "email", | ||
client.Track("1", "Sign Up", &Event{ | ||
Properties: map[string]interface{}{ | ||
"from": "email", | ||
}, | ||
}) | ||
} |
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
Oops, something went wrong.