class Voucherify::Service::Distributions

Attributes

client[R]

Public Class Methods

new(client) click to toggle source
# File lib/voucherify/service/distributions.rb, line 8
def initialize(client)
  @client = client
end

Public Instance Methods

create_export(export) click to toggle source
# File lib/voucherify/service/distributions.rb, line 23
def create_export(export)
  @client.post('/exports', export)
end
create_publication(params) click to toggle source
# File lib/voucherify/service/distributions.rb, line 39
def create_publication(params)
  @client.post('/publications', params.to_json)
end
delete_export(id) click to toggle source
# File lib/voucherify/service/distributions.rb, line 31
def delete_export(id)
  @client.delete("/exports/#{ERB::Util.url_encode(id)}")
end
get_export(id) click to toggle source
# File lib/voucherify/service/distributions.rb, line 27
def get_export(id)
  @client.get("/exports/#{ERB::Util.url_encode(id)}")
end
list_publications(params = {}) click to toggle source
# File lib/voucherify/service/distributions.rb, line 35
def list_publications(params = {})
  @client.get('/publications', params)
end
publish(params) click to toggle source
# File lib/voucherify/service/distributions.rb, line 12
def publish(params)
  payload = {}
  if params.is_a? String
    payload = {:campaign => params}
  elsif params.is_a? Hash
    payload = params
  end

  @client.post('/vouchers/publish', payload.to_json)
end