Module: Automation::API::Requests::AppSync

Included in:
Client
Defined in:
lib/automation/api/requests/app_sync.rb

Overview

Automation::API::Requests::AppSync

Constant Summary collapse

GRAPHQL_ENDPOINT =
'https://fdrvbwlqtngjxogf2325feddm4.appsync-api.us-east-1.amazonaws.com/graphql'
GRAPHQL_SEARCH =
"  query($storeId: ID) {\n    searchChecks(\n      filter: {\n        storeId: { eq: $storeId }\n      }\n    ) {\n      items {\n        id\n        version\n      }\n    }\n  }\n"
GRAPHQL_DELETE =
"  mutation ($input: DeleteCheckInput!) {\n    deleteCheck(input: $input) {\n      id\n    }\n  }\n"

Instance Method Summary collapse

Instance Method Details

#delete_check(id, version) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/automation/api/requests/app_sync.rb', line 44

def delete_check(id, version)
  client.query(
    delete_mutation,
    variables: { input: { id: id, expectedVersion: version } },
    context: { token: jwt_token }
  ).data.delete_check
end

#search_checksObject



36
37
38
39
40
41
42
# File 'lib/automation/api/requests/app_sync.rb', line 36

def search_checks
  client.query(
    search_query,
    variables: { storeId: uuid.downcase },
    context: { token: jwt_token }
  ).data.search_checks.items
end