Class: BrazeAPI::Client

Overview

The top-level class that handles configuration and connection to the Braze API.

Constant Summary

Constants included from Endpoints::SubscriptionGroups::Status

Endpoints::SubscriptionGroups::Status::PATH

Constants included from Endpoints::Users::Delete

Endpoints::Users::Delete::PATH

Constants included from Endpoints::Users::Export

Endpoints::Users::Export::PATH

Constants included from Endpoints::Users::Identify

Endpoints::Users::Identify::PATH

Constants included from Endpoints::Users::Alias

Endpoints::Users::Alias::PATH

Constants included from Endpoints::Users::Track

Endpoints::Users::Track::PATH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Endpoints::SubscriptionGroups::Status

#update_status

Methods included from Endpoints::Users::Delete

#delete_users

Methods included from Endpoints::Users::Export

#export_users

Methods included from Endpoints::Users::Identify

#identify

Methods included from Endpoints::Users::Alias

#alias

Methods included from Endpoints::Users::Track

#track, #track_attribute, #track_event, #track_purchase

Constructor Details

#initialize(api_key:, braze_url:, app_id:) ⇒ Client

Returns a new instance of Client.



25
26
27
28
29
# File 'lib/braze_api/client.rb', line 25

def initialize(api_key:, braze_url:, app_id:)
  @api_key = api_key
  @braze_url = braze_url
  @app_id = app_id
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



17
18
19
# File 'lib/braze_api/client.rb', line 17

def app_id
  @app_id
end

Instance Method Details

#post(endpoint, params: {}) ⇒ Object

Returns a parsed response from a post request



32
33
34
35
# File 'lib/braze_api/client.rb', line 32

def post(endpoint, params: {})
  response = client.post(endpoint, params.to_json)
  JSON.parse(response.body)
end