Sha256: 93ec6ece63d0a5cfa658b1fd373651cb4c51da8f42e0a52950c8bed4ed735fa5

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eve_online-0.25.0 lib/eve_online/esi/models/bookmark.rb
eve_online-0.24.0 lib/eve_online/esi/models/bookmark.rb