Module: Cloudinary::BaseConfig

Included in:
AccountConfig, Config
Defined in:
lib/cloudinary/base_config.rb

Instance Method Summary collapse

Instance Method Details

#load_config_from_envObject

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/cloudinary/base_config.rb', line 22

def load_config_from_env
  raise NotImplementedError
end

#load_from_url(url) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cloudinary/base_config.rb', line 3

def load_from_url(url)
  return unless url && !url.empty?

  parsed_url = URI.parse(url)
  scheme = parsed_url.scheme.to_s.downcase

  if expected_scheme != scheme
    raise(CloudinaryException,
          "Invalid #{env_url} scheme. Expecting to start with '#{expected_scheme}://'")
  end

  update(config_from_parsed_url(parsed_url))
  setup_from_parsed_url(parsed_url)
end

#update(new_config = {}) ⇒ Object



18
19
20
# File 'lib/cloudinary/base_config.rb', line 18

def update(new_config = {})
  new_config.each{ |k,v| public_send(:"#{k}=", v) unless v.nil?}
end