Sha256: 2ff86f77dcdc1a7c174484dc17f90e0d7649cd7413fd834dff26cc0596bec317

Contents?: true

Size: 454 Bytes

Versions: 4

Compression:

Stored size: 454 Bytes

Contents

module Troo
  class CardPersistence
    include Persistence

    def initialize(resource, options = {})
      @resource = resource
      @options = options
    end

    private
    attr_reader :resource, :options

    def created
      Troo::Card.create(remote)
    end

    def local
      @local ||= Troo::Card.first(external_card_id: resource.id)
    end

    def remote
      @remote ||= Troo::External::CardAdaptor.adapt(resource)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/models/card_persistence.rb
troo-0.0.6 lib/troo/models/card_persistence.rb
troo-0.0.5 lib/troo/models/card_persistence.rb
troo-0.0.4 lib/troo/models/card_persistence.rb