Module: IletiMerkezi
- Defined in:
- lib/ileti_merkezi.rb,
lib/ileti_merkezi/sms.rb,
lib/ileti_merkezi/error.rb,
lib/ileti_merkezi/cancel.rb,
lib/ileti_merkezi/report.rb,
lib/ileti_merkezi/status.rb,
lib/ileti_merkezi/account.rb,
lib/ileti_merkezi/balance.rb,
lib/ileti_merkezi/message.rb,
lib/ileti_merkezi/request.rb,
lib/ileti_merkezi/version.rb,
lib/ileti_merkezi/response.rb,
lib/ileti_merkezi/configuration.rb,
lib/ileti_merkezi/authentication.rb
Overview
IletiMerkezi
Defined Under Namespace
Modules: Authentication, Balance Classes: Account, Cancel, Configuration, CredentialMissingError, InvalidMessageError, Message, Report, Request, Response, Sms, Status
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Attribute Summary collapse
Class Method Summary collapse
-
.balance ⇒ IletiMerkezi::Response
Get balance information.
-
.cancel(order_id) ⇒ IletiMerkezi::Response
Sms order cancellation.
-
.code(code_id) ⇒ IletiMerkezi::Status
Find status with code id.
- .configure {|configuration| ... } ⇒ Object
-
.info ⇒ Hash
Get account information.
-
.report(order_id, page: 1, row_count: 1000) ⇒ IletiMerkezi::Response
Get Sms order report.
-
.send(args) ⇒ IletiMerkezi::Response
Sms send method.
-
.senders ⇒ Hash
Get senders.
-
.status ⇒ Boolean
Get Service Status.
Class Attribute Details
.configuration ⇒ Object
33 34 35 |
# File 'lib/ileti_merkezi.rb', line 33 def configuration @configuration ||= Configuration.new end |
Class Method Details
.balance ⇒ IletiMerkezi::Response
Get balance information
48 49 50 |
# File 'lib/ileti_merkezi.rb', line 48 def balance Balance.query end |
.cancel(order_id) ⇒ IletiMerkezi::Response
Sms order cancellation
59 60 61 |
# File 'lib/ileti_merkezi.rb', line 59 def cancel(order_id) Cancel.new(order_id).confirm end |
.code(code_id) ⇒ IletiMerkezi::Status
Find status with code id
70 71 72 |
# File 'lib/ileti_merkezi.rb', line 70 def code(code_id) Status.find(code_id) end |
.configure {|configuration| ... } ⇒ Object
37 38 39 |
# File 'lib/ileti_merkezi.rb', line 37 def configure yield(configuration) end |
.info ⇒ Hash
Get account information
name_surname: 'name-surname',
tc_number: nil,
title: nil,
email: 'email',
gsm: 'phone',
password: 'password',
commercial_title: nil,
gsm2: nil,
phone_number: nil,
fax_number: nil,
bill_address: nil,
zone: nil,
city: nil,
zip: nil,
charge_home: nil,
charge_number: nil
97 98 99 100 |
# File 'lib/ileti_merkezi.rb', line 97 def info response = Account.info response.to_h.fetch(:userInfo, {}) end |
.report(order_id, page: 1, row_count: 1000) ⇒ IletiMerkezi::Response
Get Sms order report
109 110 111 112 113 |
# File 'lib/ileti_merkezi.rb', line 109 def report(order_id, page: 1, row_count: 1000) Report.new(order_id, page: page, row_count: row_count).query end |
.send(args) ⇒ IletiMerkezi::Response
Sms send method
Example:
args1 =
send_datetime: '15/01/2017 12:00' # Opsiyonel
sender: 'TEST' # Opsiyonel
phones: ['0555 555 00 01', '0555 555 00 02']
text: 'Test Message'
args2 = {
send_datetime: '15/01/2017 12:00' # Opsiyonel
sender: 'TEST' # Opsiyonel
messages: [
{
text: 'First Test Message',
phones: ['0555 555 00 01', '0555 555 00 02'],
},
{
text: 'Second Test Message',
phones: ['0555 555 00 03', '0555 555 00 04'],
}
]
}
response = IletiMerkezi.send(args1) or response = IletiMerkezi.send(args2)
150 151 152 |
# File 'lib/ileti_merkezi.rb', line 150 def send(args) Sms.new(args).send end |
.senders ⇒ Hash
Get senders
159 160 161 162 |
# File 'lib/ileti_merkezi.rb', line 159 def senders response = Account.senders response.to_h.fetch(:smsHeaderInfo, {}) end |
.status ⇒ Boolean
Get Service Status
169 170 171 |
# File 'lib/ileti_merkezi.rb', line 169 def status balance.code == 200 end |