Class: Workarea::Emarsys::SalesDataGateway

Inherits:
Object
  • Object
show all
Defined in:
app/lib/workarea/emarsys/sales_data_gateway.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(secret_key, options = {}) ⇒ SalesDataGateway

Returns a new instance of SalesDataGateway.



6
7
8
9
# File 'app/lib/workarea/emarsys/sales_data_gateway.rb', line 6

def initialize(secret_key, options = {})
  @secret_key = secret_key
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'app/lib/workarea/emarsys/sales_data_gateway.rb', line 4

def options
  @options
end

#secret_keyObject (readonly)

Returns the value of attribute secret_key.



4
5
6
# File 'app/lib/workarea/emarsys/sales_data_gateway.rb', line 4

def secret_key
  @secret_key
end

Instance Method Details

#send_file(file) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'app/lib/workarea/emarsys/sales_data_gateway.rb', line 11

def send_file(file)
  path = "/hapi/merchant/#{merchant_id}/sales-data/api"

  response = connection.post do |req|
    req.url path
    req.body = File.read(file)
  end
  Response.new(response)
end