PUT /newsletter_subscriptions/1
 PUT /newsletter_subscriptions/1.xml
196989
def update
      @newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])

      respond_to do |format|
        if @newsletter_subscription.update_attributes(newsletter_subscription_params)
          format.html { redirect_to([cmtool, @newsletter_subscription], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::NewsletterSubscription.model_name.human)) }
          format.xml  { head :ok }
        else
          format.html { render :action => "edit" }
          format.xml  { render :xml => @newsletter_subscription.errors, :status => :unprocessable_entity }
        end
      end
    end
599837
def subscribed(self, user):
        
        for who, record in self.logs:
            if (record["field_name"] == "cc" and
                    user.email in record["added"]):
                return True
        return False
1087866
def subscribe_to(channel, opts = {})
      js_tag = opts.delete(:include_js_tag){ true }
      subscription = Danthes.subscription(channel: channel)
      content = raw("if (typeof Danthes != 'undefined') { Danthes.sign(#{subscription.to_json}) }")
      js_tag ? content_tag('script', content, type: 'text/javascript') : content
    end
173436
def show
      @newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])

      respond_to do |format|
        format.html # show.html.erb
        format.xml  { render :xml => @newsletter_subscription }
      end
    end
1302352
def set(self, folder: str, subscribed: bool) -> None:
        """"""
        if subscribed:
            self.add(folder)
        else:
            self.remove(folder)
372929
protected function registerImportService(){

        $this->app->singleton('designpond\newsletter\Newsletter\Worker\ImportWorkerInterface', function()
        {
            return new \designpond\newsletter\Newsletter\Worker\ImportWorker(
                \App::make('designpond\newsletter\Newsletter\Worker\MailjetServiceInterface'),
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterUserInterface'),
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterInterface'),
                \App::make('Maatwebsite\Excel\Excel'),
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterCampagneInterface'),
                \App::make('designpond\newsletter\Newsletter\Worker\CampagneInterface'),
                \App::make('designpond\newsletter\Newsletter\Service\UploadInterface')
            );
        });
    }
632013
function subscribe() {
  console.log('Subscribing client ' + clientId + ' to topic: ' + topics.subscribe);
  client.subscribe(topics.subscribe);
  isSubscribed = true;
}
772931
def organization_subscriptions(self, organization_id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{organization_id}/subscriptions.json"
        api_path = api_path.format(organization_id=organization_id)
        return self.call(api_path, **kwargs)
121923
def event_subscription(event)
      ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data|
        filtered_data = data.slice(*event[:allowed_data])
        filtered_data[:event_name] = event[:id]
        filtered_data[:event_id] = event_id
        if event[:id] == "sql.active_record"
          binds = data[:binds].each_with_object({}) { |bind, output| output[bind.name] = '?' if defined?(bind.name) }
          filtered_data[:binds] = JSON.dump(binds) unless binds.empty?
        end
        Bugsnag.leave_breadcrumb(
          event[:message],
          filtered_data,
          event[:type],
          :auto
        )
      end
    end
236617
function (subscription, cb) {

		Subscription.findOrCreate(subscription.id, subscription)
	    .exec(function (err, foundSubscription){
	      if (err) return cb(err);
	      if (foundSubscription.lastStripeEvent > subscription.lastStripeEvent) return cb(null, foundSubscription);
	      if (foundSubscription.lastStripeEvent == subscription.lastStripeEvent) return Subscription.afterStripeCustomerSubscriptionUpdated(foundSubscription, function(err, subscription){ return cb(err, subscription)});
	      Subscription.update(foundSubscription.id, subscription)
	      .exec(function(err, updatedSubscriptions){
	      	if (err) return cb(err);
	      	if(!updatedSubscriptions) return cb(null, null);
	      	Subscription.afterStripeCustomerSubscriptionUpdated(updatedSubscriptions[0], function(err, subscription){
	      		cb(err, subscription);
	      	});
	      });
	    });
	}
754760
function subUpdate (req) {
  return [ req.params.service + '/' + req.params.subresources, fp.parseNil(req.params.id), req.body ];
}
497527
def push_subscription_update(self, follow_events=None, 
                              favourite_events=None, reblog_events=None, 
                              mention_events=None):
        
        params = {}
        
        if follow_events != None:
            params['data[alerts][follow]'] = follow_events
        
        if favourite_events != None:
            params['data[alerts][favourite]'] = favourite_events
            
        if reblog_events != None:
            params['data[alerts][reblog]'] = reblog_events
            
        if mention_events != None:
            params['data[alerts][mention]'] = mention_events
            
        return self.__api_request('PUT', '/api/v1/push/subscription', params)
430237
protected function registerSubscribeWorkerService(){

        $this->app->bind('designpond\newsletter\Newsletter\Worker\SubscriptionWorkerInterface', function()
        {
            return new \designpond\newsletter\Newsletter\Worker\SubscriptionWorker(
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterInterface'),
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterUserInterface'),
                \App::make('designpond\newsletter\Newsletter\Worker\MailjetServiceInterface')
            );
        });
    }
562215
public void mailingList_subscribe_POST(String email, String mailingList) throws IOException {
		String qPath = "/me/mailingList/subscribe";
		StringBuilder sb = path(qPath);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "email", email);
		addBody(o, "mailingList", mailingList);
		exec(qPath, "POST", sb.toString(), o);
	}
110928
private function processGeneralSubscription()
    {
        $customerId = $this->customerSession->getCustomerId();
        if ($customerId === null) {
            $this->messageManager->addError(__('Something went wrong while saving your subscription.'));
        } else {
            try {
                $customer = $this->customerRepository->getById($customerId);
                $storeId = $this->helper->storeManager->getStore()->getId();
                $customer->setStoreId($storeId);
                $isSubscribedState = $customer->getExtensionAttributes()
                    ->getIsSubscribed();
                $isSubscribedParam = (boolean)$this->getRequest()
                    ->getParam('is_subscribed', false);
                if ($isSubscribedParam !== $isSubscribedState) {
                    $this->customerRepository->save($customer);
                    if ($isSubscribedParam) {
                        $subscribeModel = $this->subscriberFactory->create()
                            ->subscribeCustomerById($customerId);
                        $subscribeStatus = $subscribeModel->getStatus();
                        if ($subscribeStatus == Subscriber::STATUS_SUBSCRIBED) {
                            $this->messageManager->addSuccess(__('We have saved your subscription.'));
                        } else {
                            $this->messageManager->addSuccess(__('A confirmation request has been sent.'));
                        }
                    } else {
                        $this->subscriberFactory->create()
                            ->unsubscribeCustomerById($customerId);
                        $this->messageManager->addSuccess(__('We have removed your newsletter subscription.'));
                    }
                } else {
                    $this->messageManager->addSuccess(__('We have updated your subscription.'));
                }
            } catch (\Exception $e) {
                $this->messageManager->addError(__('Something went wrong while saving your subscription.'));
            }
        }
    }
95409
def destroy
      @newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])
      @newsletter_subscription.destroy

      respond_to do |format|
        format.html { redirect_to(cmtool.newsletter_subscriptions_url) }
        format.xml  { head :ok }
      end
    end
333792
function(channel, subscription, context, once) {
      if (!channels[channel]) channels[channel] = [];
      channels[channel].push({fn: subscription, context: context || this, once: once});
    }