Class: VoiceCom::Request
- Inherits:
-
Object
- Object
- VoiceCom::Request
- Defined in:
- lib/voice_com/request.rb
Instance Attribute Summary collapse
-
#op ⇒ Object
Returns the value of attribute op.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#smsid ⇒ Object
Returns the value of attribute smsid.
-
#text ⇒ Object
Returns the value of attribute text.
-
#validity ⇒ Object
Returns the value of attribute validity.
Instance Method Summary collapse
- #build_uri ⇒ Object
-
#initialize(args = {}) {|_self| ... } ⇒ Request
constructor
A new instance of Request.
- #send_message ⇒ Object
Constructor Details
#initialize(args = {}) {|_self| ... } ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 15 16 |
# File 'lib/voice_com/request.rb', line 8 def initialize(args = {}) @main_url = VoiceCom.config["service_url"] @sid = VoiceCom.config["sid"] args.each {|k,v| instance_variable_set("@#{k}", v) unless k.blank?} yield self if block_given? validate! end |
Instance Attribute Details
#op ⇒ Object
Returns the value of attribute op.
6 7 8 |
# File 'lib/voice_com/request.rb', line 6 def op @op end |
#phone ⇒ Object
Returns the value of attribute phone.
6 7 8 |
# File 'lib/voice_com/request.rb', line 6 def phone @phone end |
#priority ⇒ Object
Returns the value of attribute priority.
6 7 8 |
# File 'lib/voice_com/request.rb', line 6 def priority @priority end |
#smsid ⇒ Object
Returns the value of attribute smsid.
6 7 8 |
# File 'lib/voice_com/request.rb', line 6 def smsid @smsid end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/voice_com/request.rb', line 6 def text @text end |
#validity ⇒ Object
Returns the value of attribute validity.
6 7 8 |
# File 'lib/voice_com/request.rb', line 6 def validity @validity end |
Instance Method Details
#build_uri ⇒ Object
23 24 25 26 27 28 |
# File 'lib/voice_com/request.rb', line 23 def build_uri url_string = "http://#{@main_url}?serviceID=#{@sid}&id=#{smsid}&msisdn=#{phone}&msg=#{text}" url_str = addition_attr_to_uri url_string @request_uri = URI.encode url_str end |
#send_message ⇒ Object
18 19 20 21 |
# File 'lib/voice_com/request.rb', line 18 def build_uri responce = Net::HTTP.get URI(@request_uri) end |