Sha256: eff67ba99c6a079734d9c23c0e8495b2676dbaee5f7332a2c031a2f38e0f4257

Contents?: true

Size: 1003 Bytes

Versions: 1

Compression:

Stored size: 1003 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_array(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

1 entries across 1 versions & 1 rubygems

Version Path
todoist-ruby-0.1.1 lib/todoist/misc/query.rb