Class: ShopifyCLI::Theme::Syncer::Uploader::BulkItem
- Inherits:
-
Object
- Object
- ShopifyCLI::Theme::Syncer::Uploader::BulkItem
- Defined in:
- lib/shopify_cli/theme/syncer/uploader/bulk_item.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#retries ⇒ Object
Returns the value of attribute retries.
Instance Method Summary collapse
- #asset ⇒ Object
- #body ⇒ Object
-
#initialize(file, &block) ⇒ BulkItem
constructor
A new instance of BulkItem.
- #key ⇒ Object
- #liquid? ⇒ Boolean
- #size ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file, &block) ⇒ BulkItem
Returns a new instance of BulkItem.
13 14 15 16 17 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 13 def initialize(file, &block) @file = file @block = block @retries = 0 end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
10 11 12 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 10 def block @block end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
10 11 12 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 10 def file @file end |
#retries ⇒ Object
Returns the value of attribute retries.
11 12 13 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 11 def retries @retries end |
Instance Method Details
#asset ⇒ Object
43 44 45 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 43 def asset @asset ||= asset_hash end |
#body ⇒ Object
39 40 41 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 39 def body @body ||= JSON.generate(asset: asset) end |
#key ⇒ Object
31 32 33 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 31 def key file.relative_path end |
#liquid? ⇒ Boolean
27 28 29 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 27 def liquid? file.liquid? end |
#size ⇒ Object
35 36 37 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 35 def size @size ||= body.bytesize end |
#to_h ⇒ Object
19 20 21 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 19 def to_h { body: body } end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/shopify_cli/theme/syncer/uploader/bulk_item.rb', line 23 def to_s "#<#{self.class.name} key=#{key}, retries=#{retries}>" end |