Class: Zendesk2::CreateHelpCenterSubscription
- Inherits:
-
Object
- Object
- Zendesk2::CreateHelpCenterSubscription
- Includes:
- HelpCenter::SubscriptionRequest, Request
- Defined in:
- lib/zendesk2/help_center/create_help_center_subscription.rb
Instance Attribute Summary
Attributes included from Request
Instance Method Summary collapse
Methods included from HelpCenter::SubscriptionRequest
#content_id, #content_type, included, #plural_content_type, #route_prefix, #subscription, #subscription_id
Methods included from Request
#call, cistern_included, #data, #delete!, #error!, #find!, #html_url_for, included, #mock_response, #page, #page_params!, #page_params?, #pluralize, #real, #real_request, #request_body, #request_params, #request_path, #resources, #response, #timestamp, #url_for
Instance Method Details
#mock ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/zendesk2/help_center/create_help_center_subscription.rb', line 19 def mock identity = cistern.serial_id url = url_for("/help_center/#{plural_content_type}/#{content_id}/subscription.json") content_collection = "help_center_#{plural_content_type}".to_sym find!(content_collection, content_id) if subscription_params.empty? mock_response('Required parameter missing: subscription', status: 400) end record = subscription_params.merge( 'id' => identity, 'url' => url, 'created_at' => , # @todo create #timestamp helper 'updated_at' => , 'content_id' => content_id, 'content_type' => content_type, ) record['locale'] = record.delete('source_locale') if record['source_locale'] cistern.data[:help_center_subscriptions][identity] = record mock_response('subscription' => record) end |
#subscription_params ⇒ Object
12 13 14 15 16 17 |
# File 'lib/zendesk2/help_center/create_help_center_subscription.rb', line 12 def subscription_params return @subscription_params if @subscription_params body = Cistern::Hash.slice(subscription, *self.class.accepted_attributes(content_type)) body['source_locale'] = body.delete('locale') if body['locale'] @subscription_params = body end |