With a little testing, it looks like the national_prefix value (in the countries gem) of Hong Kong is "None". You may want to use Country#find_country_by_country_code like so: Country.find_country_by_country_code('852') and that will return Hong Kong, which you can then call #alpha2 on. On a side note, you may want to check...
c#,json,serialization,restsharp,plivo
Unfortunately it looks as though JSON property renaming is not implemented out of the box in RestSharp. You have a couple of options: Download Restsharp from https://github.com/restsharp/RestSharp and rebuild it yourself enabling the compiler option SIMPLE_JSON_DATACONTRACT. Then you will be able to rename properties using data contract attributes. For more,...
ruby-on-rails-4,twilio,plivo,nexmo
Your title lists three main SMS APIs, so for services available you already have a good understanding. But there are also APIs that focus exclusively on 2FA / Verification. Here is a list of some, worth noting that it tends to be focused on the user side of the equation...
ruby-on-rails,api,module,plivo
You should be able to access RestAPI class after including Plivo module. Make sure you have installed plivo gem correctly. Here is more rubyish version of your code: class PlivoNumber < ActiveRecord::Base include Plivo def delete_number api.unrent_number('number' => number) end private def api @api ||= RestAPI.new(ENV['PLIVO_AUTH_ID'], ENV['PLIVO_AUTH_TOKEN']) end end Also...
SMS is stateless, and there's no way to tie two messages to each other (as a thread) other than match meta data (the pairing of a to / from). For what you're trying to do, you'll need multiple virtual numbers, as this is limitation of SMS itself....
Call to restAPI.makeCall shuts down connection manager and restAPI instance becomes unusable. To fix your error create brand new instance of RestAPI before each call.
Just do: this.numbers.number or this["numbers"].number instead of what you are doing...
Transfer works in potentially two different ways: 1) End-point based In this mode: A transfer B to C by requesting (REFER) B to establish a new call to C. If Plivo is B, it needs to support REFER for this to work. A B C <=conversation=> ----REFER------> <-202 Accepted-- ----INVITE----->...
As your class is not namespaced - try and call it like this: $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new \RestAPI($auth_id, $auth_token); Notice the \ before RestAPI...