Class: Schematic::Dataexports::Client
- Inherits:
-
Object
- Object
- Schematic::Dataexports::Client
- Defined in:
- lib/schematic/dataexports/client.rb
Instance Method Summary collapse
- #create_data_export(request_options: {}, **params) ⇒ Schematic::Dataexports::Types::CreateDataExportResponse
- #get_data_export_artifact(request_options: {}, **params) ⇒ untyped
- #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/dataexports/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create_data_export(request_options: {}, **params) ⇒ Schematic::Dataexports::Types::CreateDataExportResponse
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/schematic/dataexports/client.rb', line 22 def create_data_export(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "data-exports", body: Schematic::Dataexports::Types::CreateDataExportRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Dataexports::Types::CreateDataExportResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_data_export_artifact(request_options: {}, **params) ⇒ untyped
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/schematic/dataexports/client.rb', line 55 def get_data_export_artifact(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "data-exports/#{URI.encode_uri_component(params[:data_export_id].to_s)}/artifact", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |