Class: Rfsms::SendAnswer

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

Instance Attribute Summary collapse

Attributes inherited from Answer

#descr

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ SendAnswer

Returns a new instance of SendAnswer.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/rfsms.rb', line 68

def initialize(body)
  super(body) do |e|
    e.has_key?(:smsid) and
    e[:datetime] =~ DATEREGEXP and
    e[:action] =~ /^(?:check|make|send)$/ and
    e[:all_recivers] =~ INTEGER_REGEXP and
    e[:col_send_abonent] =~ INTEGER_REGEXP and
    e[:col_non_send_abonent] =~ INTEGER_REGEXP and
    e[:price_of_sending] =~ FLOAT_REGEXP and
    e[:colsms_of_sending] =~ INTEGER_REGEXP and
    e[:price] =~ FLOAT_REGEXP
  end
  @datetime = DateTime.strptime(@datetime, DATEFORMAT)
  @all_recivers = @all_recivers.to_i
  @col_send_abonent = @col_send_abonent.to_i
  @col_non_send_abonent = @col_non_send_abonent.to_i
  @price_of_sending = @price_of_sending.to_f
  @colsms_of_sending = @colsms_of_sending.to_i
  @price = @price.to_f
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



64
65
66
# File 'lib/rfsms.rb', line 64

def action
  @action
end

#all_reciversObject (readonly)

Returns the value of attribute all_recivers.



64
65
66
# File 'lib/rfsms.rb', line 64

def all_recivers
  @all_recivers
end

#col_non_send_abonentObject (readonly)

Returns the value of attribute col_non_send_abonent.



64
65
66
# File 'lib/rfsms.rb', line 64

def col_non_send_abonent
  @col_non_send_abonent
end

#col_send_abonentObject (readonly)

Returns the value of attribute col_send_abonent.



64
65
66
# File 'lib/rfsms.rb', line 64

def col_send_abonent
  @col_send_abonent
end

#colsms_of_sendingObject (readonly)

Returns the value of attribute colsms_of_sending.



64
65
66
# File 'lib/rfsms.rb', line 64

def colsms_of_sending
  @colsms_of_sending
end

#datetimeObject (readonly)

Returns the value of attribute datetime.



64
65
66
# File 'lib/rfsms.rb', line 64

def datetime
  @datetime
end

#priceObject (readonly)

Returns the value of attribute price.



64
65
66
# File 'lib/rfsms.rb', line 64

def price
  @price
end

#price_of_sendingObject (readonly)

Returns the value of attribute price_of_sending.



64
65
66
# File 'lib/rfsms.rb', line 64

def price_of_sending
  @price_of_sending
end

#smsidObject (readonly)

Returns the value of attribute smsid.



64
65
66
# File 'lib/rfsms.rb', line 64

def smsid
  @smsid
end