talkable 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +50 -0
  3. data/README.md +245 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e94689a0311b0f5980c51d6c3b3c59eeaad486cd
4
+ data.tar.gz: 2c75680682ea43977ec09be2593777b26a0b73b7
5
+ SHA512:
6
+ metadata.gz: 832d25a3e582759ee9805ea37aae94c4c4d86dedf42b9da87a21020f4908930ae55eb5bb224a886ad637787449b5c452a69914575f9dcadf6aa1f699141984b9
7
+ data.tar.gz: 604b1781a85154c1f744bcdd7c607927ed0ca9fa74972196eb8ea93c22709d3c5b8b0a6975148d5a6a2b0810e0ac37a39a0fe53231a5446e5c0dfebcc21d056d
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/README.md ADDED
@@ -0,0 +1,245 @@
1
+ # Talkable Referral Programe API Gem
2
+
3
+ Talkable Ruby Gem to make your own referral program in Sinatra or Rails application
4
+
5
+
6
+
7
+ ## Demo
8
+
9
+ Take a spree demo app and intall Talkable
10
+
11
+ ## Intallation
12
+
13
+ ``` ruby
14
+ gem "talkable"
15
+ ```
16
+
17
+ ## Using Generator
18
+
19
+ ``` sh
20
+ rails generate talkable:install
21
+ Your talkable site slug (http://talkable.com):
22
+ You API token (http://talkable.com/sites/zz/edit):
23
+ Do you want a different site to be used for non-production env? (y/n)
24
+ Your staging site slug:
25
+ Your staging site API token:
26
+
27
+
28
+ create config/initializers/talkable.rb
29
+ update app/controllers/application_controller.rb
30
+
31
+ create app/controllers/talkable_invite.rb
32
+ create app/views/talkable_invite/show.html.erb
33
+ update app/layouts/application.html.erb # floating widget install
34
+ update app/layouts/_talkable_floating_widget.html.erb
35
+ update config/routes.rb
36
+ ```
37
+
38
+ ## Configuration
39
+
40
+ ``` ruby
41
+ Talkable.configure do |c|
42
+ # required
43
+ c.site_slug = 'hello'
44
+ # or
45
+ c.site_slug = Rails.env.production? ? "hello" : "hello-staging"
46
+ # required
47
+ c.api_token = Rails.env.production? ? "1235" : "6789"
48
+ # required
49
+ c.server = 'http://invite.site.com' # fetched from site settings automatically using generator
50
+ # optional
51
+ c.js_integration_library = 'http://d2jj/integration/hello.js' # default
52
+ end
53
+ ```
54
+
55
+
56
+
57
+ ``` ruby
58
+ class ApplicationController < ActionController::Base
59
+
60
+ initialize_talkable_api
61
+
62
+ end
63
+
64
+ # GEM internals
65
+ class Talkable
66
+ module ActionControllerExtension
67
+ def self.initialize_talkable_api
68
+ before_action :talkable_before_request
69
+ end
70
+
71
+ def talkable_before_request
72
+ cookies[:talkable_visitor_uuid] = params[:talkable_visitor_uuid] || talkable_visitor_uuid
73
+ Talkable.with_uuid(talkable_visitor_uuid) do
74
+ yield
75
+ end
76
+ end
77
+
78
+ def talkable_visitor_uuid
79
+ cookies[:talkable_visitor_uuid] ||= Talkable.find_or_generate_uuid
80
+ end
81
+ end
82
+ end
83
+ ```
84
+
85
+
86
+
87
+
88
+ ## API
89
+
90
+ Full API support according to DOC
91
+
92
+
93
+ ``` ruby
94
+ origin = Talkable::API.register_purchase(
95
+ {
96
+ email: 'a@b.com',
97
+ subtotal: 100.53,
98
+ coupon_codes: [],
99
+ traffic_source: 'zz'
100
+ },
101
+ )
102
+ origin = Talkable::API.register_event()
103
+ origin = Talkable::API.register_affiliate_member(
104
+ offer = origin.offer
105
+ {
106
+ email: '...'
107
+ sharing_channels: ['facebook', 'embedded_email', 'sms', 'other']
108
+ }
109
+ )
110
+
111
+ offer.claim_links # =>
112
+ # {
113
+ # twitter: "http://invite.site.com/x/12356"
114
+ # facebook: "http://invite.site.com/x/12356"
115
+ # embedded_email: "http://invite.site.com/x/12356"
116
+ # twitter: "http://invite.site.com/x/12356"
117
+ # }
118
+ ```
119
+
120
+ ## AD Offer Share page
121
+
122
+
123
+
124
+ User facing GEM API
125
+
126
+ ``` erb
127
+ <%= offer.advocate_share_iframe %>
128
+
129
+ ```
130
+
131
+ Generated code:
132
+
133
+
134
+ ``` html
135
+ <div class='talkable-offer-xxx'>
136
+ <!-- result of the JS evaluation - not ruby evaluation -->
137
+ <iframe src="https://invite.site.com/x/38828?current_visitor_uuid=<uuid>"></iframe>
138
+ </div>
139
+
140
+ <script>
141
+ _talkableq.push(['init', {
142
+ server: '...',
143
+ site_id: '...',
144
+ visitor_uuid: '...'
145
+ }])
146
+ _talkableq.push(['show_offer'], "https://invite.site.com/x/38828", {container: 'talkable-offer-xxx'})
147
+ </script>
148
+ ```
149
+
150
+ ## integration.js extension
151
+
152
+ `integration.js` additions. Suppose to be never used directly if using talkable gem
153
+
154
+ ``` js
155
+ talkable.showOffer(offer.show_url)
156
+ ```
157
+
158
+
159
+ ## Self-Serve UI
160
+
161
+
162
+ ``` ruby
163
+ offer.configure(
164
+ facebook: {
165
+ title: ['An offer for all my friends', 'Claim your reward'], # AB test
166
+ description: 'Click this link and get #{campaign.friend_incentive.description} off on the merchant.com'
167
+ image: "http://merchant.com/assets/fb_image.jpg"
168
+ },
169
+ twitter: {
170
+ message: 'Click #{offer.claim_links.twitter} and get {{friend_incentive.description}} off on the merchant.com'
171
+ },
172
+ )
173
+
174
+
175
+ offer.configure(
176
+ twitter: {
177
+ message: 'Click #{offer.claim_links.twitter} and get {{friend_incentive.description}} off on the merchant.com'
178
+ },
179
+
180
+ )
181
+ ```
182
+
183
+
184
+
185
+
186
+ ``` js
187
+
188
+ offer = Talkable.offer(<%= offer.to_json %>)
189
+ $('.js-share-via-facebook').click(
190
+ offer.shareViaFacebook()
191
+ )
192
+ $('.js-share-via-twitter').click(
193
+ offer.shareViaTwitter()
194
+ )
195
+ $('.js-share-via-sms').click(
196
+ offer.shareViaSms()
197
+ )
198
+ offer.bindClickLink($('.js-plain-offer-link'))
199
+ ```
200
+
201
+
202
+ ``` haml
203
+ %h1= offer.localize('offer_title')
204
+ %h1= offer.ab_test("Share with friends", "Get yourself a discount %{advocate_amount}", advocate_amount: campaign.advocate_incentive.description)
205
+ %p
206
+ Share this offer with friends and get <%= campaign.advocate_incentive.description %>
207
+
208
+
209
+ %a.js-share-via-facebook Facebook
210
+ %a.js-share-via-twitter Twitter
211
+ %a.js-share-via-sms Twitter
212
+ ```
213
+
214
+
215
+ ``` ruby
216
+ # routes.rb
217
+ mount Talkable::Rack => 'talkable'
218
+ ```
219
+
220
+
221
+ ## TODO
222
+
223
+ Functionality:
224
+
225
+ * [ ] Gem infrustructure
226
+ * [ ] Configuration
227
+ * [ ] API
228
+ * Custom Traffic Source
229
+ * Custom User Agent
230
+ * Visitors
231
+ * Origins
232
+ * Shares
233
+ * Rewards
234
+ * [ ] Controller uuid hook
235
+ * [ ] Offer Share Iframe
236
+ * [ ] Integration JS additions
237
+ * [ ] Ruby iframe generation method
238
+ * [ ] Generator
239
+ * [ ] Documentation
240
+ * Post-Checkout integration instructions
241
+ * Events integration instructions
242
+ * [ ] Setup demo with the most popular ruby shopping cart gem
243
+
244
+ Caveats:
245
+ * [ ] Prevent API call to create visitor on first request. Delay until user interacts with RAF.
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: talkable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Talkable
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Talkable Ruby Gem to make your own referral program in Sinatra or Rails
14
+ application
15
+ email: dev@talkable.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - README.md
22
+ homepage: https://github.com/talkable/talkable-ruby
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.4.7
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Talkable Referral Programe API
46
+ test_files: []
47
+ has_rdoc: