Sha256: a46064864690803781f94313229a093c41a94cbfbc4b175b31b9089be6b08d4e

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

# Exposes hidden API that allows queries to be issued to return items.  Queries
# are restricted to a single "type" of query that is related to priority or date.  
# When it cannot parse query, it either returns a date result for 
# today or occasionally a 500 error.

module Todoist
  module Misc
    class Query < Todoist::Service
        include Todoist::Util 

        # Given an array of queries, return multiple results with key being the 
        # query results.  Query results have three key elements:  query, type, 
        # and data.  Data is where the items are stored.
        def queries(queries)
          result = @client.api_helper.get_response(Config::TODOIST_QUERY_COMMAND, 
            queries: queries.to_json)
          return ParseHelper.make_objects_as_hash(result, "query")
        end
        
        # Given a query, return result.  See return structure in comments above.
        def query(query)
          result = queries([query])
          return result[query]
        end


    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
todoist-ruby-0.2.3 lib/todoist/misc/query.rb
todoist-ruby-0.2.2 lib/todoist/misc/query.rb
todoist-ruby-0.2.1 lib/todoist/misc/query.rb