Sha256: 3b19c0609bb3913bfb2027d39f9ce3b175e63e011b51f84b7c0c81228e3843e1

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module Pinboard
  class Note < Struct.new(:id, :title, :created_at, :updated_at, :length)
    def initialize(attributes={})
      self.id         = attributes[:id]
      self.title      = attributes[:title]
      self.created_at = Util.parse_time(attributes[:created_at])
      self.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-0.1.0 lib/pinboard/note.rb