Sha256: 06871ee0d1ac4a632cf68fb1f0a66c4d257d55715f178d2236c02ac7378a7deb

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 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
      when 'get_sms_details'
        self.class.include Requests::GetSMSDetailsRequest
        validate_params!
        @request = build_get_sms_details_request
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cequens-0.1.2 lib/cequens/request.rb
cequens-0.1.1 lib/cequens/request.rb
cequens-0.1.0 lib/cequens/request.rb
cequens-0.0.9 lib/cequens/request.rb
cequens-0.0.8 lib/cequens/request.rb
cequens-0.0.7 lib/cequens/request.rb