Class: GreenSMS::GreenSMSClient
- Inherits:
-
Object
- Object
- GreenSMS::GreenSMSClient
- Defined in:
- lib/greensms/client.rb
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
-
#voice ⇒ Object
readonly
Returns the value of attribute voice.
Instance Method Summary collapse
-
#initialize(user: nil, pass: nil, token: nil, version: nil, camel_case_response: false, use_token_for_requests: false) ⇒ GreenSMSClient
constructor
A new instance of GreenSMSClient.
Constructor Details
#initialize(user: nil, pass: nil, token: nil, version: nil, camel_case_response: false, use_token_for_requests: false) ⇒ GreenSMSClient
Returns a new instance of GreenSMSClient.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/greensms/client.rb', line 18 def initialize(user: nil, pass: nil, token: nil, version: nil, camel_case_response: false, use_token_for_requests: false) @user = ENV.fetch("GREENSMS_USER", user) @pass = ENV.fetch("GREENSMS_PASS", pass) @token = ENV.fetch("GREENSMS_TOKEN", token) @version = version @camel_case_response = camel_case_response @use_token_for_requests = use_token_for_requests if !GreenSMS.is_null_or_empty(@token) @user = "" @password = "" end if GreenSMS.is_null_or_empty(@token) and (GreenSMS.is_null_or_empty(@user) || GreenSMS.is_null_or_empty(@pass)) raise StandardError.new "Either User/Pass or Auth Token is required!" end = { "use_token_for_requests" => @use_token_for_requests, "version" => GreenSMS.get_version(@version), "rest_client" => _get_http_client(use_camel_case: @camel_case_response), "base_url" => GreenSMS.base_url(), } _add_modules() end |
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call.
15 16 17 |
# File 'lib/greensms/client.rb', line 15 def call @call end |
#voice ⇒ Object (readonly)
Returns the value of attribute voice.
16 17 18 |
# File 'lib/greensms/client.rb', line 16 def voice @voice end |