Class: Sisal::Providers::TimweProvider
- Inherits:
-
Provider
- Object
- Provider
- Sisal::Providers::TimweProvider
- Defined in:
- lib/sisal/providers/timwe_provider.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ TimweProvider
constructor
A new instance of TimweProvider.
- #send(message, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TimweProvider
Returns a new instance of TimweProvider.
11 12 13 14 15 16 |
# File 'lib/sisal/providers/timwe_provider.rb', line 11 def initialize( = {}) @partner_role_id = [:partner_role_id] @password = [:password] @product_id = [:product_id] @price_point_id = [:price_point_id] end |
Instance Method Details
#send(message, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sisal/providers/timwe_provider.rb', line 18 def send(, = {}) params = { PartnerRoleId: @partner_role_id, Password: @password, ProductId: @product_id, PricePointId: @price_point_id, Destination: .to, Text: .text, ExtTxId: [:exttxid] || Time.now.to_i, OpId: [:opid] || "1" } begin response = RestClient.get(API_URL, params: params) code = response.to_s.dup.to_i Sisal::Response.new((code > 0), code, status_code(code)) rescue ::SocketError, ::Errno::ETIMEDOUT, ::RestClient::Exception => e Sisal::Response.new(false, nil, e.) end end |