Class: BulkImports::Clients::Graphql
- Inherits:
-
Object
- Object
- BulkImports::Clients::Graphql
- Defined in:
- lib/bulk_imports/clients/graphql.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(url: Gitlab::Saas.com_url, token: nil) ⇒ Graphql
constructor
A new instance of Graphql.
- #options(extra = {}) ⇒ Object
Constructor Details
#initialize(url: Gitlab::Saas.com_url, token: nil) ⇒ Graphql
Returns a new instance of Graphql.
37 38 39 40 41 |
# File 'lib/bulk_imports/clients/graphql.rb', line 37 def initialize(url: Gitlab::Saas.com_url, token: nil) @url = Gitlab::Utils.append_path(url, '/api/graphql') @token = token @client = Graphlient::Client.new(@url, (http: HTTP)) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
33 34 35 |
# File 'lib/bulk_imports/clients/graphql.rb', line 33 def client @client end |
Instance Method Details
#execute ⇒ Object
43 44 45 |
# File 'lib/bulk_imports/clients/graphql.rb', line 43 def execute(...) client.execute(...) end |
#options(extra = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/bulk_imports/clients/graphql.rb', line 47 def (extra = {}) return extra unless @token { headers: { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{@token}" } }.merge(extra) end |