Module: IfreeSms
- Defined in:
- lib/ifree_sms.rb,
lib/ifree_sms/config.rb,
lib/ifree_sms/engine.rb,
lib/ifree_sms/smsing.rb,
lib/ifree_sms/manager.rb,
lib/ifree_sms/version.rb,
lib/ifree_sms/response.rb,
lib/ifree_sms/callbacks.rb,
lib/ifree_sms/smsdirect_api.rb,
app/models/ifree_sms/message.rb,
lib/generators/ifree_sms/install_generator.rb
Defined Under Namespace
Modules: Callbacks, Generators, SMSDirectAPIMethods, Smsing
Classes: API, APIError, Config, Engine, Manager, Message, Response, SMSDirectAPI
Constant Summary
collapse
- VERSION =
"0.1.1".freeze
- @@config =
Config.new
Class Method Summary
collapse
Class Method Details
.calc_digest(number, text, now) ⇒ Object
93
94
95
96
97
|
# File 'lib/ifree_sms.rb', line 93
def self.calc_digest(number, text, now)
log("service_number: #{number}, sms_text: #{text}, now: #{now}, secret: #{config.secret_key}")
Digest::MD5.hexdigest([number, text, config.secret_key, now].map(&:to_s).join)
end
|
.log(message) ⇒ Object
69
70
71
72
73
|
# File 'lib/ifree_sms.rb', line 69
def self.log(message)
if IfreeSms.config.debug
Rails.logger.info("[Ifree #{Time.now.strftime('%d.%m.%Y %H:%M')}] #{message}")
end
end
|
.make_request(path, params, verb, options = {}) ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/ifree_sms.rb', line 79
def self.make_request(path, params, verb, options = {})
query = Rack::Utils.build_query(params)
url = [path, query].join('?')
log("request: #{url}")
http = Curl::Easy.new(url)
http.perform
log("response: #{http.body_str}")
Response.new(http.response_code, http.body_str, http.)
end
|
.setup {|config| ... } ⇒ Object
65
66
67
|
# File 'lib/ifree_sms.rb', line 65
def self.setup(&block)
yield config
end
|
.table_name_prefix ⇒ Object
75
76
77
|
# File 'lib/ifree_sms.rb', line 75
def self.table_name_prefix
'ifree_sms_'
end
|