Class: Locomotive::Steam::APIContentEntryService
- Inherits:
-
ContentEntryService
- Object
- Struct
- ContentEntryService
- Locomotive::Steam::APIContentEntryService
- Includes:
- Services::Concerns::Decorator
- Defined in:
- lib/locomotive/steam/services/api_content_entry_service.rb
Instance Attribute Summary
Attributes inherited from ContentEntryService
#account, #content_type, #locale
Instance Method Summary collapse
- #create(type_slug, attributes, as_json = false) ⇒ Object
- #update(type_slug, id_or_slug, attributes, as_json = false) ⇒ Object
Methods inherited from ContentEntryService
#all, #bulk_destroy, #create!, #destroy, #destroy_all, #localize, #permitted_attributes, #public_create, #send_notifications, #sort, #update!
Methods included from Concerns::ActivityService
#track_activity, #without_tracking_activity
Instance Method Details
#create(type_slug, attributes, as_json = false) ⇒ Object
10 11 12 13 14 |
# File 'lib/locomotive/steam/services/api_content_entry_service.rb', line 10 def create(type_slug, attributes, as_json = false) with_form(type_slug, attributes, as_json) do |_attributes| @content_type.entries.create(_attributes) end end |
#update(type_slug, id_or_slug, attributes, as_json = false) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/locomotive/steam/services/api_content_entry_service.rb', line 16 def update(type_slug, id_or_slug, attributes, as_json = false) with_form(type_slug, attributes, as_json) do |_attributes| entry = @content_type.entries.by_id_or_slug(id_or_slug).first entry.update_attributes(_attributes) entry end end |