Class: Blurb::SnapshotRequests
Constant Summary
Constants inherited
from BaseClass
BaseClass::CAMPAIGN_TYPE_CODES
Instance Method Summary
collapse
#create_bulk, #delete, #list, #list_extended, #retrieve_extended, #update, #update_bulk
Constructor Details
#initialize(campaign_type:, base_url:, headers:) ⇒ SnapshotRequests
5
6
7
8
9
|
# File 'lib/blurb/snapshot_requests.rb', line 5
def initialize(campaign_type:, base_url:, headers:)
@campaign_type = campaign_type
@base_url = "#{base_url}/v2/#{@campaign_type}"
=
end
|
Instance Method Details
#create(record_type, state_filter = 'enabled,paused') ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/blurb/snapshot_requests.rb', line 11
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
|
#download(snapshot_id) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/blurb/snapshot_requests.rb', line 26
def download(snapshot_id)
download_url = retrieve(snapshot_id)[:location]
= .dup["Content-Encoding"] = "gzip"
Request.new(
url: download_url,
request_type: :get,
headers:
).make_request
end
|
#retrieve(snapshot_id) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/blurb/snapshot_requests.rb', line 19
def retrieve(snapshot_id)
execute_request(
api_path: "/snapshots/#{snapshot_id}",
request_type: :get,
)
end
|