Sha256: 98b9605ce8b1e9f39b228d25575b4ecc5eaf2ec09fa5e6874b7c625eaadd1b95
Contents?: true
Size: 976 Bytes
Versions: 17
Compression:
Stored size: 976 Bytes
Contents
require 'blurb/request_collection_with_campaign_type' class Blurb class SnapshotRequests < RequestCollectionWithCampaignType def initialize(campaign_type:, base_url:, headers:) @campaign_type = campaign_type @base_url = "#{base_url}/v2/#{@campaign_type}" @headers = headers end def create(record_type, state_filter='enabled,paused') execute_request( api_path: "/#{record_type.to_s.camelize(:lower)}/snapshot", request_type: :post, payload: {state_filter: state_filter} ) end def retrieve(snapshot_id) execute_request( api_path: "/snapshots/#{snapshot_id}", request_type: :get, ) end def download(snapshot_id) download_url = retrieve(snapshot_id)[:location] headers = @headers.dup["Content-Encoding"] = "gzip" Request.new( url: download_url, request_type: :get, headers: @headers ).make_request end end end
Version data entries
17 entries across 17 versions & 1 rubygems