Class: Vacuum::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/vacuum/operation.rb

Overview

An Amazon Product Advertising API operation

Instance Method Summary collapse

Constructor Details

#initialize(name, params:, locale:) ⇒ Operation

Creates a new operation

Parameters:

  • name (String)
  • params (Hash)
  • locale (Locale)


18
19
20
21
22
# File 'lib/vacuum/operation.rb', line 18

def initialize(name, params:, locale:)
  @name = name
  @params = params
  @locale = locale
end

Instance Method Details

#bodyString

Returns:

  • (String)


35
36
37
# File 'lib/vacuum/operation.rb', line 35

def body
  @body ||= build_body
end

#headersHash

Returns:

  • (Hash)


25
26
27
28
29
30
31
32
# File 'lib/vacuum/operation.rb', line 25

def headers
  signature.headers.merge(
    'x-amz-target' =>
      "com.amazon.paapi5.v1.ProductAdvertisingAPIv1.#{name}",
    'content-encoding' => 'amz-1.0',
    'content-type' => 'application/json; charset=utf-8'
  )
end

#urlString

Returns:

  • (String)


40
41
42
# File 'lib/vacuum/operation.rb', line 40

def url
  @url ||= build_url
end