Sha256: acc7727db10eed33a459224228186c1a44fbf002555a40b4b77f2b13901a8f9c

Contents?: true

Size: 1002 Bytes

Versions: 2

Compression:

Stored size: 1002 Bytes

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
        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 = NetworkHelper.getResponse(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

2 entries across 2 versions & 1 rubygems

Version Path
todoist-ruby-0.1.3 lib/todoist/misc/query.rb
todoist-ruby-0.1.2 lib/todoist/misc/query.rb