Sha256: aa947fd89c3e5b15f3fae5a190307594555d052ba3fa2c6249469f793cf98358

Contents?: true

Size: 961 Bytes

Versions: 13

Compression:

Stored size: 961 Bytes

Contents

module PortaText
  module Command
    module Api
      # The campaigns/:id/lifecycle endpoint.
      # https://github.com/PortaText/docs/wiki/REST-API#api_campaigns_lifecycle
      #
      # Author::    Marcelo Gornstein (mailto:marcelog@portatext.com)
      # Copyright:: Copyright (c) 2015 PortaText
      # License::   Apache-2.0
      class CampaignLifecycle < Base
        def id(id)
          set :id, id
        end

        def start
          action 'start'
        end

        def pause
          action 'pause'
        end

        def resume
          action 'resume'
        end

        def cancel
          action 'cancel'
        end

        def endpoint(_method)
          fail 'Campaign id cant be null' if @args[:id].nil?
          id = @args[:id]
          @args.delete :id
          "campaigns/#{id}/lifecycle"
        end

        private

        def action(action)
          set :action, action
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
portatext-1.1.10 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.9 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.8 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.7 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.6 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.5 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.4 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.3 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.2 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.1 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.1.0 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.0.0 lib/portatext/command/api/campaign_lifecycle.rb
portatext-1.0.0.pre lib/portatext/command/api/campaign_lifecycle.rb