super_receptionist 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +255 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/super_receptionist.rb +23 -0
- data/lib/super_receptionist/agent.rb +21 -0
- data/lib/super_receptionist/base.rb +78 -0
- data/lib/super_receptionist/call.rb +21 -0
- data/lib/super_receptionist/campaign.rb +29 -0
- data/lib/super_receptionist/circle.rb +17 -0
- data/lib/super_receptionist/client.rb +36 -0
- data/lib/super_receptionist/notification.rb +25 -0
- data/lib/super_receptionist/number.rb +25 -0
- data/lib/super_receptionist/phonebook.rb +21 -0
- data/lib/super_receptionist/plan.rb +17 -0
- data/lib/super_receptionist/sound.rb +21 -0
- data/lib/super_receptionist/task.rb +21 -0
- data/lib/super_receptionist/version.rb +3 -0
- data/super_receptionist.gemspec +26 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 481b28c84b421c2d1c23320d06b1be402272e012
|
4
|
+
data.tar.gz: 689cd9ac97f78e19f0f04af99c90fa4314ca18df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 75928dda1606d217c778cda0a42fb5d3eda08f3efeb193855f42eb46197efa58ffd2558b0123f795b6dfa869467be00a5b16daedbdf9466b0d71b9dfef82cdb0
|
7
|
+
data.tar.gz: f02507da65cf09dab5d57f921c224d38008b202546f615efa690e48662f7a5d5ab3af2a8306ad3fee81f1d1c0e0e7b063c1f197a097e5633b054e3a4de1f197e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Harikesh Kolekar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
# SuperReceptionist ruby gem
|
2
|
+
|
3
|
+
This gem allows for idiomatic SuperReceptionist usage from within ruby. SuperReceptionist is everything you need for your business phone system. Check it out at https://developer.knowlarity.com/api-reference
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'super_receptionist'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install super_receptionist
|
20
|
+
|
21
|
+
## SuperReceptionist exposes the following resources:
|
22
|
+
* Agent
|
23
|
+
* Call
|
24
|
+
* Campaign
|
25
|
+
* Circle
|
26
|
+
* Notification
|
27
|
+
* Number
|
28
|
+
* Phonebook
|
29
|
+
* Plans
|
30
|
+
* Sound
|
31
|
+
* Task
|
32
|
+
## Usage
|
33
|
+
We mimic the ActiveRecord-style interface.
|
34
|
+
#### Configuration
|
35
|
+
```ruby
|
36
|
+
# Initialize your SuperReceptionist object:
|
37
|
+
SuperReceptionist.configure do |config|
|
38
|
+
config.channel = 'your-channel'
|
39
|
+
config.x_api_key = 'your-x_api_key'
|
40
|
+
config.authorization = 'your-authorization'
|
41
|
+
end
|
42
|
+
|
43
|
+
@super_receptionist = SuperReceptionist()
|
44
|
+
|
45
|
+
# or alternatively:
|
46
|
+
@super_receptionist = SuperReceptionist(:channel => 'your-channel',
|
47
|
+
:x_api_key => 'your-x_api_key',
|
48
|
+
:authorization => 'your-authorization'
|
49
|
+
)
|
50
|
+
```
|
51
|
+
|
52
|
+
#### Agent
|
53
|
+
```ruby
|
54
|
+
# Get Agents List
|
55
|
+
@super_receptionist.agent.list()
|
56
|
+
|
57
|
+
# Find Agent with id
|
58
|
+
@super_receptionist.agent.find(<agent_id>)
|
59
|
+
|
60
|
+
```
|
61
|
+
|
62
|
+
#### Call
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
#Get call logs
|
66
|
+
filter_option = {
|
67
|
+
start_time:"2017-03-13 12:00:00+05:30", #Mandatory
|
68
|
+
end_time:"2017-03-14 12:00:00+05:30", #Mandatory
|
69
|
+
call_type: <call_type>,
|
70
|
+
agent_number: <agent_number>,
|
71
|
+
knowlarity_number: <knowlarity_number>,
|
72
|
+
business_call_type: <business_call_type>,
|
73
|
+
customer_number: <customer_number>,
|
74
|
+
limit: <limit>
|
75
|
+
}
|
76
|
+
|
77
|
+
@super_receptionist.call.logs(filter_option)
|
78
|
+
|
79
|
+
# Make Ougoing call
|
80
|
+
call_details = {
|
81
|
+
"k_number": "+919069118xxx",
|
82
|
+
"agent_number": "+919069118xxx",
|
83
|
+
"customer_number": "+918861037xxx"
|
84
|
+
}
|
85
|
+
@super_receptionist.call.makecall(call_details)
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Campaign
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
# Get Campaign list
|
93
|
+
filter_option = {
|
94
|
+
order_id: <order_id>,
|
95
|
+
created_time__gte: <created_time__gte>,
|
96
|
+
created_time__lte: <created_time__lte>,
|
97
|
+
agent_number: <agent_number>,
|
98
|
+
end_time__gt: <end_time__gt>,
|
99
|
+
end_time__gte: <end_time__gte>,
|
100
|
+
end_time__lt : <end_time__lt >,
|
101
|
+
end_time__lte: <end_time__lte>,
|
102
|
+
is_transactional: <is_transactional>,
|
103
|
+
ivr_id: <ivr_id>,
|
104
|
+
phonebook_id: <phonebook_id>,
|
105
|
+
start_time__gt: <start_time__gt>,
|
106
|
+
start_time__gte: <start_time__gte>,
|
107
|
+
start_time__lt: <start_time__lt>,
|
108
|
+
start_time__lte: <start_time__lte>
|
109
|
+
}
|
110
|
+
|
111
|
+
@super_receptionist.campaign.list(filter_option)
|
112
|
+
|
113
|
+
# Create new Campaign
|
114
|
+
create_option = {
|
115
|
+
sound_id/ivr_id: <sound_id/ivr_id>, #Required
|
116
|
+
timezone: <timezone>, #Required
|
117
|
+
start_time: <start_time>, #Required
|
118
|
+
k_number: <k_number>, #Required
|
119
|
+
phonebook: <phonebook>,
|
120
|
+
priority: <priority>,
|
121
|
+
order_throttling: <order_throttling >,
|
122
|
+
retry_duration: <retry_duration>,
|
123
|
+
max_retry: <max_retry>,
|
124
|
+
end_time: <end_time>,
|
125
|
+
call_scheduling: <call_scheduling>,
|
126
|
+
call_scheduling_start_time: <call_scheduling_start_time >,
|
127
|
+
call_scheduling_stop_time: <call_scheduling_stop_time>,
|
128
|
+
additional_number: <additional_number>,
|
129
|
+
is_transactional: <is_transactional>
|
130
|
+
}
|
131
|
+
|
132
|
+
@super_receptionist.campaign.create(create_option)
|
133
|
+
|
134
|
+
# Update Campaign
|
135
|
+
campaign = { status: <status> }
|
136
|
+
@super_receptionist.campaign.update(<id>, campaign)
|
137
|
+
|
138
|
+
# Add Number to Campaign
|
139
|
+
campaign = { order_id: <order_id> , phone_numbers: <phone_numbers> }
|
140
|
+
@super_receptionist.campaign.add_number(<id>, campaign)
|
141
|
+
|
142
|
+
```
|
143
|
+
|
144
|
+
### Circle
|
145
|
+
```ruby
|
146
|
+
# Get list of circle
|
147
|
+
@super_receptionist.circle.list({country: <country>})
|
148
|
+
```
|
149
|
+
|
150
|
+
### Notifications
|
151
|
+
```ruby
|
152
|
+
# List of registored mobile number for notification
|
153
|
+
@super_receptionist.notification.list()
|
154
|
+
|
155
|
+
# Registor nuber for notification
|
156
|
+
@super_receptionist.notification.registor_number({knowlarity_number: <knowlarity_number>})
|
157
|
+
|
158
|
+
# Update notification status
|
159
|
+
@super_receptionist.notification.update({knowlarity_number: <knowlarity_number>, enable: <enable>})
|
160
|
+
```
|
161
|
+
|
162
|
+
### Number
|
163
|
+
```ruby
|
164
|
+
# Get List of Available number
|
165
|
+
available_number_filter = {
|
166
|
+
circle_id: <circle_idd>, #Required
|
167
|
+
cli_type: <cli_type>,
|
168
|
+
number_rating: <number_rating>,
|
169
|
+
number_type : <number_type >,
|
170
|
+
pattern: <pattern>
|
171
|
+
}
|
172
|
+
|
173
|
+
@super_receptionist.number.available(available_bumber_filter)
|
174
|
+
|
175
|
+
# Buy the number
|
176
|
+
buy_number = {
|
177
|
+
user_plan_id: <user_plan_id>, #Required
|
178
|
+
expiry_time: <expiry_time>, #Required
|
179
|
+
number: <number>, #Required
|
180
|
+
cli_type: <cli_type>,
|
181
|
+
priority: <priority>,
|
182
|
+
}
|
183
|
+
@super_receptionist.number.buy(buy_number)
|
184
|
+
|
185
|
+
# Get list of bought numbers
|
186
|
+
bought_number_filter = {
|
187
|
+
user_plan_id: <user_plan_id>,
|
188
|
+
expiry_time: <expiry_time>,
|
189
|
+
number: <number>,
|
190
|
+
}
|
191
|
+
@super_receptionist.number.list(bought_number_filter)
|
192
|
+
|
193
|
+
```
|
194
|
+
|
195
|
+
# Phonebook
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
# Get list of phonebooks associated with the SR account.
|
199
|
+
@super_receptionist.phonebook.list()
|
200
|
+
|
201
|
+
# Upload a phonebook in associated SR account.
|
202
|
+
@super_receptionist.phonebook.create(phonebookname: <phonebookname>,numbers: <numbers>)
|
203
|
+
|
204
|
+
```
|
205
|
+
|
206
|
+
### Plans
|
207
|
+
```ruby
|
208
|
+
# Get list of plans
|
209
|
+
@super_receptionist.plan.list({ id: <id>, plan: <plan>, plan_type: <plan_type> })
|
210
|
+
|
211
|
+
```
|
212
|
+
### Sound
|
213
|
+
```ruby
|
214
|
+
# Get List of sound
|
215
|
+
@super_receptionist.sound.list()
|
216
|
+
|
217
|
+
# Upload sound to the associated SR account.
|
218
|
+
sound = {
|
219
|
+
soundname: <soundname>,
|
220
|
+
soundfile: <soundfile_URL>,
|
221
|
+
language: <language>,
|
222
|
+
description:<description>
|
223
|
+
}
|
224
|
+
@super_receptionist.sound.create(sound)
|
225
|
+
```
|
226
|
+
|
227
|
+
### Task
|
228
|
+
```ruby
|
229
|
+
# Get list of Task
|
230
|
+
@super_receptionist.task.list()
|
231
|
+
|
232
|
+
# Get Task details
|
233
|
+
@super_receptionist.task.list(<id>)
|
234
|
+
```
|
235
|
+
|
236
|
+
## Development
|
237
|
+
|
238
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
239
|
+
|
240
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
241
|
+
|
242
|
+
## Contributing
|
243
|
+
|
244
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/super_receptionist. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
245
|
+
|
246
|
+
|
247
|
+
## TO DO
|
248
|
+
* Test manually with all account type.
|
249
|
+
* Write Rspec
|
250
|
+
|
251
|
+
|
252
|
+
## License
|
253
|
+
|
254
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
255
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'super_receptionist'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "json"
|
2
|
+
require "uri"
|
3
|
+
require 'rest-client'
|
4
|
+
require 'super_receptionist/agent'
|
5
|
+
require 'super_receptionist/base'
|
6
|
+
require 'super_receptionist/call'
|
7
|
+
require 'super_receptionist/campaign'
|
8
|
+
require 'super_receptionist/circle'
|
9
|
+
require 'super_receptionist/client'
|
10
|
+
require 'super_receptionist/notification'
|
11
|
+
require 'super_receptionist/number'
|
12
|
+
require 'super_receptionist/phonebook'
|
13
|
+
require 'super_receptionist/plan'
|
14
|
+
require 'super_receptionist/sound'
|
15
|
+
require 'super_receptionist/task'
|
16
|
+
require 'super_receptionist/version'
|
17
|
+
|
18
|
+
def SuperReceptionist(options = {})
|
19
|
+
options[:channel] = SuperReceptionist.channel if SuperReceptionist.channel
|
20
|
+
options[:x_api_key] = SuperReceptionist.x_api_key if SuperReceptionist.x_api_key
|
21
|
+
options[:authorization] = SuperReceptionist.authorization if SuperReceptionist.authorization
|
22
|
+
SuperReceptionist::Base.new(options)
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Agent
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
SuperReceptionist.submit(:get, url())
|
9
|
+
end
|
10
|
+
|
11
|
+
def find(id)
|
12
|
+
SuperReceptionist.submit(:get, url(id))
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def url(path='')
|
18
|
+
"#{@super_receptionis.base_url}account/agent/#{path}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Base
|
3
|
+
def initialize(options)
|
4
|
+
SuperReceptionist.api_host = options.fetch(:api_host) { "kpi.knowlarity.com" }
|
5
|
+
SuperReceptionist.protocol = options.fetch(:protocol) { "https" }
|
6
|
+
SuperReceptionist.api_version = options.fetch(:api_version) { "v1" }
|
7
|
+
SuperReceptionist.test_mode = options.fetch(:test_mode) { false }
|
8
|
+
SuperReceptionist.channel = options.fetch(:channel) { raise ArgumentError.new(":channel is a required argument to initialize SuperReceptionist") if SuperReceptionist.channel.nil? }
|
9
|
+
SuperReceptionist.x_api_key = options.fetch(:x_api_key) { raise ArgumentError.new(":x_api_key is a required argument to initialize SuperReceptionist") if SuperReceptionist.x_api_key.nil? }
|
10
|
+
SuperReceptionist.authorization = options.fetch(:authorization) { raise ArgumentError.new(":authorization is a required argument to initialize SuperReceptionist") if SuperReceptionist.authorization.nil? }
|
11
|
+
end
|
12
|
+
|
13
|
+
def base_url
|
14
|
+
"#{SuperReceptionist.protocol}://#{SuperReceptionist.api_host}/#{SuperReceptionist.channel}/#{SuperReceptionist.api_version}/"
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
SuperReceptionist::Call.new(self)
|
19
|
+
end
|
20
|
+
|
21
|
+
def agent
|
22
|
+
SuperReceptionist::Agent.new(self)
|
23
|
+
end
|
24
|
+
|
25
|
+
def compaign
|
26
|
+
SuperReceptionist::Compaign.new(self)
|
27
|
+
end
|
28
|
+
|
29
|
+
def circle
|
30
|
+
SuperReceptionist::Circle.new(self)
|
31
|
+
end
|
32
|
+
|
33
|
+
def notification
|
34
|
+
SuperReceptionist::Notification.new(self)
|
35
|
+
end
|
36
|
+
|
37
|
+
def number
|
38
|
+
SuperReceptionist::Number.new(self)
|
39
|
+
end
|
40
|
+
|
41
|
+
def phonebook
|
42
|
+
SuperReceptionist::Phonebook.new(self)
|
43
|
+
end
|
44
|
+
|
45
|
+
def plan
|
46
|
+
SuperReceptionist::Plan.new(self)
|
47
|
+
end
|
48
|
+
|
49
|
+
def sound
|
50
|
+
SuperReceptionist::Sound.new(self)
|
51
|
+
end
|
52
|
+
|
53
|
+
def task
|
54
|
+
SuperReceptionist::Task.new(self)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
class << self
|
60
|
+
attr_accessor :channel,
|
61
|
+
:api_host,
|
62
|
+
:api_version,
|
63
|
+
:protocol,
|
64
|
+
:test_mode,
|
65
|
+
:x_api_key,
|
66
|
+
:authorization
|
67
|
+
|
68
|
+
def configure
|
69
|
+
yield self
|
70
|
+
true
|
71
|
+
end
|
72
|
+
alias :config :configure
|
73
|
+
|
74
|
+
def submit(method, url, parameters={})
|
75
|
+
JSON.parse(Client.new(url).send(method, parameters))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Call
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def logs(options = {})
|
8
|
+
SuperReceptionist.submit(:get,call_url('call'), options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def makecall(options = {})
|
12
|
+
SuperReceptionist.submit(:post,call_url('account/call/makecall'), options)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def call_url(path)
|
18
|
+
@super_receptionis.base_url + path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Campaign
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list(options={})
|
8
|
+
SuperReceptionist.submit(:get, url(), options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def create(options={})
|
12
|
+
SuperReceptionist.submit(:post, url(), options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def update(id, options={})
|
16
|
+
SuperReceptionist.submit(:put, url(id), options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_number(options={})
|
20
|
+
SuperReceptionist.submit(:post, url('add-numbers'), options)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def url(path='')
|
26
|
+
"#{@super_receptionis.base_url}account/call/campaign/#{path}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Circle
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list(options = {})
|
8
|
+
SuperReceptionist.submit(:get, url, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def url()
|
14
|
+
"#{@super_receptionis.base_url}account/numbers/Circle"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Client
|
3
|
+
attr_reader :url
|
4
|
+
|
5
|
+
def initialize(url)
|
6
|
+
@url = url
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(params = {})
|
10
|
+
@url += "?#{URI.encode_www_form(params)}" if params.any?
|
11
|
+
RestClient.get(@url, headers=header)
|
12
|
+
end
|
13
|
+
|
14
|
+
def post(params = {})
|
15
|
+
RestClient.post(@url, params, headers=header)
|
16
|
+
end
|
17
|
+
|
18
|
+
def put(params = {})
|
19
|
+
RestClient.put(@url, params, headers=header)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete(params = {})
|
23
|
+
RestClient.delete(@url, params, headers=header)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def header
|
29
|
+
{ 'Content-Type' => 'application/json',
|
30
|
+
'channel' => SuperReceptionist.channel,
|
31
|
+
'x-api-key' => SuperReceptionist.x_api_key,
|
32
|
+
'authorization' => SuperReceptionist.authorization
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Notification
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
SuperReceptionist.submit(:get, url)
|
9
|
+
end
|
10
|
+
|
11
|
+
def registor_number(options = {})
|
12
|
+
SuperReceptionist.submit(:post, url, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def update(options = {})
|
16
|
+
SuperReceptionist.submit(:put, url, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def url()
|
22
|
+
"#{@super_receptionis.base_url}account/notifications/"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Number
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def available(options = {})
|
8
|
+
SuperReceptionist.submit(:get, url('AvailablePhoneNumbers'), options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def buy(options = {})
|
12
|
+
SuperReceptionist.submit(:post, url, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(options = {})
|
16
|
+
SuperReceptionist.submit(:get, url, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def url(path='')
|
22
|
+
"#{@super_receptionis.base_url}account/numbers/#{path}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Phonebook
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
SuperReceptionist.submit(:get, url)
|
9
|
+
end
|
10
|
+
|
11
|
+
def create(options = {})
|
12
|
+
SuperReceptionist.submit(:post, url, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def url()
|
18
|
+
"#{@super_receptionis.base_url}account/contacts/phonebook/"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Plan
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list(options = {})
|
8
|
+
SuperReceptionist.submit(:get, url, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def url()
|
14
|
+
"#{@super_receptionis.base_url}account/plans/"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Sound
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
SuperReceptionist.submit(:get, url)
|
9
|
+
end
|
10
|
+
|
11
|
+
def create(options = {})
|
12
|
+
SuperReceptionist.submit(:post, url, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def url()
|
18
|
+
"#{@super_receptionis.base_url}account/sound/"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SuperReceptionist
|
2
|
+
class Task
|
3
|
+
def initialize(super_receptionist)
|
4
|
+
@super_receptionis = super_receptionist
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
SuperReceptionist.submit(:get, url())
|
9
|
+
end
|
10
|
+
|
11
|
+
def find(id)
|
12
|
+
SuperReceptionist.submit(:get, url(id))
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def url(path='')
|
18
|
+
"#{@super_receptionis.base_url}account/tasks/#{path}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'super_receptionist/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'super_receptionist'
|
8
|
+
spec.version = SuperReceptionist::VERSION
|
9
|
+
spec.authors = ['Harikesh Kolekar']
|
10
|
+
spec.email = ['harikeshkolekarr@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{SuperReceptionist library for Ruby}
|
13
|
+
spec.description = %q{Idiomatic library for using the SuperReceptionist API from within ruby}
|
14
|
+
spec.homepage = "https://github.com/harikesh-kolekar/super_receptionist"
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec'
|
25
|
+
spec.add_development_dependency 'rest-client'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: super_receptionist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harikesh Kolekar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Idiomatic library for using the SuperReceptionist API from within ruby
|
70
|
+
email:
|
71
|
+
- harikeshkolekarr@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- lib/super_receptionist.rb
|
87
|
+
- lib/super_receptionist/agent.rb
|
88
|
+
- lib/super_receptionist/base.rb
|
89
|
+
- lib/super_receptionist/call.rb
|
90
|
+
- lib/super_receptionist/campaign.rb
|
91
|
+
- lib/super_receptionist/circle.rb
|
92
|
+
- lib/super_receptionist/client.rb
|
93
|
+
- lib/super_receptionist/notification.rb
|
94
|
+
- lib/super_receptionist/number.rb
|
95
|
+
- lib/super_receptionist/phonebook.rb
|
96
|
+
- lib/super_receptionist/plan.rb
|
97
|
+
- lib/super_receptionist/sound.rb
|
98
|
+
- lib/super_receptionist/task.rb
|
99
|
+
- lib/super_receptionist/version.rb
|
100
|
+
- super_receptionist.gemspec
|
101
|
+
homepage: https://github.com/harikesh-kolekar/super_receptionist
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.6.14
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: SuperReceptionist library for Ruby
|
125
|
+
test_files: []
|