Sha256: 81dd5b08ff49bdd17e319d82dc9ff957b6a231ca5ae867bc998366f3163902ef

Contents?: true

Size: 1008 Bytes

Versions: 19

Compression:

Stored size: 1008 Bytes

Contents

module Smess
  class CardBoardFish < HttpBase

    def deliver
      request.url = "#{url}?#{params.to_query}"
      http_get request
    end

    attr_accessor :username, :password
    def validate_config
      @username  = config.fetch(:username)
      @password  = config.fetch(:password)
    end

    private

    def url
      "https://sms2.cardboardfish.com:9444/HTTPSMS"
    end

    def params
      @params ||= {
        "S" => "H",
        "UN" => username,
        "P" => password,
        "DA" => sms.to,
        "M" => sms.message.strip_nongsm_chars.encode("ISO-8859-1"),
        "SA" => from,
        "ST" => 5
      }
    end

    def normal_result(response)
      response_code = response.code
      response_code = "0" if response.code.to_s == "200"
      # Successful response
      {
        message_id: message_id,
        response_code: response_code.to_s,
        response: {body: response.body},
        destination_address: sms.to,
        data: result_data
      }
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
smess-3.3.0 lib/smess/outputs/card_board_fish.rb
smess-3.2.0 lib/smess/outputs/card_board_fish.rb
smess-3.1.2 lib/smess/outputs/card_board_fish.rb
smess-3.1.1 lib/smess/outputs/card_board_fish.rb
smess-3.1.0 lib/smess/outputs/card_board_fish.rb
smess-3.0.0 lib/smess/outputs/card_board_fish.rb
smess-2.3.0 lib/smess/outputs/card_board_fish.rb
smess-2.2.1 lib/smess/outputs/card_board_fish.rb
smess-2.2.0 lib/smess/outputs/card_board_fish.rb
smess-2.1.0 lib/smess/outputs/card_board_fish.rb
smess-2.0.8 lib/smess/outputs/card_board_fish.rb
smess-2.0.7 lib/smess/outputs/card_board_fish.rb
smess-2.0.6 lib/smess/outputs/card_board_fish.rb
smess-2.0.5 lib/smess/outputs/card_board_fish.rb
smess-2.0.4 lib/smess/outputs/card_board_fish.rb
smess-2.0.3 lib/smess/outputs/card_board_fish.rb
smess-2.0.2 lib/smess/outputs/card_board_fish.rb
smess-2.0.1 lib/smess/outputs/card_board_fish.rb
smess-2.0 lib/smess/outputs/card_board_fish.rb