Sha256: 68917a968f49a14c3776d1b98ee50092d78878f76d50c465f88e389e6097ba69
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
module Nin module Integration module Todoist class Client class Sync < BaseClient API_URI = "#{BASE_URI}/sync".freeze def read_resources(resource_types = ['all'], sync_token = '*') res = HTTP.headers(accept: "application/json") .get("#{BASE_URI}/sync", params: { token: @token, sync_token: sync_token, resource_types: resource_types.to_json }) data = JSON.parse(res.body.to_s) unless resource_types == ['all'] data.slice(*resource_types) else data end end def write_resources(commands) res = HTTP.headers(accept: "application/json") .get("#{BASE_URI}/sync", params: { token: @token, commands: commands }) 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/sync.rb |
nin-1.2.0 | lib/nin/integration/todoist/client/sync.rb |