jonallured / braze_ruby

A wrapper gem for the Braze REST API.
MIT License
19 stars 21 forks source link

Fix missing configuration reference in API initializer #51

Closed gerbal closed 2 weeks ago

gerbal commented 2 years ago

This change fixes using this library with the configuration initializer pattern documented in the configuration

jonallured commented 2 years ago

Hrm, I'm not sure what to make of this - can you demonstrate the problem you are solving here? Maybe there's a test we can add to solidify this usage? 🤔

gerbal commented 1 year ago

Prior to this change, values set by BrazeRuby.configure are never used. Instead the configuration is required to be passed at every invocation of BrazeRuby::API.new/3. It is my assumption, that if the Braze API key and URL are set in configuration, we should not have to pass the api key and url as arguments to Braze::API.new.

For example, prior to this change, the following usage is not valid

BrazeRuby.configure do |config|
      config.rest_api_key = "test"
      config.rest_url =  "https://rest.iad-03.braze.com"
end

# why do I need to pass already-set configuration variable to instantiate the API?
> BrazeRuby::API.new()
ArgumentError: wrong number of arguments (given 0, expected 2..3)
aganov commented 1 year ago

@jonallured can we merge this? Thanks!

jackewing commented 6 months ago

@jonallured it would be wonderful if you could merge this or https://github.com/jonallured/braze_ruby/pull/59 - I'm sure there are many others using your gem to conform to the new unsubscribe rules.

jonallured commented 2 weeks ago

Closing this one in favor of #64 - thank you again to @gerbal for this PR and for all your patience. 😬