Class: AIPP::Downloader::GraphQL
- Defined in:
- lib/aipp/downloader/graphql.rb
Overview
Remote file via HTTP
Instance Attribute Summary
Attributes inherited from File
Instance Method Summary collapse
- #fetch_to(path) ⇒ Object
-
#initialize(client:, query:, variables:) ⇒ GraphQL
constructor
A new instance of GraphQL.
Methods inherited from File
Constructor Details
#initialize(client:, query:, variables:) ⇒ GraphQL
Returns a new instance of GraphQL.
6 7 8 |
# File 'lib/aipp/downloader/graphql.rb', line 6 def initialize(client:, query:, variables:) @client, @query, @variables = client, query, variables end |
Instance Method Details
#fetch_to(path) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/aipp/downloader/graphql.rb', line 10 def fetch_to(path) @client.query(@query, variables: @variables).tap do |result| ::File.write(path.join(fetched_file), result.data.to_h.to_json) end self end |