Sha256: 127ea3fc308502f9edb688cd978a6b498e3f39faa3b5541596bc58688580a915

Contents?: true

Size: 507 Bytes

Versions: 4

Compression:

Stored size: 507 Bytes

Contents

module Shipcloud
  module Operations
    module Find
      module ClassMethods
        # Finds a given object
        #
        # @param [String] id The id of the object that should be found
        # @return [Shipcloud::Base] The found object
        def find(id)
          response = Shipcloud.request(:get, "#{self.name.split("::").last.downcase}s/#{id}", {})
          self.new(response)
        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
shipcloud-0.5.0 lib/shipcloud/operations/find.rb
shipcloud-0.4.0 lib/shipcloud/operations/find.rb
shipcloud-0.3.0 lib/shipcloud/operations/find.rb
shipcloud-0.2.0 lib/shipcloud/operations/find.rb