Class: Locomotive::Wagon::PushContentTypesCommand
- Inherits:
-
PushBaseCommand
show all
- Defined in:
- lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb
Instance Attribute Summary collapse
#api_client, #content_assets_pusher, #filter, #remote_site, #steam_services
Instance Method Summary
collapse
#_push_with_timezone, #default_locale, #instrument, #locales, #only, #path, push, #push, #resource_name, #with_data, #with_data?
Instance Attribute Details
#step ⇒ Object
Returns the value of attribute step.
5
6
7
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb', line 5
def step
@step
end
|
Instance Method Details
#_push ⇒ Object
9
10
11
12
13
14
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb', line 9
def _push
%i(without_relationships only_relationships).each do |step|
@step = step
default_push
end
end
|
#decorate(entity) ⇒ Object
#default_push ⇒ Object
7
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb', line 7
alias_method :default_push, :_push
|
#entities ⇒ Object
16
17
18
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb', line 16
def entities
repositories.content_type.all
end
|
#label_for(decorated_entity) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb', line 34
def label_for(decorated_entity)
name = decorated_entity.name
if without_relationships?
name
else
"#{name} with relationships"
end
end
|
#persist(decorated_entity) ⇒ Object
28
29
30
31
32
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb', line 28
def persist(decorated_entity)
raise SkipPersistingException.new if only_relationships? && !decorated_entity.with_relationships?
api_client.content_types.update(decorated_entity.slug, decorated_entity.to_hash)
end
|