Module: IletiMerkezi
- Defined in:
- lib/ileti_merkezi.rb,
lib/ileti_merkezi/error.rb,
lib/ileti_merkezi/status.rb,
lib/ileti_merkezi/message.rb,
lib/ileti_merkezi/version.rb,
lib/ileti_merkezi/response.rb,
lib/ileti_merkezi/actions/sms.rb,
lib/ileti_merkezi/utils/request.rb,
lib/ileti_merkezi/actions/cancel.rb,
lib/ileti_merkezi/actions/report.rb,
lib/ileti_merkezi/actions/account.rb,
lib/ileti_merkezi/actions/balance.rb,
lib/ileti_merkezi/utils/xml_builder.rb,
lib/ileti_merkezi/utils/configuration.rb,
lib/ileti_merkezi/utils/authentication.rb
Overview
IletiMerkezi
Defined Under Namespace
Modules: Authentication, Balance, XmlBuilder Classes: Account, Cancel, Configuration, CredentialMissingError, InvalidMessageError, Message, Report, Request, Response, Sms, Status
Constant Summary collapse
- VERSION =
'1.1.0'
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
27 28 29 |
# File 'lib/ileti_merkezi.rb', line 27 def configuration @configuration ||= Configuration.new end |
Class Method Details
.balance ⇒ IletiMerkezi::Response
Get balance information
42 43 44 |
# File 'lib/ileti_merkezi.rb', line 42 def balance Balance.query end |
.cancel(order_id) ⇒ IletiMerkezi::Response
Sms order cancellation
53 54 55 |
# File 'lib/ileti_merkezi.rb', line 53 def cancel(order_id) Cancel.new(order_id).confirm end |
.code(code_id) ⇒ IletiMerkezi::Status
Find status with code id
64 65 66 |
# File 'lib/ileti_merkezi.rb', line 64 def code(code_id) Status.find(code_id) end |
.configure {|configuration| ... } ⇒ Object
31 32 33 |
# File 'lib/ileti_merkezi.rb', line 31 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
91 92 93 94 |
# File 'lib/ileti_merkezi.rb', line 91 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
103 104 105 106 107 |
# File 'lib/ileti_merkezi.rb', line 103 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)
144 145 146 |
# File 'lib/ileti_merkezi.rb', line 144 def send(args) Sms.new(args).send end |
.senders ⇒ Hash
Get senders
153 154 155 156 |
# File 'lib/ileti_merkezi.rb', line 153 def senders response = Account.senders response.to_h.fetch(:smsHeaderInfo, {}) end |
.status ⇒ Boolean
Get Service Status
163 164 165 |
# File 'lib/ileti_merkezi.rb', line 163 def status balance.code == 200 end |