Class: KeyReportRequest
- Inherits:
-
Object
- Object
- KeyReportRequest
- Defined in:
- lib/genba/key_report_request.rb
Overview
KeyReportRequest
Instance Attribute Summary collapse
-
#country_iso ⇒ Object
Returns the value of attribute country_iso.
-
#e_tailer_buying_price ⇒ Object
Returns the value of attribute e_tailer_buying_price.
-
#e_tailer_buying_price_currency_code ⇒ Object
Returns the value of attribute e_tailer_buying_price_currency_code.
-
#e_tailer_selling_price_currency_code ⇒ Object
Returns the value of attribute e_tailer_selling_price_currency_code.
-
#e_tailer_selling_price_gross ⇒ Object
Returns the value of attribute e_tailer_selling_price_gross.
-
#e_tailer_selling_price_net ⇒ Object
Returns the value of attribute e_tailer_selling_price_net.
-
#key ⇒ Object
Returns the value of attribute key.
-
#key_id ⇒ Object
Returns the value of attribute key_id.
-
#sale_date ⇒ Object
Returns the value of attribute sale_date.
-
#user_ip_address ⇒ Object
Returns the value of attribute user_ip_address.
Instance Method Summary collapse
-
#initialize(key: nil, key_id: nil, country_iso:, user_ip_address:, sale_date: nil, e_tailer_buying_price:, e_tailer_buying_price_currency_code:, e_tailer_selling_price_net:, e_tailer_selling_price_gross:, e_tailer_selling_price_currency_code:) ⇒ KeyReportRequest
constructor
A new instance of KeyReportRequest.
- #to_genba_json_payload ⇒ Object
Constructor Details
#initialize(key: nil, key_id: nil, country_iso:, user_ip_address:, sale_date: nil, e_tailer_buying_price:, e_tailer_buying_price_currency_code:, e_tailer_selling_price_net:, e_tailer_selling_price_gross:, e_tailer_selling_price_currency_code:) ⇒ KeyReportRequest
Returns a new instance of KeyReportRequest.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/genba/key_report_request.rb', line 10 def initialize( key: nil, key_id: nil, country_iso:, user_ip_address:, sale_date: nil, e_tailer_buying_price:, e_tailer_buying_price_currency_code:, e_tailer_selling_price_net:, e_tailer_selling_price_gross:, e_tailer_selling_price_currency_code: ) @key = key @key_id = key_id @country_iso = country_iso @user_ip_address = user_ip_address @sale_date = sale_date = = @e_tailer_selling_price_net = e_tailer_selling_price_net @e_tailer_selling_price_gross = e_tailer_selling_price_gross @e_tailer_selling_price_currency_code = e_tailer_selling_price_currency_code raise 'at least one of key or key_id' if key.nil? && key_id.nil? end |
Instance Attribute Details
#country_iso ⇒ Object
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_price ⇒ Object
Returns the value of attribute e_tailer_buying_price.
5 6 7 |
# File 'lib/genba/key_report_request.rb', line 5 def end |
#e_tailer_buying_price_currency_code ⇒ Object
Returns the value of attribute e_tailer_buying_price_currency_code.
5 6 7 |
# File 'lib/genba/key_report_request.rb', line 5 def end |
#e_tailer_selling_price_currency_code ⇒ Object
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_gross ⇒ Object
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_net ⇒ Object
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 |
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/genba/key_report_request.rb', line 5 def key @key end |
#key_id ⇒ Object
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_date ⇒ Object
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_address ⇒ Object
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_payload ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/genba/key_report_request.rb', line 28 def to_genba_json_payload payload ={ key: @key, keyId: @key_id, countryISO: @country_iso, userIpAddress: @user_ip_address, : , : , ETailerSellingPriceNet: @e_tailer_selling_price_net, ETailerSellingPriceGross: @e_tailer_selling_price_gross, ETailerSellingPriceCurrencyCode: @e_tailer_selling_price_currency_code }.select { |_, v| !v.nil? } payload[:saleDate] = @sale_date.strftime('%FT%T') if @sale_date payload end |