lucid_intercom 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/lucid_intercom.rb +2 -0
- data/lib/lucid_intercom/config.rb +4 -1
- data/lib/lucid_intercom/container.rb +2 -0
- data/lib/lucid_intercom/send_email.rb +36 -0
- data/lib/lucid_intercom/send_message.rb +33 -0
- data/lib/lucid_intercom/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c79fdf9db9290c3f3ce19018e653330829d4ae65d9d651dcc01a3654e38d3a2
|
4
|
+
data.tar.gz: 75ad290ae14e0f376d61481354be8d0f657975158cc909f6c0d835434a83d211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51125d01350d54d600663f6be32bf98665bbb7c24f82aeae488fd8fe27b4a6ee0e4e6df0da1fbcf8acccc93f2cd16b627dda81ef2bea6b51b7e2c1e2fcc73c09
|
7
|
+
data.tar.gz: 0ea00b6f1ae51e1216e349d45cc5be0dd54f0363d1a4da3c952a1a5674ade82b5968b8f129c6472ba4736100cc637e9b9056be6e2a9abb42ef67ea03b11978a7
|
data/README.md
CHANGED
data/lib/lucid_intercom.rb
CHANGED
@@ -17,6 +17,8 @@ module LucidIntercom
|
|
17
17
|
autoload :PostRequest, 'lucid_intercom/post_request.rb'
|
18
18
|
autoload :RenderSnippet, 'lucid_intercom/render_snippet.rb'
|
19
19
|
autoload :Response, 'lucid_intercom/response.rb'
|
20
|
+
autoload :SendEmail, 'lucid_intercom/send_email.rb'
|
21
|
+
autoload :SendMessage, 'lucid_intercom/send_message.rb'
|
20
22
|
autoload :UpdateUser, 'lucid_intercom/update_user.rb'
|
21
23
|
autoload :UserAttributes, 'lucid_intercom/user_attributes.rb'
|
22
24
|
autoload :VERSION, 'lucid_intercom/version.rb'
|
@@ -15,7 +15,8 @@ module LucidIntercom
|
|
15
15
|
:access_token,
|
16
16
|
:secret,
|
17
17
|
:app_id,
|
18
|
-
:app_prefix
|
18
|
+
:app_prefix,
|
19
|
+
:admin_id # for messages/emails
|
19
20
|
)
|
20
21
|
|
21
22
|
# @param config [Config]
|
@@ -44,5 +45,7 @@ module LucidIntercom
|
|
44
45
|
param :app_id
|
45
46
|
# @return [String] the snakecased app name, e.g. 'smart_order_tags'
|
46
47
|
param :app_prefix
|
48
|
+
# @return [Integer]
|
49
|
+
param :admin_id
|
47
50
|
end
|
48
51
|
end
|
@@ -16,5 +16,7 @@ module LucidIntercom
|
|
16
16
|
Container.register(:notify_uninstalled) { NotifyUninstalled.new }
|
17
17
|
Container.register(:post_request) { PostRequest.new }
|
18
18
|
Container.register(:render_snippet) { RenderSnippet.new }
|
19
|
+
Container.register(:send_email) { SendEmail.new }
|
20
|
+
Container.register(:send_message) { SendMessage.new }
|
19
21
|
Container.register(:update_user) { UpdateUser.new }
|
20
22
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lucid_intercom'
|
4
|
+
|
5
|
+
module LucidIntercom
|
6
|
+
class SendEmail
|
7
|
+
#
|
8
|
+
# @param post_request [#call]
|
9
|
+
#
|
10
|
+
def initialize(post_request: Container[:post_request])
|
11
|
+
@post_request = post_request
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# @param to [String] a user email address
|
16
|
+
# @param subject [String]
|
17
|
+
# @param body [String]
|
18
|
+
#
|
19
|
+
def call(to, subject, body)
|
20
|
+
@post_request.('messages', {
|
21
|
+
message_type: 'email',
|
22
|
+
subject: subject,
|
23
|
+
body: body,
|
24
|
+
template: 'plain',
|
25
|
+
from: {
|
26
|
+
type: 'admin',
|
27
|
+
id: LucidIntercom.admin_id,
|
28
|
+
},
|
29
|
+
to: {
|
30
|
+
type: 'user',
|
31
|
+
email: to,
|
32
|
+
},
|
33
|
+
})
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lucid_intercom'
|
4
|
+
|
5
|
+
module LucidIntercom
|
6
|
+
class SendMessage
|
7
|
+
#
|
8
|
+
# @param post_request [#call]
|
9
|
+
#
|
10
|
+
def initialize(post_request: Container[:post_request])
|
11
|
+
@post_request = post_request
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# @param to [String] a user email address
|
16
|
+
# @param body [String]
|
17
|
+
#
|
18
|
+
def call(to, body)
|
19
|
+
@post_request.('messages', {
|
20
|
+
message_type: 'inapp',
|
21
|
+
body: body,
|
22
|
+
from: {
|
23
|
+
type: 'admin',
|
24
|
+
id: LucidIntercom.admin_id,
|
25
|
+
},
|
26
|
+
to: {
|
27
|
+
type: 'user',
|
28
|
+
email: to,
|
29
|
+
},
|
30
|
+
})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucid_intercom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelsey Judson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -116,6 +116,8 @@ files:
|
|
116
116
|
- lib/lucid_intercom/post_request.rb
|
117
117
|
- lib/lucid_intercom/render_snippet.rb
|
118
118
|
- lib/lucid_intercom/response.rb
|
119
|
+
- lib/lucid_intercom/send_email.rb
|
120
|
+
- lib/lucid_intercom/send_message.rb
|
119
121
|
- lib/lucid_intercom/snippet.html
|
120
122
|
- lib/lucid_intercom/update_user.rb
|
121
123
|
- lib/lucid_intercom/user_attributes.rb
|