Sha256: 2e5073247de243e8069a7f88d54e8d2241d99f942852fec318f067bb9e485203

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

module Digicert
  module Findable
    # The `.find` interface is just an alternvatie to instantiate
    # a new object, and please remeber this does not perform any
    # actual API Request. Use this interface whenever you need to
    # instantite an object from an existing id and then perform
    # some operation throught the objec's instnace methods, like
    # `#active`, `#reissue` and etc
    #
    # If you need an actual API response then use the `.fetch`
    # API, that will perform an actual API Reqeust and will return
    # the response from the Digicer API.
    #
    # We are not going to implement this right away, but in long
    # run may be we cna add some sort to lazy evaluation on this
    # interface, but that's not for sure.
    #
    def find(resource_id)
      new(resource_id: resource_id)
    end

    # Find by object
    #
    # This `find_by_object` interface works more likely a wrapper
    # around `find` interface, it expects the `object` to response
    # to the `id` method. Then it delegates object initialization
    # behavior to the `find` interface.
    #
    def find_by_object(object)
      find(object.id)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
digicert-1.0.0 lib/digicert/findable.rb
digicert-0.5.0 lib/digicert/findable.rb
digicert-0.4.1 lib/digicert/findable.rb
digicert-0.4.0 lib/digicert/findable.rb
digicert-0.3.1 lib/digicert/findable.rb
digicert-0.3.0 lib/digicert/findable.rb
digicert-0.2.0 lib/digicert/findable.rb
digicert-0.1.2 lib/digicert/findable.rb
digicert-0.1.1 lib/digicert/findable.rb