braze_ruby 0.5.0 → 0.6.0

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: ae77ca2f5ea9cf492d7f681c37fcbff40f912b8ce8ac9db237a9b91e8c5fc76a
4
- data.tar.gz: 033f2a42048dfff0af864534900a5405ba5a56099e3630c23512f73a30a56468
3
+ metadata.gz: c00945c683cf1036e050a2268b6b79b8cde870b94a0e81de114a40088b4993c8
4
+ data.tar.gz: b96dacd6c85d3fe8aa3584f98e21f9876a1fbfa97120da01f410d8dcaf31826e
5
5
  SHA512:
6
- metadata.gz: 67d8ff06c45f2e3d90e000c9093118c80d85136e77961cf5cf6bbdf1d45dd57b704905b1ff5388413df142773cd2e76a2473e92b9e2edcdbc85752ed09a6d111
7
- data.tar.gz: 409c1603839abd4bf95c0096c54c936ea6fa438f350d368b8e3e117b1d1a17a082c55991c53fd4d75c2b67a2649792c01330db2e7f58ef94896cd00fe8f5bbaf
6
+ metadata.gz: 3ac7068ab004e42ec49d1e222ff945af8899d7b43a0bae95f9d93fa4a2d2873a3fb19236d1f5984b86c48c833f6d6ae6ce80d81fd061403709a11b2d7d34636b
7
+ data.tar.gz: d5ad50ff9090f009d1c461819f7c2d9327f37789720f26e21158a0e1b4178ea3aa3c4089b97be8940a45207cfc92a7193323f7214a83e8679002e84783cc4fc6
data/.circleci/config.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  version: 2.1
2
-
3
2
  jobs:
4
3
  test:
5
4
  parameters:
@@ -9,49 +8,19 @@ jobs:
9
8
  - image: << parameters.ruby-version >>
10
9
  steps:
11
10
  - checkout
12
-
13
11
  - run:
14
12
  name: Gem install bundler
15
13
  command: gem update --system && gem install bundler
16
-
17
14
  - run:
18
15
  name: Bundle install
19
16
  command: bundle install --jobs=4 --retry=3 --path vendor/bundle
20
-
21
17
  - run:
22
18
  name: Run tests
23
19
  command: bundle exec rake
24
-
25
- publish:
26
- docker:
27
- - image: ruby:3.0.0
28
- steps:
29
- - checkout
30
-
31
- - run:
32
- name: Setup Rubygems
33
- command: bash .circleci/setup-rubygems
34
-
35
- - run:
36
- name: Build gem
37
- command: gem build braze_ruby.gemspec --output braze_ruby.gem
38
-
39
- - run:
40
- name: Publish gem
41
- command: gem push braze_ruby.gem
42
-
43
20
  workflows:
44
21
  all-tests:
45
22
  jobs:
46
23
  - test:
47
24
  matrix:
48
25
  parameters:
49
- ruby-version: ["ruby:3.0.0", "ruby:2.7.2", "ruby:2.6.3"]
50
- release:
51
- jobs:
52
- - publish:
53
- filters:
54
- tags:
55
- only: /^v.*/
56
- branches:
57
- ignore: /.*/
26
+ ruby-version: ["ruby:3.0.1", "ruby:2.7.3", "ruby:2.6.7"]
File without changes
@@ -0,0 +1,20 @@
1
+ name: release
2
+ on:
3
+ push:
4
+ tags:
5
+ - v*
6
+ jobs:
7
+ release:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Setup rubygems
12
+ run: |
13
+ mkdir ~/.gem
14
+ cp ./.github/workflows/gem_credentials ~/.gem/credentials
15
+ chmod 0600 ~/.gem/credentials
16
+ sed -i "s/REPLACE_ME/${{ secrets.RUBYGEMS_KEY }}/g" ~/.gem/credentials
17
+ - name: Build gem
18
+ run: gem build braze_ruby.gemspec --output braze_ruby.gem
19
+ - name: Publish gem
20
+ run: gem push braze_ruby.gem
data/README.md CHANGED
@@ -246,6 +246,11 @@ api.email_unsubscribes(email: ['jdoe@example.com'])
246
246
  api.email_hard_bounces(email: ['jdoe@example.com'])
247
247
  ```
248
248
 
249
+ #### Remove Email Addresses From Spam List
250
+ ```ruby
251
+ api.remove_emails_from_spam(email: ['jdoe@example.com'])
252
+ ```
253
+
249
254
  ## Debugging
250
255
 
251
256
  The BRAZE_RUBY_DEBUG environment variable will trigger full printouts of the Faraday gem's HTTP requests and responses.
@@ -12,6 +12,7 @@ require "braze_ruby/endpoints/canvas"
12
12
  require "braze_ruby/endpoints/subscription"
13
13
  require "braze_ruby/endpoints/rename_external_ids"
14
14
  require "braze_ruby/endpoints/remove_external_ids"
15
+ require "braze_ruby/endpoints/remove_email_addresses_from_spam"
15
16
 
16
17
  module BrazeRuby
17
18
  class API
@@ -30,6 +31,7 @@ module BrazeRuby
30
31
  include BrazeRuby::Endpoints::CreateUserAliases
31
32
  include BrazeRuby::Endpoints::RenameExternalIds
32
33
  include BrazeRuby::Endpoints::RemoveExternalIds
34
+ include BrazeRuby::Endpoints::RemoveEmailAddressesFromSpam
33
35
 
34
36
  def export_users(**payload)
35
37
  BrazeRuby::REST::ExportUsers.new(api_key, braze_url, options).perform(**payload)
@@ -14,8 +14,7 @@ module BrazeRuby
14
14
 
15
15
  def schedule_message(date, message, segment_id, local_timezone = false)
16
16
  warn("[BrazeRuby] `schedule_message` is deprecated. Please use `schedule_messages` instead.")
17
- schedule_messages(send_at: date, messages: message,
18
- segment_id: segment_id, local_timezone: local_timezone)
17
+ schedule_messages(send_at: date, messages: message, segment_id: segment_id, local_timezone: local_timezone)
19
18
  end
20
19
  end
21
20
  end
@@ -10,3 +10,4 @@ require "braze_ruby/endpoints/identify_users"
10
10
  require "braze_ruby/endpoints/create_user_aliases"
11
11
  require "braze_ruby/endpoints/rename_external_ids"
12
12
  require "braze_ruby/endpoints/remove_external_ids"
13
+ require "braze_ruby/endpoints/remove_email_addresses_from_spam"
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module Endpoints
5
+ module RemoveEmailAddressesFromSpam
6
+ attr_writer :remove_emails_from_spam_service
7
+
8
+ def remove_emails_from_spam(**payload)
9
+ remove_emails_from_spam_service.perform(**payload)
10
+ end
11
+
12
+ private
13
+
14
+ def remove_emails_from_spam_service
15
+ @remove_emails_from_spam_service ||= BrazeRuby::REST::RemoveEmailAddressesFromSpam.new(api_key, braze_url, options)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,6 +6,7 @@ require "faraday"
6
6
  module BrazeRuby
7
7
  class HTTP
8
8
  DEFAULT_TIMEOUT = 30
9
+ DEFAULT_OPEN_TIMEOUT = 5
9
10
 
10
11
  def initialize(api_key, braze_url, options = {})
11
12
  @api_key = api_key
@@ -31,17 +32,19 @@ module BrazeRuby
31
32
  connection.headers["Authorization"] = "Bearer #{@api_key}"
32
33
 
33
34
  connection.response :logger if ENV["BRAZE_RUBY_DEBUG"]
35
+ connection.request :retry, @options[:retry] if @options[:retry]
34
36
 
35
37
  connection.adapter Faraday.default_adapter
36
38
 
37
39
  connection.options[:timeout] = @options[:timeout]
40
+ connection.options[:open_timeout] = @options[:open_timeout]
38
41
  end
39
42
  end
40
43
 
41
44
  private
42
45
 
43
46
  def default_options
44
- {timeout: DEFAULT_TIMEOUT}
47
+ {timeout: DEFAULT_TIMEOUT, open_timeout: DEFAULT_OPEN_TIMEOUT}
45
48
  end
46
49
  end
47
50
  end
@@ -20,3 +20,4 @@ require "braze_ruby/rest/identify_users"
20
20
  require "braze_ruby/rest/create_user_aliases"
21
21
  require "braze_ruby/rest/rename_external_ids"
22
22
  require "braze_ruby/rest/remove_external_ids"
23
+ require "braze_ruby/rest/remove_email_addresses_from_spam"
@@ -4,17 +4,17 @@ module BrazeRuby
4
4
  module REST
5
5
  class ExportUsers < Base
6
6
  def perform(external_ids: nil, segment_id: nil, **options)
7
- return export_users_by_ids(external_ids) if external_ids
7
+ return export_users_by_ids(external_ids, options) if external_ids
8
8
 
9
9
  export_users_by_segment(segment_id, options) if segment_id
10
10
  end
11
11
 
12
12
  private
13
13
 
14
- def export_users_by_ids(external_ids)
14
+ def export_users_by_ids(external_ids, options)
15
15
  http.post "/users/export/ids", {
16
16
  external_ids: external_ids
17
- }
17
+ }.merge(options)
18
18
  end
19
19
 
20
20
  def export_users_by_segment(segment_id, options)
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class RemoveEmailAddressesFromSpam < Base
6
+ def perform(email: [])
7
+ http.post "/email/spam/remove", {
8
+ email: email
9
+ }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrazeRuby
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braze_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nussbaum
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-05-06 00:00:00.000000000 Z
14
+ date: 2021-07-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -150,8 +150,8 @@ extensions: []
150
150
  extra_rdoc_files: []
151
151
  files:
152
152
  - ".circleci/config.yml"
153
- - ".circleci/gem_credentials"
154
- - ".circleci/setup-rubygems"
153
+ - ".github/workflows/gem_credentials"
154
+ - ".github/workflows/release.yml"
155
155
  - ".gitignore"
156
156
  - ".rspec"
157
157
  - ".standard.yml"
@@ -172,6 +172,7 @@ files:
172
172
  - lib/braze_ruby/endpoints/email_status.rb
173
173
  - lib/braze_ruby/endpoints/email_sync.rb
174
174
  - lib/braze_ruby/endpoints/identify_users.rb
175
+ - lib/braze_ruby/endpoints/remove_email_addresses_from_spam.rb
175
176
  - lib/braze_ruby/endpoints/remove_external_ids.rb
176
177
  - lib/braze_ruby/endpoints/rename_external_ids.rb
177
178
  - lib/braze_ruby/endpoints/schedule_messages.rb
@@ -190,6 +191,7 @@ files:
190
191
  - lib/braze_ruby/rest/export_users.rb
191
192
  - lib/braze_ruby/rest/identify_users.rb
192
193
  - lib/braze_ruby/rest/list_segments.rb
194
+ - lib/braze_ruby/rest/remove_email_addresses_from_spam.rb
193
195
  - lib/braze_ruby/rest/remove_external_ids.rb
194
196
  - lib/braze_ruby/rest/rename_external_ids.rb
195
197
  - lib/braze_ruby/rest/schedule_messages.rb
@@ -222,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
224
  - !ruby/object:Gem::Version
223
225
  version: '0'
224
226
  requirements: []
225
- rubygems_version: 3.2.3
227
+ rubygems_version: 3.1.2
226
228
  signing_key:
227
229
  specification_version: 4
228
230
  summary: A wrapper gem for the Braze REST API.
@@ -1,6 +0,0 @@
1
- #! /bin/sh
2
-
3
- mkdir -p ~/.gem
4
- cp ./.circleci/gem_credentials ~/.gem/credentials
5
- chmod 0600 ~/.gem/credentials
6
- sed -i "s/REPLACE_ME/${RUBYGEMS_API_KEY}/g" ~/.gem/credentials