Class: Locomotive::Wagon::PushSiteCommand
- Inherits:
-
PushBaseCommand
show all
- Defined in:
- lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
Instance Attribute Summary
#api_client, #content_assets_pusher, #filter, #remote_site, #steam_services
Instance Method Summary
collapse
#_push, #_push_with_timezone, #default_locale, #instrument, #locales, #only, #path, push, #push, #resource_name, #with_data, #with_data?
Instance Method Details
#decorate(entity) ⇒ Object
9
10
11
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb', line 9
def decorate(entity)
UpdateSiteDecorator.new(entity, default_locale, path, content_assets_pusher)
end
|
#entities ⇒ Object
5
6
7
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb', line 5
def entities
[repositories.site.first]
end
|
#label_for(decorated_entity) ⇒ Object
36
37
38
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb', line 36
def label_for(decorated_entity)
decorated_entity.name
end
|
#persist(decorated_entity) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb', line 13
def persist(decorated_entity)
_attributes = decorated_entity.to_hash
_attributes.delete(:picture) if remote_site['picture_url'].present?
_attributes.delete(:timezone) unless with_data?
_attributes.delete(:locales) if remote_site.edited?
_attributes.delete(:metafields) unless with_data?
_attributes.delete(:sections_content) unless with_data?
if _attributes.present?
api_client.current_site.update(_attributes)
else
raise SkipPersistingException.new
end
end
|