Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/braze_ruby/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
require "braze_ruby/endpoints/rename_external_ids"
require "braze_ruby/endpoints/remove_external_ids"
require "braze_ruby/endpoints/remove_email_addresses_from_spam"
require "braze_ruby/endpoints/content_blocks"

module BrazeRuby
class API
Expand All @@ -32,6 +33,7 @@ class API
include BrazeRuby::Endpoints::RenameExternalIds
include BrazeRuby::Endpoints::RemoveExternalIds
include BrazeRuby::Endpoints::RemoveEmailAddressesFromSpam
include BrazeRuby::Endpoints::ContentBlocks

def export_users(**payload)
BrazeRuby::REST::ExportUsers.new(api_key, braze_url, options).perform(**payload)
Expand Down
1 change: 1 addition & 0 deletions lib/braze_ruby/endpoints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
require "braze_ruby/endpoints/rename_external_ids"
require "braze_ruby/endpoints/remove_external_ids"
require "braze_ruby/endpoints/remove_email_addresses_from_spam"
require "braze_ruby/endpoints/content_blocks"
19 changes: 19 additions & 0 deletions lib/braze_ruby/endpoints/content_blocks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module BrazeRuby
module Endpoints
module ContentBlocks
attr_writer :content_blocks_service

def list_content_blocks
content_blocks_service.perform
end

private

def content_blocks_service
@content_blocks_service ||= BrazeRuby::REST::ContentBlocks.new(api_key, braze_url, options)
end
end
end
end
1 change: 1 addition & 0 deletions lib/braze_ruby/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
require "braze_ruby/rest/rename_external_ids"
require "braze_ruby/rest/remove_external_ids"
require "braze_ruby/rest/remove_email_addresses_from_spam"
require "braze_ruby/rest/content_blocks"
11 changes: 11 additions & 0 deletions lib/braze_ruby/rest/content_blocks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module BrazeRuby
module REST
class ContentBlocks < Base
def perform
http.get "/content_blocks/list"
end
end
end
end
28 changes: 28 additions & 0 deletions spec/braze_ruby/endpoints/content_blocks_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

require "spec_helper"

class API
include BrazeRuby::Endpoints::ContentBlocks

def api_key
:api_key
end
end

describe BrazeRuby::Endpoints::ContentBlocks do
describe "#list_content_blocks" do
let(:api) { API.new }
let(:content_blocks_service) { double(:content_blocks_service) }

before { api.content_blocks_service = content_blocks_service }

it "lists content blocks" do
expect(content_blocks_service).to receive(:perform)
api.list_content_blocks
end

# https://www.braze.com/docs/api/endpoints/templates/content_blocks_templates/get_list_email_content_blocks/
xit "supports optional params"
end
end