Module: Leetcoder::Helpers::GqlQueries

Included in:
BaseResource
Defined in:
lib/leetcoder/leetcoder/helpers/gql_queries.rb

Instance Method Summary collapse

Instance Method Details

#default_limitObject



6
# File 'lib/leetcoder/leetcoder/helpers/gql_queries.rb', line 6

def default_limit = ENV['TEST'] ? 5 : -1

#problemset_query(args = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/leetcoder/leetcoder/helpers/gql_queries.rb', line 8

def problemset_query(args = {})
  "    query problemsetQuestionList($filters: QuestionListFilterInput) {\n      problemsetQuestionList: questionList(\n        categorySlug: \"\#{args.fetch(:categorySlug, 'algorithms')}\",\n        limit: \#{args.fetch(:limit, default_limit)},\n        skip: \#{args.fetch(:skip, 0)},\n        filters: $filters\n      ) {\n        total: totalNum\n        questions: data {\n          acRate\n          difficulty\n          freqBar\n          frontendQuestionId: questionFrontendId\n          isFavor\n          paidOnly: isPaidOnly\n          status\n          title\n          titleSlug\n          topicTags {\n            name\n            id\n            slug\n          }\n          hasSolution\n          hasVideoSolution\n        }\n      }\n    }\n  GQL\nend\n"

#question_data_query(args = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/leetcoder/leetcoder/helpers/gql_queries.rb', line 41

def question_data_query(args = {})
  "    query questionData {\n      question(titleSlug: \"\#{args[:title_slug]}\") {\n        questionId\n        title\n        titleSlug\n        content\n        difficulty\n        categoryTitle\n        stats\n        topicTags {\n          name\n          slug\n          translatedName\n        }\n        likes dislikes isLiked similarQuestions exampleTestcases\n      }\n    }\n  GQL\nend\n"

#submissions_query(args = {}) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/leetcoder/leetcoder/helpers/gql_queries.rb', line 63

def submissions_query(args = {})
  "    query Submissions {\n      submissionList(\n        questionSlug: \"\#{args[:title_slug]}\",\n        limit: \#{args.fetch(:limit, default_limit)},\n        offset: \#{args.fetch(:skip, 0)}\n      ) {\n        lastKey\n        hasNext\n        submissions {\n          id\n          statusDisplay\n          lang\n          runtime\n          timestamp\n          url\n          isPending\n          memory\n        }\n      }\n    }\n  GQL\nend\n"