Class: Moceansdk::Client
- Inherits:
-
Object
- Object
- Moceansdk::Client
- Defined in:
- lib/moceansdk/client.rb
Instance Method Summary collapse
- #balance ⇒ Object
- #command ⇒ Object
- #flash_sms ⇒ Object
-
#initialize(obj_auth, options = nil) ⇒ Client
constructor
A new instance of Client.
- #message_status ⇒ Object
- #number_lookup ⇒ Object
- #pricing ⇒ Object
- #sms ⇒ Object
- #verify_request ⇒ Object
- #verify_validate ⇒ Object
- #voice ⇒ Object
Constructor Details
#initialize(obj_auth, options = nil) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/moceansdk/client.rb', line 4 def initialize(obj_auth, = nil) unless obj_auth.is_a? Auth::AbstractAuth raise Exceptions::MoceanError, 'auth object must extend AbstractAuth' end if obj_auth.auth_method.casecmp('basic').zero? if Utils.nil_or_empty?(obj_auth.params['mocean-api-key']) || Utils.nil_or_empty?(obj_auth.params['mocean-api-secret']) raise Exceptions::RequiredFieldException, "api key and api secret for client object can't be empty" end else raise Exceptions::MoceanError, 'unsupported auth method' end @transmitter = if .is_a? Modules::Transmitter else Modules::Transmitter.new() end @obj_auth = obj_auth end |
Instance Method Details
#balance ⇒ Object
41 42 43 |
# File 'lib/moceansdk/client.rb', line 41 def balance Modules::Account::Balance.new(@obj_auth, @transmitter) end |
#command ⇒ Object
65 66 67 |
# File 'lib/moceansdk/client.rb', line 65 def command Modules::Command::Command.new(@obj_auth, @transmitter) end |
#flash_sms ⇒ Object
30 31 32 33 34 35 |
# File 'lib/moceansdk/client.rb', line 30 def flash_sms sms = Modules::Message::Sms.new(@obj_auth, @transmitter) sms.mclass = 1 sms.alt_dcs = 1 sms end |
#message_status ⇒ Object
45 46 47 |
# File 'lib/moceansdk/client.rb', line 45 def Modules::Message::MessageStatus.new(@obj_auth, @transmitter) end |
#number_lookup ⇒ Object
57 58 59 |
# File 'lib/moceansdk/client.rb', line 57 def number_lookup Modules::NumberLookup::NumberLookup.new(@obj_auth, @transmitter) end |
#pricing ⇒ Object
37 38 39 |
# File 'lib/moceansdk/client.rb', line 37 def pricing Modules::Account::Pricing.new(@obj_auth, @transmitter) end |
#sms ⇒ Object
26 27 28 |
# File 'lib/moceansdk/client.rb', line 26 def sms Modules::Message::Sms.new(@obj_auth, @transmitter) end |
#verify_request ⇒ Object
49 50 51 |
# File 'lib/moceansdk/client.rb', line 49 def verify_request Modules::Message::VerifyRequest.new(@obj_auth, @transmitter) end |
#verify_validate ⇒ Object
53 54 55 |
# File 'lib/moceansdk/client.rb', line 53 def verify_validate Modules::Message::VerifyValidate.new(@obj_auth, @transmitter) end |