talkable 1.0.4 → 1.0.5
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.
- checksums.yaml +5 -5
- data/.circleci/config.yml +52 -0
- data/README.md +2 -3
- data/lib/talkable.rb +4 -2
- data/lib/talkable/api/base.rb +3 -1
- data/lib/talkable/api/campaign.rb +11 -0
- data/lib/talkable/api/coupon.rb +15 -0
- data/lib/talkable/api/metric.rb +11 -0
- data/lib/talkable/api/person.rb +12 -0
- data/lib/talkable/configuration.rb +25 -5
- data/lib/talkable/version.rb +1 -1
- data/talkable.gemspec +1 -1
- metadata +9 -6
- data/solano.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1754ae010f0566c962842807ebbe0ee6350d7b90
|
4
|
+
data.tar.gz: 3b0215fd0557a03d971cf52e7ee5ff8a6068d66e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 739ae868b57afea5eb8b5e3838b96fbc5095a8e10a35f3621943a6ff33c788dc20a9ab2661f395b52b7407e1f736ade0981163ed14683150001c329332f4cc89
|
7
|
+
data.tar.gz: 9ea750b62d1c02dacd95bdf4b05b9fb079829e373940e69afa272c467530a6721f90abd05d77d19f9e6f812b97177536f5aa96b4f313e153c21cc2fddd70e0ef
|
@@ -0,0 +1,52 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
ruby-2.6: &template
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.6
|
7
|
+
environment:
|
8
|
+
BUNDLER_VERSION: 2.0.1
|
9
|
+
working_directory: ~/talkable-ruby
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
|
13
|
+
- run:
|
14
|
+
name: Configure Bundler
|
15
|
+
command: gem install bundler
|
16
|
+
|
17
|
+
- run:
|
18
|
+
name: Display Versions
|
19
|
+
command: |
|
20
|
+
function extract_version() { perl -pe 'if(($v)=/([0-9]+([.][0-9]+)+)/){print"$v\n";exit}$_=""' ; }
|
21
|
+
echo Ruby $(ruby --version | extract_version)
|
22
|
+
echo RubyGems $(gem --version | extract_version)
|
23
|
+
echo Bundler $(bundle --version | extract_version)
|
24
|
+
|
25
|
+
- run:
|
26
|
+
name: Bundle Install
|
27
|
+
command: bundle install
|
28
|
+
|
29
|
+
- run:
|
30
|
+
name: RSpec
|
31
|
+
command: bundle exec rspec
|
32
|
+
ruby-2.5:
|
33
|
+
<<: *template
|
34
|
+
docker:
|
35
|
+
- image: circleci/ruby:2.5
|
36
|
+
ruby-2.4:
|
37
|
+
<<: *template
|
38
|
+
docker:
|
39
|
+
- image: circleci/ruby:2.4
|
40
|
+
ruby-2.3:
|
41
|
+
<<: *template
|
42
|
+
docker:
|
43
|
+
- image: circleci/ruby:2.3
|
44
|
+
|
45
|
+
workflows:
|
46
|
+
version: 2
|
47
|
+
workflow:
|
48
|
+
jobs:
|
49
|
+
- ruby-2.6
|
50
|
+
- ruby-2.5
|
51
|
+
- ruby-2.4
|
52
|
+
- ruby-2.3
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# Talkable Referral Marketing API Gem
|
2
|
-
[](https://ci.solanolabs.com:443/Talkable/talkable-ruby/suites/484176)
|
3
2
|
|
4
|
-
|
3
|
+
[](https://circleci.com/gh/talkable/talkable-ruby)
|
5
4
|
|
6
|
-
|
5
|
+
Referral marketing is one of the most powerful strategies for ecommerce sales growth. [Talkable](https://www.talkable.com) provides a rich platform for referral marketing. You can integrate sophisticated referral marketing into your own ecommerce site using the Talkable Ruby gem for a Rails or Sinatra application.
|
7
6
|
|
8
7
|
## Demo
|
9
8
|
|
data/lib/talkable.rb
CHANGED
@@ -20,6 +20,10 @@ module Talkable
|
|
20
20
|
@configuration ||= Talkable::Configuration.new
|
21
21
|
end
|
22
22
|
|
23
|
+
def reset_configuration
|
24
|
+
configuration.reset
|
25
|
+
end
|
26
|
+
|
23
27
|
def visitor_uuid
|
24
28
|
Thread.current[UUID]
|
25
29
|
end
|
@@ -48,7 +52,5 @@ module Talkable
|
|
48
52
|
Talkable.current_url = old_url
|
49
53
|
Talkable.visitor_uuid = old_uuid
|
50
54
|
end
|
51
|
-
|
52
55
|
end
|
53
|
-
|
54
56
|
end
|
data/lib/talkable/api/base.rb
CHANGED
@@ -32,7 +32,6 @@ module Talkable
|
|
32
32
|
|
33
33
|
def request_params(params = {})
|
34
34
|
params.merge({
|
35
|
-
api_key: Talkable.configuration.api_key,
|
36
35
|
site_slug: Talkable.configuration.site_slug,
|
37
36
|
})
|
38
37
|
end
|
@@ -50,11 +49,14 @@ module Talkable
|
|
50
49
|
'User-Agent' => "Talkable Gem/#{Talkable::VERSION}",
|
51
50
|
'Content-Type' => 'application/json',
|
52
51
|
'Accept' => 'application/json',
|
52
|
+
'Authorization' => "Bearer #{Talkable.configuration.api_key}",
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
56
56
|
def perform_request(uri, request)
|
57
57
|
http = Net::HTTP.new(uri.host, uri.port)
|
58
|
+
http.read_timeout = Talkable.configuration.read_timeout
|
59
|
+
http.open_timeout = Talkable.configuration.open_timeout
|
58
60
|
http.use_ssl = uri.is_a?(URI::HTTPS)
|
59
61
|
|
60
62
|
request.initialize_http_header request_headers
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Talkable
|
2
|
+
module API
|
3
|
+
class Coupon < Base
|
4
|
+
class << self
|
5
|
+
def find(code)
|
6
|
+
get "/coupons/#{code}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def permission(code, email_or_username)
|
10
|
+
get "/coupons/#{code}/permission/#{email_or_username}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/talkable/api/person.rb
CHANGED
@@ -11,6 +11,18 @@ module Talkable
|
|
11
11
|
data: params
|
12
12
|
}
|
13
13
|
end
|
14
|
+
|
15
|
+
def unsubscribe(email_or_username)
|
16
|
+
post "/people/#{email_or_username}/unsubscribe"
|
17
|
+
end
|
18
|
+
|
19
|
+
def anonymize(email_or_username)
|
20
|
+
post "/people/#{email_or_username}/anonymize"
|
21
|
+
end
|
22
|
+
|
23
|
+
def personal_data(email_or_username)
|
24
|
+
get "/people/#{email_or_username}/personal_data"
|
25
|
+
end
|
14
26
|
end
|
15
27
|
end
|
16
28
|
end
|
@@ -1,19 +1,20 @@
|
|
1
1
|
module Talkable
|
2
2
|
class Configuration
|
3
|
-
DEFAULT_SERVER
|
3
|
+
DEFAULT_SERVER = 'https://www.talkable.com'.freeze
|
4
|
+
DEFAULT_TIMEOUT = 5
|
4
5
|
|
5
6
|
attr_accessor :site_slug
|
6
7
|
attr_accessor :api_key
|
7
8
|
attr_accessor :server
|
9
|
+
attr_accessor :read_timeout
|
10
|
+
attr_accessor :open_timeout
|
8
11
|
attr_accessor :js_integration_library
|
9
12
|
|
10
13
|
class UnknownOptionError < StandardError
|
11
14
|
end
|
12
15
|
|
13
16
|
def initialize
|
14
|
-
|
15
|
-
self.api_key = ENV["TALKABLE_API_KEY"]
|
16
|
-
self.server = DEFAULT_SERVER
|
17
|
+
apply(default_configuration)
|
17
18
|
end
|
18
19
|
|
19
20
|
def apply(config)
|
@@ -30,10 +31,29 @@ module Talkable
|
|
30
31
|
@js_integration_library || default_js_integration_library
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
|
+
def reset
|
35
|
+
apply(default_configuration)
|
36
|
+
end
|
37
|
+
|
38
|
+
def timeout=(sec)
|
39
|
+
apply(read_timeout: sec, open_timeout: sec)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
34
43
|
|
35
44
|
def default_js_integration_library
|
36
45
|
"//d2jjzw81hqbuqv.cloudfront.net/integration/clients/#{site_slug}.min.js"
|
37
46
|
end
|
47
|
+
|
48
|
+
def default_configuration
|
49
|
+
{
|
50
|
+
site_slug: ENV["TALKABLE_SITE_SLUG"],
|
51
|
+
api_key: ENV["TALKABLE_API_KEY"],
|
52
|
+
server: DEFAULT_SERVER,
|
53
|
+
read_timeout: DEFAULT_TIMEOUT,
|
54
|
+
open_timeout: DEFAULT_TIMEOUT,
|
55
|
+
js_integration_library: nil
|
56
|
+
}
|
57
|
+
end
|
38
58
|
end
|
39
59
|
end
|
data/lib/talkable/version.rb
CHANGED
data/talkable.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency "furi", "~> 0.2"
|
21
21
|
s.add_dependency "hashie", "~> 3.4"
|
22
22
|
|
23
|
-
s.add_development_dependency "bundler", "~> 1
|
23
|
+
s.add_development_dependency "bundler", "~> 2.0.1"
|
24
24
|
s.add_development_dependency "rake", "~> 11.2"
|
25
25
|
s.add_development_dependency "rspec", "~> 3.4"
|
26
26
|
s.add_development_dependency "simplecov", "~> 0.12"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: talkable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Talkable
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +157,7 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
+
- ".circleci/config.yml"
|
160
161
|
- ".gitignore"
|
161
162
|
- ".rspec"
|
162
163
|
- Gemfile
|
@@ -167,6 +168,9 @@ files:
|
|
167
168
|
- lib/talkable.rb
|
168
169
|
- lib/talkable/api.rb
|
169
170
|
- lib/talkable/api/base.rb
|
171
|
+
- lib/talkable/api/campaign.rb
|
172
|
+
- lib/talkable/api/coupon.rb
|
173
|
+
- lib/talkable/api/metric.rb
|
170
174
|
- lib/talkable/api/offer.rb
|
171
175
|
- lib/talkable/api/origin.rb
|
172
176
|
- lib/talkable/api/person.rb
|
@@ -202,7 +206,6 @@ files:
|
|
202
206
|
- lib/talkable/resources/offer.rb
|
203
207
|
- lib/talkable/resources/origin.rb
|
204
208
|
- lib/talkable/version.rb
|
205
|
-
- solano.yml
|
206
209
|
- talkable.gemspec
|
207
210
|
- tutorial_images/logo.png
|
208
211
|
- tutorial_images/navbar.png
|
@@ -259,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
262
|
version: '0'
|
260
263
|
requirements: []
|
261
264
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.
|
265
|
+
rubygems_version: 2.6.14
|
263
266
|
signing_key:
|
264
267
|
specification_version: 4
|
265
268
|
summary: Talkable Referral Program API
|
data/solano.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
---
|
2
|
-
timeout: 900
|
3
|
-
timeout_hook: 900
|
4
|
-
bundler_version: 1.16.1
|
5
|
-
ruby_version:
|
6
|
-
SPLIT:
|
7
|
-
- "2.3.0"
|
8
|
-
- "2.4.0"
|
9
|
-
- "2.5.0"
|
10
|
-
test_pattern:
|
11
|
-
- spec/**_spec.rb
|
12
|
-
hooks:
|
13
|
-
pre_setup: bundle install
|
14
|
-
cache:
|
15
|
-
nocache: true
|
16
|
-
coverage:
|
17
|
-
version: 2
|
18
|
-
enabled: true
|