Class: ComteleSdk::AccountService
- Inherits:
-
Object
- Object
- ComteleSdk::AccountService
- Defined in:
- lib/comtele_sdk.rb
Instance Method Summary collapse
- #get_account_by_username(username) ⇒ Object
- #get_all_accounts ⇒ Object
-
#initialize(api_key) ⇒ AccountService
constructor
A new instance of AccountService.
Constructor Details
#initialize(api_key) ⇒ AccountService
Returns a new instance of AccountService.
8 9 10 11 12 13 14 15 16 |
# File 'lib/comtele_sdk.rb', line 8 def initialize(api_key) @api_key = api_key @base_address = 'https://sms.comtele.com.br/api/v2' @headers = { 'Accept': 'application/json', 'Content-type': 'application/json', 'auth-key': @api_key } end |
Instance Method Details
#get_account_by_username(username) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/comtele_sdk.rb', line 18 def get_account_by_username(username) url = @base_address + '/accounts/' + username response = RestClient.get(url, @headers) return JSON.parse(response) end |
#get_all_accounts ⇒ Object
25 26 27 28 29 30 |
# File 'lib/comtele_sdk.rb', line 25 def get_all_accounts url = @base_address + '/accounts' response = RestClient.get(url, @headers) return JSON.parse(response) end |