module AliyunIot

Constants

VERSION

Public Class Methods

configuration() click to toggle source
# File lib/aliyun_iot.rb, line 29
def configuration
  @configuration ||= begin
    if defined? Rails
      config_file = Rails.root.join("config/aliyun_iot.yml")
    else
      config_file = File.expand_path('../../config/aliyun_iot.yml',  __FILE__)
    end

    if (File.exist?(config_file))
      config = YAML.load(ERB.new(File.new(config_file).read).result)
      config = config[Rails.env] if defined? Rails
    end
    OpenStruct.new(config || {access_id: "", key: "", region: "", product_key: "", owner_id: ""})
  end
end
configure() { |configuration| ... } click to toggle source
# File lib/aliyun_iot.rb, line 45
def configure
  yield(configuration)
end