Module: DIDWW::Client
- Defined in:
- lib/didww/client.rb
Constant Summary collapse
- BASE_URLS =
{ sandbox: 'https://sandbox-api.didww.com/v3/'.freeze, production: 'https://api.didww.com/v3/'.freeze }.freeze
- DEFAULT_MODE =
:sandbox
Class Method Summary collapse
- .address_verifications ⇒ Object
- .addresses ⇒ Object
- .api_base_url ⇒ Object
- .api_key ⇒ Object
- .api_mode ⇒ Object
- .api_mode=(arg) ⇒ Object
- .api_version ⇒ Object
- .available_dids ⇒ Object
- .balance ⇒ Object
- .capacity_pools ⇒ Object
- .cities ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .countries ⇒ Object
- .did_group_types ⇒ Object
- .did_groups ⇒ Object
- .did_reservations ⇒ Object
- .dids ⇒ Object
- .encrypted_file ⇒ Object
- .exports ⇒ Object
- .identities ⇒ Object
- .nanpa_prefixes ⇒ Object
- .orders ⇒ Object
- .permanent_supporting_documents ⇒ Object
- .pops ⇒ Object
- .proofs ⇒ Object
- .regions ⇒ Object
- .requirement_validation ⇒ Object
- .requirements ⇒ Object
- .shared_capacity_groups ⇒ Object
- .voice_in_trunk_groups ⇒ Object
- .voice_in_trunks ⇒ Object
- .voice_out_trunks ⇒ Object
- .with_api_version(api_version) ⇒ Object
Class Method Details
.address_verifications ⇒ Object
142 143 144 |
# File 'lib/didww/client.rb', line 142 def address_verifications Resource::AddressVerification end |
.addresses ⇒ Object
130 131 132 |
# File 'lib/didww/client.rb', line 130 def addresses Resource::Address end |
.api_base_url ⇒ Object
46 47 48 |
# File 'lib/didww/client.rb', line 46 def api_base_url ENV['DIDWW_API_URL'].presence || BASE_URLS[api_mode] end |
.api_key ⇒ Object
30 31 32 |
# File 'lib/didww/client.rb', line 30 def api_key @@api_key end |
.api_mode ⇒ Object
26 27 28 |
# File 'lib/didww/client.rb', line 26 def api_mode @@api_mode || DEFAULT_MODE end |
.api_mode=(arg) ⇒ Object
150 151 152 153 154 155 |
# File 'lib/didww/client.rb', line 150 def api_mode=(arg) unless BASE_URLS.keys.include?(arg) raise ArgumentError.new("Mode should be in #{BASE_URLS.keys} (given '#{arg}').") end @@api_mode = arg end |
.api_version ⇒ Object
34 35 36 |
# File 'lib/didww/client.rb', line 34 def api_version @@api_version end |
.available_dids ⇒ Object
110 111 112 |
# File 'lib/didww/client.rb', line 110 def available_dids Resource::AvailableDid end |
.balance ⇒ Object
50 51 52 |
# File 'lib/didww/client.rb', line 50 def balance Resource::Balance.all.first end |
.capacity_pools ⇒ Object
54 55 56 |
# File 'lib/didww/client.rb', line 54 def capacity_pools Resource::CapacityPool end |
.configure {|_self| ... } ⇒ Object
19 20 21 22 23 24 |
# File 'lib/didww/client.rb', line 19 def configure yield self if block_given? connect! require_didww_resources self end |
.countries ⇒ Object
70 71 72 |
# File 'lib/didww/client.rb', line 70 def countries Resource::Country end |
.did_group_types ⇒ Object
74 75 76 |
# File 'lib/didww/client.rb', line 74 def did_group_types Resource::DidGroupType end |
.did_groups ⇒ Object
78 79 80 |
# File 'lib/didww/client.rb', line 78 def did_groups Resource::DidGroup end |
.did_reservations ⇒ Object
114 115 116 |
# File 'lib/didww/client.rb', line 114 def did_reservations Resource::DidReservation end |
.encrypted_file ⇒ Object
138 139 140 |
# File 'lib/didww/client.rb', line 138 def encrypted_file Resource::EncryptedFile end |
.identities ⇒ Object
122 123 124 |
# File 'lib/didww/client.rb', line 122 def identities Resource::Identity end |
.nanpa_prefixes ⇒ Object
157 158 159 |
# File 'lib/didww/client.rb', line 157 def nanpa_prefixes Resource::NanpaPrefix end |
.permanent_supporting_documents ⇒ Object
134 135 136 |
# File 'lib/didww/client.rb', line 134 def permanent_supporting_documents Resource::PermanentSupportingDocument end |
.requirement_validation ⇒ Object
146 147 148 |
# File 'lib/didww/client.rb', line 146 def requirement_validation Resource::RequirementValidation end |
.requirements ⇒ Object
118 119 120 |
# File 'lib/didww/client.rb', line 118 def requirements Resource::Requirement end |
.shared_capacity_groups ⇒ Object
62 63 64 |
# File 'lib/didww/client.rb', line 62 def shared_capacity_groups Resource::SharedCapacityGroup end |
.voice_in_trunk_groups ⇒ Object
98 99 100 |
# File 'lib/didww/client.rb', line 98 def voice_in_trunk_groups Resource::VoiceInTrunkGroup end |
.voice_in_trunks ⇒ Object
102 103 104 |
# File 'lib/didww/client.rb', line 102 def voice_in_trunks Resource::VoiceInTrunk end |
.voice_out_trunks ⇒ Object
106 107 108 |
# File 'lib/didww/client.rb', line 106 def voice_out_trunks Resource::VoiceOutTrunk end |
.with_api_version(api_version) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/didww/client.rb', line 38 def with_api_version(api_version) old_api_version = self.api_version self.api_version = api_version yield ensure self.api_version = old_api_version end |