Module: Consumerable

Extended by:
ActiveSupport::Autoload
Defined in:
lib/consumerable.rb,
lib/consumerable/model.rb,
lib/consumerable/errors.rb,
lib/consumerable/version.rb,
lib/consumerable/listable.rb,
lib/consumerable/creatable.rb,
lib/consumerable/deletable.rb,
lib/consumerable/connection.rb,
lib/consumerable/associations.rb,
lib/consumerable/configuration.rb,
lib/consumerable/associations/has_many.rb,
lib/consumerable/errors/record_invalid.rb,
lib/consumerable/associations/belongs_to.rb,
lib/consumerable/associations/has_many_proxy.rb

Defined Under Namespace

Modules: Associations, Creatable, Deletable, Errors, Listable, Model Classes: Configuration, Connection

Constant Summary collapse

VERSION =
'0.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



7
8
9
# File 'lib/consumerable.rb', line 7

def configuration
  @configuration
end

Class Method Details

.configure {|self.configuration| ... } ⇒ Object

Yields:



16
17
18
19
20
# File 'lib/consumerable.rb', line 16

def self.configure
  self.configuration = Consumerable::Configuration.new
  yield self.configuration
  self.configuration
end

.content_type_string(content_type) ⇒ Object



22
23
24
25
26
27
# File 'lib/consumerable.rb', line 22

def self.content_type_string(content_type)
  {
    json: 'application/json',
    xml: 'application/xml'
  }.fetch(content_type)
end

.eager_autoload!Object



39
40
41
42
# File 'lib/consumerable.rb', line 39

def self.eager_autoload!
  super
  Consumerable::Associations.eager_load!
end

.log(message) ⇒ Object



10
11
12
13
14
# File 'lib/consumerable.rb', line 10

def self.log(message)
  if configuration && configuration.perform_logging?
    configuration.logger.info("CONSUMERABLE: #{message}")
  end
end