Sha256: 4148378116e83be630871cbca9f91c4be6cf121f2f9075bd3b768eaf9d558b7f

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

module Paymill
  module Operations
    module Find
      module ClassMethods
        # Finds a given object
        #
        # @param [Integer] id The id of the object that should be found
        # @return [Paymill::Base] The found object
        def find(id)
          response = Paymill.request(:get, "#{self.name.split("::").last.downcase}s/#{id}", {})
          self.new(response["data"])
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paymill-0.5.1 lib/paymill/operations/find.rb
paymill-0.5.0 lib/paymill/operations/find.rb
paymill-0.4.0 lib/paymill/operations/find.rb
paymill-0.3.0 lib/paymill/operations/find.rb