Sha256: 42b6001420371fb5746d69ccfbfc442bbc67be04646e39e3d2908952d22bd311
Contents?: true
Size: 712 Bytes
Versions: 2
Compression:
Stored size: 712 Bytes
Contents
module Relax class Service def initialize(values={}) @values = values end def authenticate(*args) @credentials = args self end class << self include Contextable def endpoint(url, options={}, &block) Endpoint.new(self, url, options, &block) end def register_action(action) # :nodoc: @actions ||= {} unless @actions[action.name] @actions[action.name] = action.name define_method(action.name) do |*args| action.execute(@values, @credentials, *args) end else raise ArgumentError.new("Duplicate action '#{action.name}'.") end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
tylerhunt-relax-0.1.1 | lib/relax/service.rb |
relax-0.1.1 | lib/relax/service.rb |