Module: Likeno

Defined in:
lib/likeno/version.rb,
lib/likeno.rb,
lib/likeno/entity.rb,
lib/likeno/errors/standard.rb,
lib/likeno/request_methods.rb,
lib/likeno/errors/request_error.rb,
lib/likeno/errors/record_invalid.rb,
lib/likeno/errors/record_not_found.rb,
lib/likeno/helpers/date_attributes.rb,
lib/likeno/helpers/hash_converters.rb,
lib/likeno/helpers/crud_request_parameters.rb

Overview

You should have received a copy of the GNU Lesser General Public License along with Likeno. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Modules: CRUDRequestParameters, DateAttributes, Errors, HashConverters, RequestMethods Classes: Entity

Constant Summary collapse

VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.configObject



43
44
45
# File 'lib/likeno.rb', line 43

def self.config
  @config
end

.configure(opts = {}) ⇒ Object

Configure through hash



24
25
26
27
28
# File 'lib/likeno.rb', line 24

def self.configure(opts = {})
  opts.each do |name, address|
    @config[name.to_sym] = address
  end
end

.configure_with(path_to_yaml_file) ⇒ Object

Configure through yaml file



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/likeno.rb', line 31

def self.configure_with(path_to_yaml_file)
  begin
    @config.merge!(Psych.load_file(path_to_yaml_file))
  rescue Errno::ENOENT
    raise Errno::ENOENT, "YAML configuration file couldn't be found."
  rescue Psych::Exception
    raise Psych::Exception, 'YAML configuration file contains invalid syntax.'
  end

  configure(@config)
end