Sha256: c7692db172f91585234be2896761882935c6828f2a3c6e7cff4a316722af41d7

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

module Nin
  module Integration
    module Todoist
      class Client
        class Item < BaseClient
          API_URI = "#{BASE_URI}/items".freeze

          def get(id)
            res = HTTP.headers(accept: "application/json")
              .get("#{API_URI}/get", params: { token: @token, item_id: id })

            JSON.parse(res.body.to_s)['item']
          end

          def add(item)
            res = HTTP.headers(accept: "application/json")
              .get("#{API_URI}/add", params: { token: @token, **item })

            JSON.parse(res.body.to_s)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nin-1.3.0 lib/nin/integration/todoist/client/item.rb
nin-1.2.0 lib/nin/integration/todoist/client/item.rb