Class: TempSMS22

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTempSMS22

Returns a new instance of TempSMS22.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/tempsms22.rb', line 15

def initialize()

  @url = 'https://receive-smss.com/'

  doc = Nokorexi.new(@url).to_doc

  @a = doc.root.xpath('//a[@class="number-boxes1-item-button"]').map  do |x|
    x.attributes[:href][/\d+/]
  end

end

Instance Attribute Details

#numberObject

Returns the value of attribute number.



13
14
15
# File 'lib/tempsms22.rb', line 13

def number
  @number
end

Instance Method Details

#numbersObject



31
32
33
# File 'lib/tempsms22.rb', line 31

def numbers()
  @a
end

#read(number = @number) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/tempsms22.rb', line 35

def read(number=@number)

  url = @url + 'sms/' + number + '/'
  doc = Nokorexi.new(url).to_doc
  table = doc.root.element('//table')

  a = table.xpath('tbody/tr').map do |x|
    x.xpath('td').map {|y| y.plaintext.strip }
  end

  a.map {|x| OpenStruct.new(i(from text date).zip(x).to_h) }

end