class Smspartner::Configuration
Constants
- ALLOWED_RANGE_VALUES
Attributes
api_key[RW]
range_value[R]
sandbox[R]
sender[RW]
Public Class Methods
new(api_key:, range_value:, sandbox: false, sender: nil)
click to toggle source
@param api_key
[String] the API key @param range_value
[:premium, :low_cost] @param sandbox [Boolean] true to enable sandbox mode, disabled by default @param sender [String] SMS sender's name
# File lib/smspartner/configuration.rb, line 12 def initialize(api_key:, range_value:, sandbox: false, sender: nil) self.api_key = api_key self.range_value = range_value self.sandbox = sandbox self.sender = sender end
Public Instance Methods
to_h()
click to toggle source
@return [Hash] attributes as a hash
# File lib/smspartner/configuration.rb, line 20 def to_h { api_key: api_key, range_value: range_value, sandbox: sandbox, sender: sender } end
Private Instance Methods
range_value=(value)
click to toggle source
# File lib/smspartner/configuration.rb, line 37 def range_value=(value) unless ALLOWED_RANGE_VALUES.include?(value) raise ArgumentError.new( "#{value.inspect} is not a valid range_value, " \ "valid values are #{ALLOWED_RANGE_VALUES.inspect}" ) end @range_value = value end
sandbox=(bool)
click to toggle source
# File lib/smspartner/configuration.rb, line 48 def sandbox=(bool) unless Helpers::Boolean.valid?(bool) raise ArgumentError.new( "#{bool.inspect} should be a boolean" ) end @sandbox = bool end