hubspot 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ee981f30172ab1c4e5036a39eea595441c685385e65729c388a8660cc85f6e3
4
- data.tar.gz: c7e271737c34768fa555a510e5e00fd5024e575799caf812e98599c700284d7e
3
+ metadata.gz: eb398cc89a728fa7fb94a6fe6e1d40cb2fbd08aec630cd1b5dcb8bdc2f36dc82
4
+ data.tar.gz: d7cb88dfa7d5e264bb24196b8a135e24c6fbb8fbe56c796a282c3bbc085e4aca
5
5
  SHA512:
6
- metadata.gz: 4203835be4ec47f6db2bafa6e9b2b7d0bf2c506fb65cf902cb1a72496e48350795827f65fbd6eefb087cac188b7a42d904885fd820766644117289d6139f50cd
7
- data.tar.gz: 9e188bff0c87f84ef23fa8bf9b7bf799e5346e0ee5f6831f99bc485260d8ecee6fe590b98e296a8f8b6e5aa025a5d73b4cdd5ec7198431d619ba2d783b5d63b1
6
+ metadata.gz: 6ddaa74da599836c51149e1bbe2d1fc5a123e09dd0a9c24d946c1c6cfa5611e6ca82dba2f98e1ea6bceb1a4d2491856ed6402f40f24d595760a0d3878350bc6f
7
+ data.tar.gz: 60ec28484cfa527b89f34c767d1b70860991b7e79c2c86a3f25f29a3a9e8223c53e1ef10976df7458abd28a5d1e1e02ad1ffe7fb11abb6888512dfdc0aff6ed6
@@ -28,14 +28,6 @@ module Hubspot
28
28
  class Configuration
29
29
  attr_accessor :hapikey, :user_name, :password, :address, :port
30
30
 
31
- def initialize#(hapikey, user_name, password, address, port)
32
- # @hapikey = hapikey
33
- # @user_name = user_name
34
- # @password = password
35
- # @address = address
36
- # @port = port
37
- end
38
-
39
31
  def hubspot?
40
32
  ActionMailer::Base.delivery_method == :hubspot
41
33
  end
@@ -53,5 +45,5 @@ module Hubspot
53
45
  end
54
46
 
55
47
  require "hubspot/railtie" if defined?(Rails::Railtie)
56
- # require "hubspot/mailer" if defined?(ActionMailer::Base)
57
- # require "hubspot/transaction_email/mailer" if defined?(ActionMailer::Base)
48
+ require "hubspot/mailer" if defined?(ActionMailer::Base)
49
+ require "hubspot/transaction_email/mailer" if defined?(ActionMailer::Base)
@@ -14,14 +14,14 @@ module Hubspot
14
14
 
15
15
  class << self
16
16
  def post(options)
17
- SingleSend.new(Hubspot.configuration.hapikey).post(options)
17
+ config = Hubspot.configuration
18
+ SingleSend.new(config.hapikey).post(options)
18
19
  end
19
20
  end
20
21
 
21
- # TODO: DWE: if RUBY_VERSION > "2.3" See -- dig(:message, :to)
22
22
  def post(options = {})
23
- raise ArgumentError, "EmailId: Required Error" if options[:emailId].blank?
24
- raise ArgumentError, "To: Required Error" if options[:message].blank?
23
+ raise ArgumentError, "EmailId: Required Error" if options.dig(:emailId).blank?
24
+ raise ArgumentError, "To: Required Error" if options.dig(:message, :to).blank?
25
25
  raise KeyError, "Hubspot Api Key Error" if hapikey.blank?
26
26
 
27
27
  response = Hubspot.post("/email/public/v1/singleEmail/send?hapikey=#{hapikey}", options)
@@ -1,18 +1,34 @@
1
1
  module Hubspot
2
2
  class DeliveryMethod
3
3
  def deliver!(mail)
4
- configuration = Hubspot.configuration
5
-
6
- smtp_user = configuration.user_name
7
- smtp_password = configuration.password
8
- smtp_host = configuration.address
9
- smtp_port = configuration.port
10
-
11
- delivery_method_options = { user_name: smtp_user, password: smtp_password, address: smtp_host, port: smtp_port, authentication: :plain, enable_starttls_auto: true }
4
+ raise NotImplementedError
5
+ delivery_method_options = { user_name: smtp_user_name, password: smtp_password, address: smtp_host, port: smtp_port, authentication: :plain, enable_starttls_auto: true }
12
6
 
13
7
  headers = headers.merge!(delivery_method_options: delivery_method_options)
14
8
 
15
9
  super(mail)
16
10
  end
11
+
12
+ private
13
+
14
+ def configuration
15
+ Hubspot.configuration
16
+ end
17
+
18
+ def smtp_user_name
19
+ configuration.user_name
20
+ end
21
+
22
+ def smtp_password
23
+ configuration.password
24
+ end
25
+
26
+ def smtp_host
27
+ configuration.address
28
+ end
29
+
30
+ def smtp_port
31
+ configuration.port
32
+ end
17
33
  end
18
34
  end
@@ -1,18 +1,23 @@
1
1
  module Hubspot
2
2
  class Mailer < ActionMailer::Base
3
- def mail(headers = {}, &block)
4
- configuration = Hubspot.configuration
5
-
6
- smtp_user = configuration.user_name
7
- smtp_password = configuration.password
8
- smtp_host = configuration.address
9
- smtp_port = configuration.port
3
+ default smtp_user_name: -> { configuration.user_name }
4
+ default smtp_password: -> { configuration.password }
5
+ default smtp_host: -> { configuration.address }
6
+ default smtp_port: -> { configuration.port }
10
7
 
11
- delivery_method_options = { user_name: smtp_user, password: smtp_password, address: smtp_host, port: smtp_port, authentication: :plain, enable_starttls_auto: true }
8
+ def mail(headers = {}, &block)
9
+ raise NotImplementedError
10
+ delivery_method_options = { user_name: default_params[:smtp_user_name], password: default_params[:smtp_password], address: default_params[:smtp_host], port: default_params[:smtp_port], authentication: :plain, enable_starttls_auto: true }
12
11
 
13
12
  headers = headers.merge!(delivery_method_options: delivery_method_options)
14
13
 
15
14
  super
16
15
  end
16
+
17
+ private
18
+
19
+ def configuration
20
+ Hubspot.configuration
21
+ end
17
22
  end
18
23
  end
@@ -1,16 +1,12 @@
1
+ require 'hubspot/api/transaction_email/single_send'
2
+
1
3
  module Hubspot
2
4
  module TransactionEmail
3
- class DeliveryMethod < ActionMailer::Base
5
+ class DeliveryMethod
4
6
  def deliver!(mail)
5
7
  raise NotImplementedError
6
- configuration = Hubspot.configuration
7
-
8
- smtp_user = configuration.user_name
9
- smtp_password = configuration.password
10
- smtp_host = configuration.address
11
- smtp_port = configuration.port
12
-
13
- Api::TransactionEmail::SingleSend.post()
8
+ attributes = { emailId: mail.email_id, message: mail.message, contact_properties: mail.contact_properties, custom_properties: mail.custom_properties }
9
+ Api::TransactionEmail::SingleSend.post(attributes)
14
10
  end
15
11
  end
16
12
  end
@@ -4,7 +4,7 @@ module Hubspot
4
4
  module TransactionEmail
5
5
  class Mailer < ActionMailer::Base
6
6
  def mail(headers = {}, &block)
7
- attributes = { emailId: headers[:email_id], message: headers[:message] }
7
+ attributes = { emailId: headers[:email_id], message: headers[:message], contact_properties: headers[:contact_properties], custom_properties: headers[:custom_properties] }
8
8
  Api::TransactionEmail::SingleSend.post(attributes)
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module Hubspot
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,37 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Eichler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-28 00:00:00.000000000 Z
11
+ date: 2019-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: actionmailer
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 3.0.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 3.0.0
27
- - !ruby/object:Gem::Dependency
28
- name: activesupport
14
+ name: rails
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
19
  version: '0'
34
- type: :runtime
20
+ type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
@@ -39,19 +25,19 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: bundler
28
+ name: sqlite3
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 2.0.1
33
+ version: 1.3.3
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 2.0.1
40
+ version: 1.3.3
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,48 +66,6 @@ dependencies:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
68
  version: '3.0'
83
- - !ruby/object:Gem::Dependency
84
- name: capybara
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: selenium-webdriver
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: database_cleaner
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
69
  - !ruby/object:Gem::Dependency
126
70
  name: factory_bot
127
71
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +94,6 @@ dependencies:
150
94
  - - ">="
151
95
  - !ruby/object:Gem::Version
152
96
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: rspec-rails
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
97
  - !ruby/object:Gem::Dependency
168
98
  name: simplecov
169
99
  requirement: !ruby/object:Gem::Requirement
@@ -178,34 +108,6 @@ dependencies:
178
108
  - - ">="
179
109
  - !ruby/object:Gem::Version
180
110
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: byebug
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: pry
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
111
  - !ruby/object:Gem::Dependency
210
112
  name: webmock
211
113
  requirement: !ruby/object:Gem::Requirement
@@ -234,20 +136,6 @@ dependencies:
234
136
  - - ">="
235
137
  - !ruby/object:Gem::Version
236
138
  version: '0'
237
- - !ruby/object:Gem::Dependency
238
- name: combustion
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: '1.1'
244
- type: :development
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: '1.1'
251
139
  description: Hubspot smtp mailer, delivery method and api wrapper
252
140
  email:
253
141
  - dustin@smalhaus.com
@@ -279,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
167
  requirements:
280
168
  - - ">="
281
169
  - !ruby/object:Gem::Version
282
- version: '0'
170
+ version: 2.3.0
283
171
  required_rubygems_version: !ruby/object:Gem::Requirement
284
172
  requirements:
285
173
  - - ">="