Class: Qinium::Config

Inherits:
Configurable show all
Defined in:
lib/qinium/config.rb

Instance Method Summary collapse

Methods inherited from Configurable

#[]=, #method_missing, #respond_to_missing?

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



3
4
5
6
7
8
9
10
11
# File 'lib/qinium/config.rb', line 3

def initialize(options = {})
  options[:protocol] ||= :https
  options = if options[:protocol] == :http
              http_options.merge(options)
            else
              https_options.merge(options)
            end
  super(default_options.merge(options))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Qinium::Configurable

Instance Method Details

#fetch_host(bucket = self.bucket, opts = {}) ⇒ Object



22
23
24
# File 'lib/qinium/config.rb', line 22

def fetch_host(bucket = self.bucket, opts = {})
  self[:fetch_host] || HostManager.new(self).fetch_host(bucket, opts)
end

#put_policy_options ⇒ Object



26
27
28
# File 'lib/qinium/config.rb', line 26

def put_policy_options
  @put_policy_options ||= self[:put_policy_options] || Configurable.new
end

#up_host(bucket = self.bucket) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/qinium/config.rb', line 13

def up_host(bucket = self.bucket)
  raw = self[:up_host]
  unless raw.to_s.strip.empty?
    normalize_qiniu_up_base_url(raw.to_s)
  else
    HostManager.new(self).up_host(bucket)
  end
end