routengn 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -9,8 +9,8 @@ RouteNGN, see http://www.routengn.com.
9
9
 
10
10
  Install the "routengn" gem by typing
11
11
 
12
- $ sudo gem sources -a http://gems.github.com
13
- $ sudo gem install klarrimore-routengn
12
+ $ sudo gem sources -a http://gemcutter.org
13
+ $ sudo gem install routengn
14
14
 
15
15
  The first line tells RubyGems to add the GitHub gem repository. You only need
16
16
  to run this command once.
data/bin/ngncmd CHANGED
@@ -6,7 +6,9 @@ require File.dirname(__FILE__) + '/../lib/routengn'
6
6
 
7
7
  class NGNCommand < Thor
8
8
  map "--configure" => :configure,
9
- "--upload-regions" => :region_upload
9
+ "--upload-regions" => :region_upload,
10
+ "--upload-rates" => :rate_upload,
11
+ "--carrier" => :carrier_show
10
12
 
11
13
  desc "configure", "Set up your RouteNGN API config (.ngnconf)"
12
14
  def configure
@@ -44,6 +46,26 @@ class NGNCommand < Thor
44
46
  say "Success"
45
47
  end
46
48
 
49
+ desc "upload rates", "Upload a rates file"
50
+ def rate_upload
51
+ file = ask "Path to file:", :magenta
52
+ unless File.readable? file
53
+ say "Error: file is not readable"
54
+ exit 1
55
+ end
56
+ connect
57
+ say "Uploading file... "
58
+ Rate.upload(file)
59
+ say "Success"
60
+ end
61
+
62
+ desc "show carrier", "Show a carrier based on ID"
63
+ method_options :id => :numeric
64
+ def carrier_show
65
+ connect
66
+ say Carrier.first(:id => options.id).to_yaml
67
+ end
68
+
47
69
 
48
70
  no_tasks do
49
71
  def connect
@@ -1,8 +1,11 @@
1
- class Route
1
+ class Routecase
2
2
  include RouteNGN::Mapper
3
3
 
4
4
  field :id, :primary => true
5
+ field :epg_block
6
+ field :epg_order
5
7
 
6
8
  belongs_to :instance
9
+ belongs_to :locale
7
10
  belongs_to :type
8
11
  end
data/routengn.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{routengn}
8
- s.version = "0.2.9"
8
+ s.version = "0.2.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Keith Larrimore", "Quin Hoxie"]
12
- s.date = %q{2009-09-30}
12
+ s.date = %q{2009-11-17}
13
13
  s.default_executable = %q{ngncmd}
14
14
  s.description = %q{RouteNGN is an Advanced SIP Redirect Routing Platform.}
15
15
  s.email = %q{keithlarrimore+github@gmail.com}
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
  "README.rdoc",
22
22
  "bin/ngncmd",
23
23
  "docs/RouteNGN-Gems-Install.doc",
24
- "examples/cli.rb",
25
24
  "examples/provision.rb",
26
25
  "lib/routengn.rb",
27
26
  "lib/routengn/console.rb",
@@ -36,7 +35,7 @@ Gem::Specification.new do |s|
36
35
  "lib/routengn/models/rate.rb",
37
36
  "lib/routengn/models/record.rb",
38
37
  "lib/routengn/models/region.rb",
39
- "lib/routengn/models/route.rb",
38
+ "lib/routengn/models/routecase.rb",
40
39
  "lib/routengn/models/type.rb",
41
40
  "lib/routengn/uploader.rb",
42
41
  "routengn.gemspec",
@@ -45,16 +44,15 @@ Gem::Specification.new do |s|
45
44
  s.homepage = %q{http://github.com/klarrimore/routengn}
46
45
  s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
47
46
  s.require_paths = ["lib"]
48
- s.rubygems_version = %q{1.3.1}
47
+ s.rubygems_version = %q{1.3.5}
49
48
  s.summary = %q{RouteNGN is an Advanced SIP Redirect Routing Platform.}
50
49
  s.test_files = [
51
- "examples/provision.rb",
52
- "examples/cli.rb"
50
+ "examples/provision.rb"
53
51
  ]
54
52
 
55
53
  if s.respond_to? :specification_version then
56
54
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
- s.specification_version = 2
55
+ s.specification_version = 3
58
56
 
59
57
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
58
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routengn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Larrimore
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-30 00:00:00 -04:00
13
+ date: 2009-11-17 00:00:00 -05:00
14
14
  default_executable: ngncmd
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,6 @@ files:
65
65
  - README.rdoc
66
66
  - bin/ngncmd
67
67
  - docs/RouteNGN-Gems-Install.doc
68
- - examples/cli.rb
69
68
  - examples/provision.rb
70
69
  - lib/routengn.rb
71
70
  - lib/routengn/console.rb
@@ -80,7 +79,7 @@ files:
80
79
  - lib/routengn/models/rate.rb
81
80
  - lib/routengn/models/record.rb
82
81
  - lib/routengn/models/region.rb
83
- - lib/routengn/models/route.rb
82
+ - lib/routengn/models/routecase.rb
84
83
  - lib/routengn/models/type.rb
85
84
  - lib/routengn/uploader.rb
86
85
  - routengn.gemspec
@@ -112,8 +111,7 @@ requirements: []
112
111
  rubyforge_project:
113
112
  rubygems_version: 1.3.5
114
113
  signing_key:
115
- specification_version: 2
114
+ specification_version: 3
116
115
  summary: RouteNGN is an Advanced SIP Redirect Routing Platform.
117
116
  test_files:
118
117
  - examples/provision.rb
119
- - examples/cli.rb
data/examples/cli.rb DELETED
@@ -1,201 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
4
-
5
- require 'rubygems'
6
- require 'json'
7
- gem 'oauth'
8
- require 'oauth/consumer'
9
- require 'http/multipart'
10
-
11
- @consumer=OAuth::Consumer.new "qcuL3sYAw9ZXdmSdqprBw", #API key
12
- "LDI2rgxnIhJlNu5FBXh0UvtxJRtpr1OgnCIQ8Mpk", #API secret
13
- { :signature_method => 'HMAC-SHA1',
14
- :site=>"http://127.0.0.1:3000" #EX: http://routengn.net
15
- }
16
-
17
- @request_token = @consumer.get_request_token
18
-
19
- @consumer.request(:get, @request_token.authorize_url)
20
-
21
- @access_token = @request_token.get_access_token
22
- @access_token.consumer.http.read_timeout = 5000
23
-
24
- def main_menu
25
- puts "\nMain Menu:\n1. manage carriers\n2. manage regions\n3. upload regions or rates\n4. manage route tables\n"
26
- str = gets.chomp
27
- case str
28
- when '1'
29
- carrier_menu
30
- when '2'
31
- region_menu
32
- when '3'
33
- upload_menu
34
- when '4'
35
- route_table_menu
36
- else
37
- puts 'wtf'
38
- end
39
- end
40
-
41
- def carrier_menu
42
- puts "\nCarrier Menu:\n1. list carriers\n2. list groups\n3. list end points\n4. add carriers\n5. add groups\n6. add end points\n7. delete carriers\n8. delete groups\n9. delete end points\n"
43
- str = gets.chomp
44
- case str
45
- when '1' #list carriers
46
- puts "\n" + JSON.parse(@access_token.get('/carrier/carrier').body).inspect
47
- when '2' #list groups
48
- print "carrier id: "
49
- carrier_id = gets.chomp
50
- puts "\n" + JSON.parse(@access_token.get("/carrier/group/#{carrier_id}").body).inspect
51
- when '3' #list end points
52
- print "group id: "
53
- group_id = gets.chomp
54
- puts "\n" + JSON.parse(@access_token.get("/carrier/endpoint/#{group_id}").body).inspect
55
- when '4' #add carriers
56
- print "carrier name: "
57
- carrier_name = gets.chomp
58
- puts "\n" + JSON.parse(@access_token.post("/carrier/carrier/#{carrier_name}").body).inspect
59
- when '5' #add groups
60
- print "carrier id: "
61
- carrier_id = gets.chomp
62
- print "group name: "
63
- group_name = gets.chomp
64
- puts "\n" + JSON.parse(@access_token.post("/carrier/group/#{group_name}/#{carrier_id}").body).inspect
65
- when '6' #add end points
66
- print "group id: "
67
- group_id = gets.chomp
68
- print "end point name: "
69
- endpoint_name = gets.chomp
70
- puts "\n" + JSON.parse(@access_token.post("/carrier/endpoint/#{endpoint_name}/#{group_id}").body).inspect
71
- when '7' #delete carriers
72
- print "carrier id: "
73
- carrier_id = gets.chomp
74
- puts "\n" + JSON.parse(@access_token.delete("/carrier/carrier/#{carrier_id}").body).inspect
75
- when '8' #delete groups
76
- print "group id: "
77
- group_id = gets.chomp
78
- puts "\n" + JSON.parse(@access_token.delete("/carrier/group/#{group_id}").body).inspect
79
- when '9' #delete end points
80
- print "end point id: "
81
- endpoint_id = gets.chomp
82
- puts "\n" + JSON.parse(@access_token.delete("/carrier/endpoint/#{endpoint_id}").body).inspect
83
- when 'back'
84
- return
85
- end
86
- end
87
-
88
- def region_menu
89
- puts "\nRegion Menu:\n1. list regions\n2. list locales\n3. list dial codes\n4. add regions\n5. add locales\n6. add dial codes\n7. delete regions\n8. delete locales\n9. delete dial codes\n"
90
- str = gets.chomp
91
- case str
92
- when '1' #list regions
93
- puts "\n" + JSON.parse(@access_token.get('/region/region').body).inspect
94
- when '2' #list locales
95
- print "region id: "
96
- region_id = gets.chomp
97
- puts "\n" + JSON.parse(@access_token.get("/region/locale/#{region_id}").body).inspect
98
- when '3' #list dial codes
99
- print "locale id: "
100
- locale_id = gets.chomp
101
- puts "\n" + JSON.parse(@access_token.get("/region/dialcode/#{locale_id}").body).inspect
102
- when '4' #add regions
103
- print "region name: "
104
- region_name = gets.chomp
105
- puts "\n" + JSON.parse(@access_token.post("/region/region/#{region_name}").body).inspect
106
- when '5' #add locales
107
- print "region id: "
108
- region_id = gets.chomp
109
- print "locale name: "
110
- locale_name = gets.chomp
111
- puts "\n" + JSON.parse(@access_token.post("/region/locale/#{locale_name}/#{region_id}").body).inspect
112
- when '6' #add dial codes
113
- print "locale id: "
114
- locale_id = gets.chomp
115
- print "dialcode: "
116
- dialcode = gets.chomp
117
- puts "\n" + JSON.parse(@access_token.post("/region/dialcode/#{dialcode}/#{locale_id}").body).inspect
118
- when '7' #delete regions
119
- print "region id: "
120
- region_id = gets.chomp
121
- puts "\n" + JSON.parse(@access_token.delete("/region/region/#{region_id}").body).inspect
122
- when '8' #delete locales
123
- print "locale id: "
124
- locale_id = gets.chomp
125
- puts "\n" + JSON.parse(@access_token.delete("/region/locale/#{locale_id}").body).inspect
126
- when '9' #delete dial codes
127
- print "dialcode id: "
128
- dialcode_id = gets.chomp
129
- puts "\n" + JSON.parse(@access_token.delete("/region/dialcode/#{dialcode_id}").body).inspect
130
- when 'back'
131
- return
132
- end
133
- end
134
-
135
- def upload_menu
136
- puts "\nUpload Menu:\n1. upload regions\n2. upload rates\n"
137
- str = gets.chomp
138
- case str
139
- when '1'
140
- print "path: "
141
- path = gets.chomp
142
- data, headers = Multipart::Post.prepare_query("title" => 'title', "uploaded_data" => File.new(path))
143
- puts @access_token.put('/upload/regions', data, headers)
144
- when '2'
145
- print "path: "
146
- path = gets.chomp
147
- print "rate type: "
148
- rate_type = gets.chomp
149
- print "groups: "
150
- groups = gets.chomp
151
- data, headers = Multipart::Post.prepare_query("title" => 'title', "uploaded_data" => File.new(path))
152
- puts @access_token.put("/upload/rates/#{rate_type}/#{groups}", data, headers)
153
- when 'back'
154
- return
155
- end
156
- end
157
-
158
- def route_table_menu
159
- puts "\nRoute Table Menu:\n1. list instances\n2. list routes\n3. create instance\n4. generate lcr\n5. search\n"
160
- str = gets.chomp
161
- case str
162
- when '1'
163
- puts @access_token.get('/route/instances').body
164
- when '2'
165
-
166
- puts @access_token.get('/route/routes/13').body
167
- when '3'
168
- print "table name: "
169
- table_name = gets.chomp
170
- print "table type: "
171
- table_type = gets.chomp
172
- puts @access_token.post("/route/table/#{table_name}/#{table_type}").body
173
- when '4'
174
- print "table type: "
175
- table_type = gets.chomp
176
- print "instance id: "
177
- instance_id = gets.chomp
178
- print "groups: "
179
- groups = gets.chomp
180
- puts @access_token.put("/route/update/lcr/#{table_type}/#{instance_id}/#{groups}").body
181
- when '5'
182
- print "search type: "
183
- search_type = gets.chomp
184
- print "instance id: "
185
- instance_id = gets.chomp
186
- print "table type: "
187
- table_type = gets.chomp
188
- print "route type: "
189
- route_type = gets.chomp
190
- print "search: "
191
- search = gets.chomp
192
- puts @access_token.get("/route/search/#{search_type}/#{instance_id}/#{table_type}/#{route_type}/#{search}").body
193
- when 'back'
194
- return
195
- end
196
- end
197
-
198
- while true
199
- main_menu
200
- end
201
-