Module: Zadarma::Methods
- Included in:
- Client
- Defined in:
- lib/zadarma/methods.rb
Instance Method Summary collapse
- #balance ⇒ Object
- #callback(from, to, params = {}) ⇒ Object
- #pbx_internal ⇒ Object
- #pbx_record(id, status, params = {}) ⇒ Object
- #pbx_statistics(time_start, time_end) ⇒ Object
- #price(number) ⇒ Object
- #redirection(params = {}) ⇒ Object
- #send_sms(number, message, params = {}) ⇒ Object
- #set_redirect(id, params) ⇒ Object
- #set_sip_caller(id, number) ⇒ Object
- #sip ⇒ Object
- #statistics(time_start, time_end, params = {}) ⇒ Object
Instance Method Details
#balance ⇒ Object
3 4 5 |
# File 'lib/zadarma/methods.rb', line 3 def balance request :get, "/info/balance/" end |
#callback(from, to, params = {}) ⇒ Object
11 12 13 |
# File 'lib/zadarma/methods.rb', line 11 def callback(from, to, params = {}) request :get, "/request/callback/", params.merge(from: from, to: to) end |
#pbx_internal ⇒ Object
32 33 34 |
# File 'lib/zadarma/methods.rb', line 32 def pbx_internal request :get, "/pbx/internal/" end |
#pbx_record(id, status, params = {}) ⇒ Object
36 37 38 |
# File 'lib/zadarma/methods.rb', line 36 def pbx_record(id, status, params = {}) request :put, "/pbx/internal/recording/", params.merge(id: id, status: status) end |
#pbx_statistics(time_start, time_end) ⇒ Object
55 56 57 |
# File 'lib/zadarma/methods.rb', line 55 def pbx_statistics(time_start, time_end) request :get, "/statistics/pbx/", start: time_s(time_start), end: time_s(time_end) end |
#price(number) ⇒ Object
7 8 9 |
# File 'lib/zadarma/methods.rb', line 7 def price(number) request :get, "/info/price/", number: number end |
#redirection(params = {}) ⇒ Object
23 24 25 |
# File 'lib/zadarma/methods.rb', line 23 def redirection(params = {}) request :get, "/sip/redirection/", params end |
#send_sms(number, message, params = {}) ⇒ Object
40 41 42 |
# File 'lib/zadarma/methods.rb', line 40 def send_sms(number, , params = {}) request :post, "/sms/send/", params.merge(number: number, message: ) end |
#set_redirect(id, params) ⇒ Object
27 28 29 |
# File 'lib/zadarma/methods.rb', line 27 def set_redirect(id, params) request :put, "/sip/redirection/", params.merge(id: id) end |
#set_sip_caller(id, number) ⇒ Object
19 20 21 |
# File 'lib/zadarma/methods.rb', line 19 def set_sip_caller(id, number) request :put, "/sip/callerid/", id: id, number: number end |
#sip ⇒ Object
15 16 17 |
# File 'lib/zadarma/methods.rb', line 15 def sip request :get, "/sip/" end |
#statistics(time_start, time_end, params = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/zadarma/methods.rb', line 45 def statistics(time_start, time_end, params = {}) result = request :get, "/statistics/", params.merge(start: time_s(time_start), end: time_s(time_end)) result[:start] = Time.parse(result[:start]) result[:end] = Time.parse(result[:end]) result[:stats].each { |item| item[:callstart] = Time.parse(item[:callstart]) } result end |