class TinyerpRuby::Service

Constants

SERVICES

Public Class Methods

new(connection) click to toggle source
# File lib/tinyerp_ruby/service.rb, line 5
def initialize(connection)
  raise StandartError unless connection.kind_of?(TinyerpRuby::Connection)
  @connection = connection
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/tinyerp_ruby/service.rb, line 10
def method_missing(method, *args, &block)
  method = method.to_sym
  if SERVICES.include?(method)
    poster(method, args)
  else
    super
  end
end

Private Instance Methods

poster(method, args) click to toggle source
# File lib/tinyerp_ruby/service.rb, line 21
def poster(method, args)
  params = args.first
  raise ArgumentError unless params.kind_of?(Hash)
  poster = Poster.call(@connection, method, params)
  poster
end