Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Stride#configuration should return a default object instead of nil #7

Open
mbobin opened this issue Jun 28, 2018 · 0 comments · May be fixed by #8
Open

Stride#configuration should return a default object instead of nil #7

mbobin opened this issue Jun 28, 2018 · 0 comments · May be fixed by #8

Comments

@mbobin
Copy link

mbobin commented Jun 28, 2018

Hello!

I was trying to use it without calling Stride#configure and stumbled onto this issue.

require 'stride'
client = Stride::Client.new(:cloud_id, :conversation_id, :access_token)

client.send_message({})
NoMethodError: undefined method `api_base_url' for nil:NilClass
from /Users/marius/.gem/ruby/2.4.4/gems/stride-0.1.1/lib/stride/message.rb:32:in `uri'

Should I draft a pull request to change lib/stride.rb ?

module Stride
  class << self
    attr_writer :configuration
   
    def configuration
      @configuration ||= Configuration.new
    end
  end

  def self.configure
    yield(configuration)
  end
end

Thank you!

@mbobin mbobin linked a pull request Jun 28, 2018 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant