Sha256: c0cd11b53171eb2ad536345f531729f73d6e5a11893d97307e8cca067588e061

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

module Troo
  class CommentPersistence
    include Persistence

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

    private
    attr_reader :resource, :options

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

    def local
      @local ||= Troo::Comment.first(external_comment_id: resource.id)
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

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