Sha256: 1d79929ec2be9fdb70878af7c3ecfbcea4eb597479a271e67dfd9cc68bb1afd3

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

module Pinboard
  class Note < Struct.new(:id, :title, :created_at, :updated_at, :length, :text)
    def initialize(attributes={})
      self.id         = attributes[:id]
      self.title      = attributes[:title]
      self.created_at = attributes[:created_at] && Util.parse_time(attributes[:created_at])
      self.updated_at = attributes[:updated_at] && Util.parse_time(attributes[:updated_at])
      self.length     = attributes[:length].to_i
      self.text       = attributes[:text]
    end

    def to_json(*args)
      {
        id:          id,
        title:       title,
        created_at:  created_at,
        updated_at:  updated_at,
        length:      length
      }.to_json(*args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pinboard-1.0.0 lib/pinboard/note.rb