Class: ExetelSms::CreditCheck

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Defined in:
lib/credit_check.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

build_url, encode, exetel_url, matchurl?, new_reference_number, response_to_hash

Constructor Details

#initialize(config) ⇒ CreditCheck

Returns a new instance of CreditCheck.



8
9
10
# File 'lib/credit_check.rb', line 8

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/credit_check.rb', line 7

def config
  @config
end

Class Method Details

.api_pathObject



30
31
32
# File 'lib/credit_check.rb', line 30

def api_path
  'api_sms_credit.php'
end

.request_fieldsObject



26
27
28
# File 'lib/credit_check.rb', line 26

def request_fields
  [:username, :password]
end

.response_fieldsObject



22
23
24
# File 'lib/credit_check.rb', line 22

def response_fields
  [:status, :limit, :notes]
end

Instance Method Details

#get_credit_limitObject



12
13
14
15
16
17
18
19
# File 'lib/credit_check.rb', line 12

def get_credit_limit
  url = self.class.build_url(
    :username => @config.username,
    :password => @config.password
  )
  
  self.class.response_to_hash(ExetelSms::Client.request(url))
end