Class: KeyReportRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/genba/key_report_request.rb

Overview

KeyReportRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ KeyReportRequest

Returns a new instance of KeyReportRequest.



10
11
12
13
14
15
# File 'lib/genba/key_report_request.rb', line 10

def initialize(data = {})
  @key = data[:key]
  @key_id = data[:key_id]
  @country_iso = data[:country_iso]
  @user_ip_address = data[:user_ip_address]
end

Instance Attribute Details

#country_isoObject

Returns the value of attribute country_iso.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def country_iso
  @country_iso
end

#e_tailer_buying_priceObject

Returns the value of attribute e_tailer_buying_price.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def e_tailer_buying_price
  @e_tailer_buying_price
end

#e_tailer_buying_price_currency_codeObject

Returns the value of attribute e_tailer_buying_price_currency_code.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def e_tailer_buying_price_currency_code
  @e_tailer_buying_price_currency_code
end

#e_tailer_selling_price_currency_codeObject

Returns the value of attribute e_tailer_selling_price_currency_code.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def e_tailer_selling_price_currency_code
  @e_tailer_selling_price_currency_code
end

#e_tailer_selling_price_grossObject

Returns the value of attribute e_tailer_selling_price_gross.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def e_tailer_selling_price_gross
  @e_tailer_selling_price_gross
end

#e_tailer_selling_price_netObject

Returns the value of attribute e_tailer_selling_price_net.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def e_tailer_selling_price_net
  @e_tailer_selling_price_net
end

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def key
  @key
end

#key_idObject

Returns the value of attribute key_id.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def key_id
  @key_id
end

#sale_dateObject

Returns the value of attribute sale_date.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def sale_date
  @sale_date
end

#user_ip_addressObject

Returns the value of attribute user_ip_address.



5
6
7
# File 'lib/genba/key_report_request.rb', line 5

def user_ip_address
  @user_ip_address
end

Instance Method Details

#to_genba_json_payloadObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/genba/key_report_request.rb', line 17

def to_genba_json_payload
  {
    key: @key,
    keyId: @key_id,
    countryISO: @country_iso,
    saleDate: @sale_date,
    userIpAddress: @user_ip_address,
    ETailerBuyingPrice: @e_tailer_buying_price,
    ETailerBuyingPriceCurrencyCode: @e_tailer_buying_price_currency_code,
    ETailerSellingPriceNet: @e_tailer_selling_price_net,
    ETailerSellingPriceGross: @e_tailer_selling_price_gross,
    ETailerSellingPriceCurrencyCode: @e_tailer_selling_price_currency_code
  }.select { |_, v| !v.nil? }
end