Class: Eniyismsapi::REPORT

Inherits:
Object
  • Object
show all
Defined in:
lib/eniyismsapi/report.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ REPORT

Returns a new instance of REPORT.



8
9
10
11
# File 'lib/eniyismsapi/report.rb', line 8

def initialize username, password
  @username = username
  @password = password
end

Instance Method Details

#balanceObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/eniyismsapi/report.rb', line 35

def balance
  path = "GetBalance"
  ns = {
    "xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" ,
    "xmlns"=>'SmsApi'
  }

  xml_build = Nokogiri::XML::Builder.new do |xml|
    xml.GetBalance(ns) {
      xml.Credential {
        xml.Password @password
        xml.Username @username
      }
    }
  end
  r = REQUEST.new path, xml_build.to_xml
  return r.request
end

#report(argv) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/eniyismsapi/report.rb', line 13

def report argv
  path = "Query"

  ns = {
    "xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" ,
    "xmlns"=>'SmsApi'
  }

  xml_build = Nokogiri::XML::Builder.new do |xml|
    xml.Query(ns){
      xml.Credential {
        xml.Password @password
        xml.Username @username
      }
      xml.MSISDN argv[:msisdn]
      xml.MessageId argv[:id]
    }
  end
  r = REQUEST.new path,xml_build.to_xml
  return r.request
end