Sha256: 7fb26a63b6640921c3322513c2dc7ff07609023755ea1a2a162b1fd21f2854d2

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module EveOnline
  module ESI
    module Models
      class Bookmark < Base
        def as_json
          {
            bookmark_id: bookmark_id,
            created: created,
            creator_id: creator_id,
            folder_id: folder_id,
            item_id: item_id,
            item_type_id: item_type_id,
            label: label,
            location_id: location_id,
            notes: notes
          }
        end

        def bookmark_id
          options['bookmark_id']
        end

        def created
          created = options['created']

          parse_datetime_with_timezone(created) if created
        end

        def creator_id
          options['creator_id']
        end

        def folder_id
          options['folder_id']
        end

        # TODO: extract to class Item
        def item_id
          options['item']['item_id'] if options['item']
        end

        def item_type_id
          options['item']['type_id'] if options['item']
        end

        def label
          options['label']
        end

        def location_id
          options['location_id']
        end

        def notes
          options['notes']
        end

        def coordinates
          @coordinates ||= Coordinates.new(options['coordinates'])
        end

        # TODO: finish
        # def item
        #   @item ||= Item.new(options['item'])
        # end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eve_online-0.29.0 lib/eve_online/esi/models/bookmark.rb
eve_online-0.28.0 lib/eve_online/esi/models/bookmark.rb
eve_online-0.27.0 lib/eve_online/esi/models/bookmark.rb
eve_online-0.26.0 lib/eve_online/esi/models/bookmark.rb