didww-v3 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b50d18315fb77b5b7b7972645a2f75eaf305fc6e
4
- data.tar.gz: ccb2fecdb8bb0ec6b21e9d041639a453a01dfb33
2
+ SHA256:
3
+ metadata.gz: 43a4e5a0894af4c05f6f8978c5fdd42408120d8ea1bdc18e7cb1c34db6da0fee
4
+ data.tar.gz: 8b9b921c0f5681a01b2ec5f3e1e418098f472fbc043d46d35a72ce6f2d37902b
5
5
  SHA512:
6
- metadata.gz: f36cf7c880103909cf816a5a6f7e34df60acbf32dbf9d8b08e5082c96b5c2b2022b8d457e1306facc18837545bc6f4f66e41331f8e72ef2a2a1b49e0d54d329f
7
- data.tar.gz: ced5fc521ea77758b6767914886d94fccfbaf14c9264c4fe60534e69ea5d71b6d4a8bdd6cdaba86805b89981d7a90d78ee4559209a6280d002671275d5cd3320
6
+ metadata.gz: c6b6e91a29e36efc401ce726270c523b5b09e5c88686db3f268033ae411ede30fc22e151617cb40638824092e4c81c763967efd4482e8d0de32a506ec19b2170
7
+ data.tar.gz: 1561b27a4ee5bdc930a2b1580d32da56d73abe622ae549e64a18f64246d06d8e14237151c1a82284b09070363050c50cabe2627ff97a726effd20f01848fea8c
@@ -37,6 +37,10 @@ module DIDWW
37
37
  Resource::Balance.all.first
38
38
  end
39
39
 
40
+ def cdr_exports
41
+ Resource::CdrExport
42
+ end
43
+
40
44
  def cities
41
45
  Resource::City
42
46
  end
@@ -61,6 +65,10 @@ module DIDWW
61
65
  Resource::Order
62
66
  end
63
67
 
68
+ def pops
69
+ Resource::Pop
70
+ end
71
+
64
72
  def regions
65
73
  Resource::Region
66
74
  end
@@ -73,10 +81,6 @@ module DIDWW
73
81
  Resource::Trunk
74
82
  end
75
83
 
76
- def cdr_exports
77
- Resource::CdrExport
78
- end
79
-
80
84
  def api_mode=(arg)
81
85
  unless BASE_URLS.keys.include?(arg)
82
86
  raise ArgumentError.new("Mode should be in #{BASE_URLS.keys} (given '#{arg}').")
@@ -102,17 +106,18 @@ module DIDWW
102
106
 
103
107
  def require_didww_resources
104
108
  require 'didww/resources/balance'
109
+ require 'didww/resources/cdr_export'
105
110
  require 'didww/resources/city'
106
111
  require 'didww/resources/country'
107
112
  require 'didww/resources/did_group_type'
108
113
  require 'didww/resources/did_group'
109
114
  require 'didww/resources/did'
110
115
  require 'didww/resources/order'
116
+ require 'didww/resources/pop'
111
117
  require 'didww/resources/region'
118
+ require 'didww/resources/stock_keeping_unit'
112
119
  require 'didww/resources/trunk_group'
113
120
  require 'didww/resources/trunk'
114
- require 'didww/resources/stock_keeping_unit'
115
- require 'didww/resources/cdr_export'
116
121
  end
117
122
 
118
123
  end
@@ -12,10 +12,8 @@ module DIDWW
12
12
 
13
13
  def property(name, options = {})
14
14
  property = schema.add(name, options)
15
- define_method(name) { attributes[name] }
16
- define_method("#{name}=".to_sym) do |val|
17
- attributes[name] = property.cast(val)
18
- end
15
+ define_method(name.to_sym) { self[name] }
16
+ define_method("#{name}=".to_sym) { |val| self[name] = val }
19
17
  end
20
18
 
21
19
  def schema
@@ -70,7 +68,8 @@ module DIDWW
70
68
  end
71
69
 
72
70
  def []=(key, value)
73
- public_send("#{key}=", value)
71
+ property = self.class.schema.find(key)
72
+ attributes[key] = property ? property.cast(value) : value
74
73
  end
75
74
 
76
75
  # When we represent this resource for serialization (create/update), we do so
@@ -149,6 +149,14 @@ module DIDWW
149
149
  # Nullable: No
150
150
  # Description: The transport layer that will be responsible for the actual transmission of SIP requests and responses (1 - UDP, 2 - TCP)
151
151
 
152
+ property :max_transfers, type: :integer
153
+ # Nullable: No
154
+ # Description: Max count of the REFER requests
155
+
156
+ property :max_30x_redirects, type: :integer
157
+ # Nullable: No
158
+ # Description: Max count of 301/302 redirects
159
+
152
160
  DEFAULTS = {
153
161
  username: DID_PLACEHOLDER,
154
162
  port: '5060',
@@ -161,6 +169,8 @@ module DIDWW
161
169
  dns_srv_failover_timer: 2000,
162
170
  rtp_timeout: 30,
163
171
  auth_enabled: false,
172
+ max_transfers: 0,
173
+ max_30x_redirects: 0,
164
174
  codec_ids: DEFAULT_CODEC_IDS,
165
175
  rerouting_disconnect_code_ids: DEFAULT_REROUTING_DISCONNECT_CODE_IDS,
166
176
  transport_protocol_id: 1
@@ -5,6 +5,7 @@ module DIDWW
5
5
  headers = {}
6
6
  headers['Content-Type'] = 'application/vnd.api+json'
7
7
  headers['Api-Key'] = DIDWW::Client.api_key
8
+ headers['User-Agent'] = "didww-v3 Ruby gem v#{VERSION}"
8
9
 
9
10
  request_env[:request_headers].merge!(headers)
10
11
  request_env.url.host = URI(DIDWW::Client.api_base_url).host
@@ -0,0 +1,9 @@
1
+ module DIDWW
2
+ module Resource
3
+ class Pop < Base
4
+ property :name, type: :string
5
+ # Type: String
6
+ # Description: POP name
7
+ end
8
+ end
9
+ end
@@ -6,6 +6,7 @@ module DIDWW
6
6
  class Trunk < Base
7
7
  include CONST
8
8
 
9
+ has_one :pop
9
10
  has_one :trunk_group
10
11
 
11
12
  property :priority, type: :integer
@@ -44,10 +45,6 @@ module DIDWW
44
45
  # Type: String
45
46
  # Description: Optional description of trunk
46
47
 
47
- property :preferred_server, type: :string
48
- # Type: String
49
- # Description: Preferred server for your voice route. In general, you should choose the server that is the closest to your location ["LOCAL", "USA", "DE"] or omit.
50
-
51
48
  property :configuration, type: :complex_object
52
49
  # Type: one of
53
50
  # sip_configurations
@@ -2,17 +2,6 @@ module DIDWW
2
2
  module Resource
3
3
  class Trunk < Base
4
4
  module CONST
5
- # Allowed values for trunk.preferred_server
6
- PREFERRED_SERVER_LOCAL = 'LOCAL' .freeze
7
- PREFERRED_SERVER_USA = 'USA' .freeze
8
- PREFERRED_SERVER_EUROPE = 'Europe' .freeze
9
-
10
- PREFERRED_SERVERS = {
11
- PREFERRED_SERVER_LOCAL => 'Local' .freeze,
12
- PREFERRED_SERVER_USA => 'United States' .freeze,
13
- PREFERRED_SERVER_EUROPE => 'Europe' .freeze
14
- }.freeze
15
-
16
5
  # Allowed values for trunk.cli_format
17
6
  CLI_FORMAT_RAW = 'raw' .freeze
18
7
  CLI_FORMAT_E164 = 'e164' .freeze
@@ -44,10 +33,6 @@ module DIDWW
44
33
  CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
45
34
  }.freeze
46
35
 
47
- def preferred_server_human
48
- PREFERRED_SERVERS[preferred_server]
49
- end
50
-
51
36
  def cli_format_human
52
37
  CLI_FORMATS[cli_format]
53
38
  end
@@ -1,3 +1,3 @@
1
1
  module DIDWW
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didww-v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Korobeinikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -274,6 +274,7 @@ files:
274
274
  - lib/didww/resources/did_group.rb
275
275
  - lib/didww/resources/did_group_type.rb
276
276
  - lib/didww/resources/order.rb
277
+ - lib/didww/resources/pop.rb
277
278
  - lib/didww/resources/region.rb
278
279
  - lib/didww/resources/stock_keeping_unit.rb
279
280
  - lib/didww/resources/trunk.rb
@@ -300,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
301
  version: '0'
301
302
  requirements: []
302
303
  rubyforge_project:
303
- rubygems_version: 2.6.14
304
+ rubygems_version: 2.7.6
304
305
  signing_key:
305
306
  specification_version: 4
306
307
  summary: Ruby client for DIDWW API v3