Sha256: d7be0713e4502bcb5f370d057bb7d0376e1d4a1823cc3b5f4f171465fd5d5513

Contents?: true

Size: 533 Bytes

Versions: 6

Compression:

Stored size: 533 Bytes

Contents

# frozen_string_literal: true

module Cequens
  class Request
    DEFAULT_OPTIONS = {}.freeze

    attr_reader :action, :params, :request, :options

    def initialize(action, params, opts)
      @action = action
      @params = params
      @options = DEFAULT_OPTIONS.merge(opts)

      build_request
    end

    private

    def build_request
      case action
      when 'send_sms'
        self.class.include Requests::SendSMSRequest
        validate_params!
        @request = build_send_sms_request
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cequens-0.0.6 lib/cequens/request.rb
cequens-0.0.5 lib/cequens/request.rb
cequens-0.0.4 lib/cequens/request.rb
cequens-0.0.3 lib/cequens/request.rb
cequens-0.0.2 lib/cequens/request.rb
cequens-0.0.1 lib/cequens/request.rb