Class: Cloudmunda::Graphql::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmunda/graphql/client.rb

Class Method Summary collapse

Class Method Details

.content_headersObject



23
24
25
26
27
# File 'lib/cloudmunda/graphql/client.rb', line 23

def self.content_headers
  {
    'Content-Type': 'application/json'
  }
end

.headersObject



16
17
18
19
20
21
# File 'lib/cloudmunda/graphql/client.rb', line 16

def self.headers
  access_token = Cloudmunda::API::AccessToken.create(audience_url: 'tasklist.camunda.io').access_token
  {
    authorization: "Bearer #{access_token}"
  }
end

.post(params = {}) ⇒ Object



11
12
13
14
# File 'lib/cloudmunda/graphql/client.rb', line 11

def self.post(params = {})
  response = RestClient.post(Cloudmunda.graphql_url, params.to_json, headers.merge(content_headers))
  JSON.parse(response.body)
end