Class: Pdf::Label::ItemIdentifier
- Inherits:
-
BaseService
- Object
- BaseService
- Pdf::Label::ItemIdentifier
- Defined in:
- app/services/pdf/label/item_identifier.rb
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
10 11 12 |
# File 'app/services/pdf/label/item_identifier.rb', line 10 def renderer @renderer end |
Class Method Details
.call(*args, **kwargs, &block) ⇒ Object
6 7 8 |
# File 'app/services/pdf/label/item_identifier.rb', line 6 def self.call(*args, **kwargs, &block) new.call(*args, **kwargs, &block) end |
.target_market_options_for_select ⇒ Object
29 30 31 |
# File 'app/services/pdf/label/item_identifier.rb', line 29 def self. [['USA and Canada', 'usa_canada'], ['Europe', 'europe']] end |
Instance Method Details
#call(item, options = {}) ⇒ Object
23 24 25 26 27 |
# File 'app/services/pdf/label/item_identifier.rb', line 23 def call(item, = {}) Pdf::Loader.load! pdf = [:size] == 'large' ? add_item_page_large(item, ) : add_item_page(item, ) Result.new(pdf:, item:, file_name: file_name(item)) end |
#country_address_key(item) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/pdf/label/item_identifier.rb', line 12 def country_address_key(item) # Ideally we use store item to print these labels, but since right now it is item based, we will use a simple check # If the sku starts with IPE- or TWE- then its a EU item otherwise its a USA item # TODO, adapt code so we can do something like @store.country_iso3.downcase.to_sym in the future if item.sku.start_with?('IPE-', 'TWE-') :nld else :usa end end |