Module: Respo

Defined in:
lib/respo.rb,
lib/respo/base.rb,
lib/respo/helpers.rb,
lib/respo/version.rb,
lib/respo/response.rb,
lib/respo/constants.rb,
lib/respo/errors/base.rb,
lib/respo/errors/show.rb,
lib/respo/errors/index.rb,
lib/respo/configuration.rb,
lib/respo/errors/create.rb,
lib/respo/errors/update.rb,
lib/respo/errors/destroy.rb,
lib/respo/successes/base.rb,
lib/respo/successes/show.rb,
lib/respo/successes/index.rb,
lib/respo/successes/create.rb,
lib/respo/successes/update.rb,
lib/respo/successes/destroy.rb,
lib/respo/serializers/blueprinter.rb

Defined Under Namespace

Modules: Constants, Errors, Helpers, Serializers, Successes Classes: Base, Configuration, Response

Constant Summary collapse

VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.configurationObject



12
13
14
# File 'lib/respo/configuration.rb', line 12

def self.configuration
  @configuration ||= Configuration.new
end

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

Yields:



16
17
18
# File 'lib/respo/configuration.rb', line 16

def self.configure
  yield configuration if block_given?
end

.method_missing(method, record, **args) ⇒ Object

rubocop:disable Style/MissingRespondToMissing



6
7
8
9
10
11
12
13
14
# File 'lib/respo.rb', line 6

def self.method_missing(method, record, **args) # rubocop:disable Style/MissingRespondToMissing
  action, status = method.to_s.split('_')

  return 'No Method' unless %w[success error].include?(status)

  klass_name = "Respo::#{Helpers.pluralize(status).capitalize}::#{action.capitalize}"
  klass = Object.const_get(klass_name)
  klass.call(record, **args)
end