braze_ruby 0.4.1 → 0.7.0
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 +4 -4
- data/.circleci/config.yml +26 -0
- data/.github/workflows/gem_credentials +2 -0
- data/.github/workflows/release.yml +20 -0
- data/.gitignore +12 -19
- data/.standard.yml +1 -0
- data/Gemfile +1 -2
- data/LICENSE.txt +17 -18
- data/README.md +39 -2
- data/Rakefile +2 -1
- data/bin/release +16 -0
- data/braze_ruby.gemspec +28 -31
- data/lib/braze_ruby/api.rb +16 -10
- data/lib/braze_ruby/deprecated.rb +4 -5
- data/lib/braze_ruby/endpoints/campaigns.rb +4 -0
- data/lib/braze_ruby/endpoints/remove_email_addresses_from_spam.rb +19 -0
- data/lib/braze_ruby/endpoints/remove_external_ids.rb +19 -0
- data/lib/braze_ruby/endpoints/rename_external_ids.rb +19 -0
- data/lib/braze_ruby/endpoints/subscription.rb +0 -1
- data/lib/braze_ruby/endpoints.rb +11 -8
- data/lib/braze_ruby/http.rb +12 -9
- data/lib/braze_ruby/rest/base.rb +3 -3
- data/lib/braze_ruby/rest/canvas_details.rb +1 -1
- data/lib/braze_ruby/rest/create_user_aliases.rb +2 -2
- data/lib/braze_ruby/rest/delete_users.rb +2 -2
- data/lib/braze_ruby/rest/email_hard_bounces.rb +1 -1
- data/lib/braze_ruby/rest/email_status.rb +3 -3
- data/lib/braze_ruby/rest/email_unsubscribes.rb +1 -1
- data/lib/braze_ruby/rest/export_users.rb +7 -7
- data/lib/braze_ruby/rest/identify_users.rb +2 -2
- data/lib/braze_ruby/rest/list_segments.rb +1 -1
- data/lib/braze_ruby/rest/remove_email_addresses_from_spam.rb +13 -0
- data/lib/braze_ruby/rest/remove_external_ids.rb +13 -0
- data/lib/braze_ruby/rest/rename_external_ids.rb +13 -0
- data/lib/braze_ruby/rest/schedule_messages.rb +6 -6
- data/lib/braze_ruby/rest/send_messages.rb +3 -3
- data/lib/braze_ruby/rest/subscription_status_get.rb +1 -1
- data/lib/braze_ruby/rest/subscription_status_set.rb +1 -1
- data/lib/braze_ruby/rest/subscription_user_status.rb +1 -1
- data/lib/braze_ruby/rest/track_users.rb +4 -4
- data/lib/braze_ruby/rest/trigger_campaign_schedule.rb +18 -0
- data/lib/braze_ruby/rest/trigger_campaign_send.rb +1 -1
- data/lib/braze_ruby/rest/trigger_canvas_send.rb +1 -1
- data/lib/braze_ruby/rest.rb +22 -18
- data/lib/braze_ruby/version.rb +1 -1
- data/lib/braze_ruby.rb +4 -4
- metadata +52 -177
- data/.github/workflows/ci.yml +0 -30
- data/Gemfile.lock +0 -78
- data/spec/braze_ruby/api_spec.rb +0 -6
- data/spec/braze_ruby/endpoints/delete_users_spec.rb +0 -31
- data/spec/braze_ruby/endpoints/track_users_spec.rb +0 -74
- data/spec/braze_ruby/http_spec.rb +0 -48
- data/spec/braze_ruby/rest/create_user_aliases_spec.rb +0 -23
- data/spec/braze_ruby/rest/delete_users_spec.rb +0 -22
- data/spec/braze_ruby/rest/email_status_spec.rb +0 -20
- data/spec/braze_ruby/rest/export_users_spec.rb +0 -21
- data/spec/braze_ruby/rest/identify_users_spec.rb +0 -23
- data/spec/braze_ruby/rest/schedule_messages_spec.rb +0 -37
- data/spec/braze_ruby/rest/send_messages_spec.rb +0 -30
- data/spec/braze_ruby/rest/track_users_spec.rb +0 -27
- data/spec/factories.rb +0 -38
- data/spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml +0 -71
- data/spec/fixtures/responses/canvas/details/returns_error_when_no_canvas.yml +0 -69
- data/spec/fixtures/responses/canvas/trigger_send/sends_a_canvas.yml +0 -71
- data/spec/fixtures/responses/create_user_aliases/unauthorized/responds_with_unauthorized.yml +0 -67
- data/spec/fixtures/responses/create_user_aliases/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/create_user_aliases/with_success/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml +0 -68
- data/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/email_status/existing_email/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml +0 -71
- data/spec/fixtures/responses/email_status/unknown_email/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/email_sync/hard_bounces/responds_with_empty_array_when_no_hard_bounces.yml +0 -75
- data/spec/fixtures/responses/email_sync/unsubscribes/responds_with_empty_array_when_no_unsubscribes.yml +0 -75
- data/spec/fixtures/responses/email_sync/unsubscribes/responds_with_unsubscribed_emails.yml +0 -75
- data/spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml +0 -72
- data/spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/identify_users/unauthorized/responds_with_unauthorized.yml +0 -68
- data/spec/fixtures/responses/identify_users/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/identify_users/with_success/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml +0 -81
- data/spec/fixtures/responses/list_segments/with_success/responds_with_success.yml +0 -81
- data/spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml +0 -68
- data/spec/fixtures/responses/schedule_messages/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/schedule_messages/with_success/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/send_messages/unauthorized/responds_with_unauthorized.yml +0 -68
- data/spec/fixtures/responses/send_messages/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/send_messages/with_success/responds_with_success_message.yml +0 -71
- data/spec/fixtures/responses/subscription/subscription_status_set/when_subscribing/subscribes_the_user.yml +0 -71
- data/spec/fixtures/responses/subscription/subscription_status_set/when_subscription_group_does_not_exist/returns_an_error_status.yml +0 -68
- data/spec/fixtures/responses/subscription/subscription_status_set/when_unsubscribing/unsubscribes_the_user.yml +0 -139
- data/spec/fixtures/responses/subscription/when_getting_subscription_group_statuses/subscription_status_get/when_checking_subscribed_and_unsubscribed_user_status/returns_only_users_that_were_once_subscribed.yml +0 -211
- data/spec/fixtures/responses/subscription/when_getting_subscription_group_statuses/subscription_status_get/when_group_does_not_exist/returns_an_error.yml +0 -199
- data/spec/fixtures/responses/subscription/when_getting_subscription_group_statuses/subscription_user_status/returns_subscription_groups_and_status_for_every_group.yml +0 -211
- data/spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml +0 -70
- data/spec/fixtures/responses/track_users/with_success/responds_with_created.yml +0 -73
- data/spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml +0 -73
- data/spec/integrations/campaigns_spec.rb +0 -19
- data/spec/integrations/canvas_spec.rb +0 -28
- data/spec/integrations/create_user_aliases_spec.rb +0 -32
- data/spec/integrations/delete_users_spec.rb +0 -32
- data/spec/integrations/email_status_spec.rb +0 -38
- data/spec/integrations/email_sync_spec.rb +0 -31
- data/spec/integrations/export_users_spec.rb +0 -29
- data/spec/integrations/identify_users_spec.rb +0 -32
- data/spec/integrations/list_segments_spec.rb +0 -21
- data/spec/integrations/schedule_messages_spec.rb +0 -34
- data/spec/integrations/send_messages_spec.rb +0 -33
- data/spec/integrations/subscription_spec.rb +0 -149
- data/spec/integrations/track_users_spec.rb +0 -38
- data/spec/spec_helper.rb +0 -25
- data/spec/support/factory_bot.rb +0 -12
- data/spec/support/integrations.rb +0 -27
- data/spec/support/vcr.rb +0 -20
| @@ -4,22 +4,22 @@ 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)
         | 
| 15 | 
            -
                    http.post  | 
| 16 | 
            -
                       | 
| 17 | 
            -
                    }
         | 
| 14 | 
            +
                  def export_users_by_ids(external_ids, options)
         | 
| 15 | 
            +
                    http.post "/users/export/ids", {
         | 
| 16 | 
            +
                      external_ids: external_ids
         | 
| 17 | 
            +
                    }.merge(options)
         | 
| 18 18 | 
             
                  end
         | 
| 19 19 |  | 
| 20 20 | 
             
                  def export_users_by_segment(segment_id, options)
         | 
| 21 | 
            -
                    http.post  | 
| 22 | 
            -
                       | 
| 21 | 
            +
                    http.post "/users/export/segment", {
         | 
| 22 | 
            +
                      segment_id: segment_id
         | 
| 23 23 | 
             
                    }.merge(options)
         | 
| 24 24 | 
             
                  end
         | 
| 25 25 | 
             
                end
         | 
| @@ -4,8 +4,8 @@ module BrazeRuby | |
| 4 4 | 
             
              module REST
         | 
| 5 5 | 
             
                class IdentifyUsers < Base
         | 
| 6 6 | 
             
                  def perform(aliases_to_identify: [])
         | 
| 7 | 
            -
                    http.post  | 
| 8 | 
            -
                       | 
| 7 | 
            +
                    http.post "/users/identify", {
         | 
| 8 | 
            +
                      aliases_to_identify: aliases_to_identify
         | 
| 9 9 | 
             
                    }
         | 
| 10 10 | 
             
                  end
         | 
| 11 11 | 
             
                end
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module BrazeRuby
         | 
| 4 | 
            +
              module REST
         | 
| 5 | 
            +
                class RenameExternalIds < Base
         | 
| 6 | 
            +
                  def perform(external_id_renames: [])
         | 
| 7 | 
            +
                    http.post "/users/external_ids/rename", {
         | 
| 8 | 
            +
                      external_id_renames: external_id_renames
         | 
| 9 | 
            +
                    }
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
            end
         | 
| @@ -14,13 +14,13 @@ module BrazeRuby | |
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 16 | 
             
                  def perform
         | 
| 17 | 
            -
                    http.post  | 
| 18 | 
            -
                       | 
| 19 | 
            -
                       | 
| 20 | 
            -
                         | 
| 21 | 
            -
                         | 
| 17 | 
            +
                    http.post "/messages/schedule/create", {
         | 
| 18 | 
            +
                      external_user_ids: external_user_ids,
         | 
| 19 | 
            +
                      schedule: {
         | 
| 20 | 
            +
                        time: time,
         | 
| 21 | 
            +
                        in_local_time: in_local_time
         | 
| 22 22 | 
             
                      },
         | 
| 23 | 
            -
                       | 
| 23 | 
            +
                      messages: messages
         | 
| 24 24 | 
             
                    }
         | 
| 25 25 | 
             
                  end
         | 
| 26 26 | 
             
                end
         | 
| @@ -12,9 +12,9 @@ module BrazeRuby | |
| 12 12 | 
             
                  end
         | 
| 13 13 |  | 
| 14 14 | 
             
                  def perform
         | 
| 15 | 
            -
                    http.post  | 
| 16 | 
            -
                       | 
| 17 | 
            -
                       | 
| 15 | 
            +
                    http.post "/messages/send", {
         | 
| 16 | 
            +
                      messages: messages,
         | 
| 17 | 
            +
                      external_user_ids: external_user_ids
         | 
| 18 18 | 
             
                    }
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 | 
             
                end
         | 
| @@ -4,10 +4,10 @@ module BrazeRuby | |
| 4 4 | 
             
              module REST
         | 
| 5 5 | 
             
                class TrackUsers < Base
         | 
| 6 6 | 
             
                  def perform(attributes: [], events: [], purchases: [])
         | 
| 7 | 
            -
                    http.post  | 
| 8 | 
            -
                       | 
| 9 | 
            -
                       | 
| 10 | 
            -
                       | 
| 7 | 
            +
                    http.post "/users/track", {
         | 
| 8 | 
            +
                      attributes: attributes,
         | 
| 9 | 
            +
                      events: events,
         | 
| 10 | 
            +
                      purchases: purchases
         | 
| 11 11 | 
             
                    }
         | 
| 12 12 | 
             
                  end
         | 
| 13 13 | 
             
                end
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module BrazeRuby
         | 
| 4 | 
            +
              module REST
         | 
| 5 | 
            +
                class TriggerCampaignSchedule < Base
         | 
| 6 | 
            +
                  attr_reader :params
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  def initialize(api_key, braze_url, options, **params)
         | 
| 9 | 
            +
                    @params = params
         | 
| 10 | 
            +
                    super api_key, braze_url, options
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  def perform
         | 
| 14 | 
            +
                    http.post("/campaigns/trigger/schedule/create", @params)
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
    
        data/lib/braze_ruby/rest.rb
    CHANGED
    
    | @@ -1,20 +1,24 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require  | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 6 | 
            -
            require  | 
| 7 | 
            -
            require  | 
| 8 | 
            -
            require  | 
| 9 | 
            -
            require  | 
| 10 | 
            -
            require  | 
| 11 | 
            -
            require  | 
| 12 | 
            -
            require  | 
| 13 | 
            -
            require  | 
| 14 | 
            -
            require  | 
| 15 | 
            -
            require  | 
| 16 | 
            -
            require  | 
| 17 | 
            -
            require  | 
| 18 | 
            -
            require  | 
| 19 | 
            -
            require  | 
| 20 | 
            -
            require  | 
| 3 | 
            +
            require "braze_ruby/rest/base"
         | 
| 4 | 
            +
            require "braze_ruby/rest/track_users"
         | 
| 5 | 
            +
            require "braze_ruby/rest/send_messages"
         | 
| 6 | 
            +
            require "braze_ruby/rest/schedule_messages"
         | 
| 7 | 
            +
            require "braze_ruby/rest/email_status"
         | 
| 8 | 
            +
            require "braze_ruby/rest/email_hard_bounces"
         | 
| 9 | 
            +
            require "braze_ruby/rest/email_unsubscribes"
         | 
| 10 | 
            +
            require "braze_ruby/rest/export_users"
         | 
| 11 | 
            +
            require "braze_ruby/rest/list_segments"
         | 
| 12 | 
            +
            require "braze_ruby/rest/delete_users"
         | 
| 13 | 
            +
            require "braze_ruby/rest/trigger_campaign_schedule"
         | 
| 14 | 
            +
            require "braze_ruby/rest/trigger_campaign_send"
         | 
| 15 | 
            +
            require "braze_ruby/rest/trigger_canvas_send"
         | 
| 16 | 
            +
            require "braze_ruby/rest/canvas_details"
         | 
| 17 | 
            +
            require "braze_ruby/rest/subscription_status_set"
         | 
| 18 | 
            +
            require "braze_ruby/rest/subscription_status_get"
         | 
| 19 | 
            +
            require "braze_ruby/rest/subscription_user_status"
         | 
| 20 | 
            +
            require "braze_ruby/rest/identify_users"
         | 
| 21 | 
            +
            require "braze_ruby/rest/create_user_aliases"
         | 
| 22 | 
            +
            require "braze_ruby/rest/rename_external_ids"
         | 
| 23 | 
            +
            require "braze_ruby/rest/remove_external_ids"
         | 
| 24 | 
            +
            require "braze_ruby/rest/remove_email_addresses_from_spam"
         | 
    
        data/lib/braze_ruby/version.rb
    CHANGED
    
    
    
        data/lib/braze_ruby.rb
    CHANGED
    
    | @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require  | 
| 3 | 
            +
            require "braze_ruby/version"
         | 
| 4 4 |  | 
| 5 5 | 
             
            module BrazeRuby
         | 
| 6 | 
            -
              autoload :API,  | 
| 7 | 
            -
              autoload :REST,  | 
| 8 | 
            -
              autoload :Endpoints,  | 
| 6 | 
            +
              autoload :API, "braze_ruby/api"
         | 
| 7 | 
            +
              autoload :REST, "braze_ruby/rest"
         | 
| 8 | 
            +
              autoload :Endpoints, "braze_ruby/endpoints"
         | 
| 9 9 | 
             
            end
         |