sunnytrail 0.0.1 → 0.0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.rdoc +63 -1
  2. data/lib/sunnytrail.rb +1 -1
  3. metadata +3 -2
data/README.rdoc CHANGED
@@ -1,3 +1,65 @@
1
1
  = Sunnytrail
2
2
 
3
- Sunnytrail API Wrapper
3
+ This is wrapper for Sunnytrail API - http://www.thesunnytrail.com
4
+
5
+ You can find API documentation here:
6
+ https://beta.thesunnytrail.com/developers
7
+
8
+ == Installation
9
+
10
+ Sunnytrail gem is hosted on http://rubygems.org
11
+
12
+ To install type in you terminal:
13
+
14
+ gem install sunnytrail
15
+
16
+
17
+
18
+ == Usage
19
+
20
+ First you need to setup you token.
21
+
22
+ You can do it globally:
23
+
24
+ Sunnytrail.configure :api_key => "YOURTOKENHERE"
25
+
26
+ or per instance:
27
+
28
+ sunnytrail = Sunnytrail.new :api_key => "YOURTOKENHERE"
29
+
30
+
31
+ To add event to Sunnytrail use add_event function.
32
+
33
+ You can pass all arguments in hash.
34
+
35
+ Sunnytrail.add_event({:action => {:name =>"signup", :created =>Time.now.to_i},
36
+ :plan => {:name => "Basic", :price => 29, :recurring => 31},
37
+ :name => "User1",
38
+ :email => "user1@example.com",
39
+ :id => "123"
40
+ })
41
+
42
+
43
+
44
+
45
+ Or you can build event with Event class.
46
+
47
+
48
+ event = Sunnytrail::Event.new
49
+ event.id = 123
50
+ event.email = "user1@example.com"
51
+ event.name = "User1"
52
+ event.plan.name = "Basic"
53
+ event.plan.price = 29
54
+ event.plan.recurring = 31
55
+ event.action.name = "signup"
56
+ event.created = Time.now.to_i
57
+
58
+ Sunnytrail.add_event(event)
59
+
60
+
61
+
62
+ add_event works also as an instance method.
63
+
64
+ sunnytrail = Sunnytrail.new
65
+ sunnytrail.add_event(event)
data/lib/sunnytrail.rb CHANGED
@@ -105,7 +105,7 @@ class Sunnytrail
105
105
 
106
106
  class Action < Hashie::Dash
107
107
  property :name
108
- property :created, :default => Time.now.to_i
108
+ property :created, :default => lambda {Time.now.to_i}.call
109
109
  end
110
110
 
111
111
  class Plan < Hashie::Dash
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunnytrail
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 73
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 1
10
- version: 0.0.1
10
+ - 1
11
+ version: 0.0.1.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Mateusz Zawisza