hipcall 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +5 -3
- data/README.md +50 -1
- data/hipcall.gemspec +39 -0
- data/lib/hipcall/client.rb +25 -9
- data/lib/hipcall/objects/comment.rb +4 -0
- data/lib/hipcall/objects/extension.rb +4 -0
- data/lib/hipcall/objects/greeting.rb +4 -0
- data/lib/hipcall/objects/team.rb +4 -0
- data/lib/hipcall/resources/comments.rb +7 -0
- data/lib/hipcall/resources/extensions.rb +12 -0
- data/lib/hipcall/resources/greetings.rb +12 -0
- data/lib/hipcall/resources/teams.rb +12 -0
- data/lib/hipcall/version.rb +1 -1
- data/lib/hipcall_sdk.rb +8 -1
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 072b7a0cc008aca2610f483131fb18c9d884d0cb1dc9a3001393986f6b5c7348
|
4
|
+
data.tar.gz: f31f1a70e20bb86cc2fea7c3450278ea18c9dbc1ab5721f30215467bc8aa348e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ea9402937bef7e0cdadc121cb23013b027f76c72653cf2e2c4886f5ee542826a0943bdf99e6aaf77d11e1c38ba80888e1b661253d8c48e1fb8d0ae2802a0884
|
7
|
+
data.tar.gz: 7d76e148e92da353a8affa155bc5816eb17c1f4f79999feec23edab633e9273dc2da847356cc81e2144b7c62cd52066b2b55015db2f1b1acb2d8fc9d44ac56fc
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hipcall (
|
4
|
+
hipcall (2.0.0)
|
5
5
|
faraday (~> 1.10)
|
6
6
|
faraday_middleware (~> 1.2)
|
7
7
|
|
@@ -9,7 +9,7 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
|
-
faraday (1.10.
|
12
|
+
faraday (1.10.3)
|
13
13
|
faraday-em_http (~> 1.0)
|
14
14
|
faraday-em_synchrony (~> 1.0)
|
15
15
|
faraday-excon (~> 1.1)
|
@@ -35,7 +35,7 @@ GEM
|
|
35
35
|
faraday_middleware (1.2.0)
|
36
36
|
faraday (~> 1.0)
|
37
37
|
minitest (5.16.2)
|
38
|
-
multipart-post (2.
|
38
|
+
multipart-post (2.3.0)
|
39
39
|
parallel (1.22.1)
|
40
40
|
parser (3.1.2.0)
|
41
41
|
ast (~> 2.4.1)
|
@@ -66,9 +66,11 @@ GEM
|
|
66
66
|
|
67
67
|
PLATFORMS
|
68
68
|
arm64-darwin-21
|
69
|
+
x86_64-darwin-22
|
69
70
|
x86_64-linux
|
70
71
|
|
71
72
|
DEPENDENCIES
|
73
|
+
faraday (~> 1.10, >= 1.10.3)
|
72
74
|
hipcall!
|
73
75
|
minitest (>= 5.0.5)
|
74
76
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -21,7 +21,9 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
|
24
|
+
require "hipcall_sdk"
|
25
|
+
|
26
|
+
hipcall = HipcallSdk::Client.new(api_key: "YOUR_TOKEN_IS_HERE", version: "v20211124", base_url: "https://app.hipcall.com/api/")
|
25
27
|
```
|
26
28
|
|
27
29
|
### Cdr resource
|
@@ -38,6 +40,33 @@ cdr_uuid = "caedfd1b-25ec-447e-ad87-3b7eb3d358ea"
|
|
38
40
|
cdr = hipcall.cdrs.retrieve(year: year, mounth: mounth, day: day, cdr_uuid: cdr_uuid)
|
39
41
|
```
|
40
42
|
|
43
|
+
### Comment resource
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# Create
|
47
|
+
new_comment = hipcall.comments.create(commentable_type: 'company', commentable_id: 8777, content: 'Comment body, note, etc')
|
48
|
+
```
|
49
|
+
|
50
|
+
### Extension resource
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
# List
|
54
|
+
extensions = hipcall.extensions.list
|
55
|
+
|
56
|
+
# Retrieve
|
57
|
+
extension = hipcall.extensions.retrieve(extension_id: 1)
|
58
|
+
```
|
59
|
+
|
60
|
+
### Greetings resource
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
# List
|
64
|
+
greetings = hipcall.greetings.list
|
65
|
+
|
66
|
+
# Retrieve
|
67
|
+
greeting = hipcall.greetings.retrieve(greeting_id: 1)
|
68
|
+
```
|
69
|
+
|
41
70
|
### Number resource
|
42
71
|
|
43
72
|
```ruby
|
@@ -61,6 +90,16 @@ task = hipcall.tasks.retrieve(task_id: 1)
|
|
61
90
|
new_task = hipcall.tasks.create(name: 'Lets email the contact')
|
62
91
|
```
|
63
92
|
|
93
|
+
### Team resource
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
# List
|
97
|
+
teams = hipcall.teams.list
|
98
|
+
|
99
|
+
# Retrieve
|
100
|
+
team = hipcall.teams.retrieve(team_id: 1)
|
101
|
+
```
|
102
|
+
|
64
103
|
### User resource
|
65
104
|
|
66
105
|
```ruby
|
@@ -71,6 +110,16 @@ users = hipcall.users.list
|
|
71
110
|
user = hipcall.users.retrieve(user_id: 1)
|
72
111
|
```
|
73
112
|
|
113
|
+
|
114
|
+
|
74
115
|
## Contributing
|
75
116
|
|
76
117
|
Bug reports and pull requests are welcome on GitHub at https://github.com/hipcall/ruby-sdk .
|
118
|
+
|
119
|
+
### Some useful commands
|
120
|
+
|
121
|
+
```
|
122
|
+
rake test
|
123
|
+
rake build
|
124
|
+
sudo gem install --local pkg/hipcall-X.X.X.gem
|
125
|
+
```
|
data/hipcall.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/hipcall/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "hipcall"
|
7
|
+
spec.version = HipcallSdk::VERSION
|
8
|
+
spec.authors = ["Hipcall Development Team", "Onur Ozgur OZKAN", "Kendal BOZKURT"]
|
9
|
+
spec.email = ["hello@hipcall.com"]
|
10
|
+
|
11
|
+
spec.summary = "Hipcall's Ruby SDK"
|
12
|
+
spec.homepage = "https://www.hipcall.com"
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
|
+
|
15
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/hipcall/ruby-sdk"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/hipcall/ruby-sdk/blob/master/CHANGELOG.md"
|
20
|
+
spec.licenses = "MIT"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
# Uncomment to register a new dependency of your gem
|
34
|
+
spec.add_dependency "faraday", "~> 1.10"
|
35
|
+
spec.add_dependency "faraday_middleware", "~> 1.2"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, checkout our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
data/lib/hipcall/client.rb
CHANGED
@@ -13,10 +13,31 @@ module HipcallSdk
|
|
13
13
|
@stubs = stubs
|
14
14
|
end
|
15
15
|
|
16
|
+
def connection
|
17
|
+
@connection ||= Faraday.new (base_url + version) do |connection|
|
18
|
+
connection.request :authorization, :Bearer, api_key
|
19
|
+
connection.request :json, :accept => 'application/json'
|
20
|
+
connection.response :json, content_type: "application/json"
|
21
|
+
connection.adapter adapter, @stubs
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
16
25
|
def cdrs
|
17
26
|
CdrResource.new(self)
|
18
27
|
end
|
19
28
|
|
29
|
+
def comments
|
30
|
+
CommentResource.new(self)
|
31
|
+
end
|
32
|
+
|
33
|
+
def extensions
|
34
|
+
ExtensionResource.new(self)
|
35
|
+
end
|
36
|
+
|
37
|
+
def greetings
|
38
|
+
GreetingResource.new(self)
|
39
|
+
end
|
40
|
+
|
20
41
|
def numbers
|
21
42
|
NumberResource.new(self)
|
22
43
|
end
|
@@ -25,17 +46,12 @@ module HipcallSdk
|
|
25
46
|
TaskResource.new(self)
|
26
47
|
end
|
27
48
|
|
28
|
-
def
|
29
|
-
|
49
|
+
def teams
|
50
|
+
TeamResource.new(self)
|
30
51
|
end
|
31
52
|
|
32
|
-
def
|
33
|
-
|
34
|
-
connection.request :authorization, :Bearer, api_key
|
35
|
-
connection.request :json, :accept => 'application/json'
|
36
|
-
connection.response :json, content_type: "application/json"
|
37
|
-
connection.adapter adapter, @stubs
|
38
|
-
end
|
53
|
+
def users
|
54
|
+
UserResource.new(self)
|
39
55
|
end
|
40
56
|
end
|
41
57
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module HipcallSdk
|
2
|
+
class ExtensionResource < Resource
|
3
|
+
def list(**params)
|
4
|
+
response = get_request("extensions", params: params)
|
5
|
+
Collection.from_response(response, key: "data", type: Extension)
|
6
|
+
end
|
7
|
+
|
8
|
+
def retrieve(extension_id:)
|
9
|
+
Extension.new get_request("extensions/#{extension_id}").body.dig("data")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module HipcallSdk
|
2
|
+
class GreetingResource < Resource
|
3
|
+
def list(**params)
|
4
|
+
response = get_request("greetings", params: params)
|
5
|
+
Collection.from_response(response, key: "data", type: Greeting)
|
6
|
+
end
|
7
|
+
|
8
|
+
def retrieve(greeting_id:)
|
9
|
+
Greeting.new get_request("greetings/#{greeting_id}").body.dig("data")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module HipcallSdk
|
2
|
+
class TeamResource < Resource
|
3
|
+
def list(**params)
|
4
|
+
response = get_request("teams", params: params)
|
5
|
+
Collection.from_response(response, key: "data", type: Team)
|
6
|
+
end
|
7
|
+
|
8
|
+
def retrieve(team_id:)
|
9
|
+
Team.new get_request("teams/#{team_id}").body.dig("data")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/hipcall/version.rb
CHANGED
data/lib/hipcall_sdk.rb
CHANGED
@@ -9,14 +9,21 @@ module HipcallSdk
|
|
9
9
|
autoload :Object, "hipcall/object"
|
10
10
|
autoload :Resource, "hipcall/resource"
|
11
11
|
|
12
|
-
|
13
12
|
autoload :Cdr, "hipcall/objects/cdr"
|
13
|
+
autoload :Comment, "hipcall/objects/comment"
|
14
|
+
autoload :Extension, "hipcall/objects/extension"
|
15
|
+
autoload :Greeting, "hipcall/objects/greeting"
|
14
16
|
autoload :Number, "hipcall/objects/number"
|
15
17
|
autoload :Task, "hipcall/objects/task"
|
18
|
+
autoload :Team, "hipcall/objects/team"
|
16
19
|
autoload :User, "hipcall/objects/user"
|
17
20
|
|
18
21
|
autoload :CdrResource, "hipcall/resources/cdrs"
|
22
|
+
autoload :CommentResource, "hipcall/resources/comments"
|
23
|
+
autoload :ExtensionResource, "hipcall/resources/extensions"
|
24
|
+
autoload :GreetingResource, "hipcall/resources/greetings"
|
19
25
|
autoload :NumberResource, "hipcall/resources/numbers"
|
20
26
|
autoload :TaskResource, "hipcall/resources/tasks"
|
27
|
+
autoload :TeamResource, "hipcall/resources/teams"
|
21
28
|
autoload :UserResource, "hipcall/resources/users"
|
22
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hipcall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hipcall Development Team
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-03-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -55,18 +55,27 @@ files:
|
|
55
55
|
- Rakefile
|
56
56
|
- bin/console
|
57
57
|
- bin/setup
|
58
|
+
- hipcall.gemspec
|
58
59
|
- lib/hipcall/client.rb
|
59
60
|
- lib/hipcall/collection.rb
|
60
61
|
- lib/hipcall/error.rb
|
61
62
|
- lib/hipcall/object.rb
|
62
63
|
- lib/hipcall/objects/cdr.rb
|
64
|
+
- lib/hipcall/objects/comment.rb
|
65
|
+
- lib/hipcall/objects/extension.rb
|
66
|
+
- lib/hipcall/objects/greeting.rb
|
63
67
|
- lib/hipcall/objects/number.rb
|
64
68
|
- lib/hipcall/objects/task.rb
|
69
|
+
- lib/hipcall/objects/team.rb
|
65
70
|
- lib/hipcall/objects/user.rb
|
66
71
|
- lib/hipcall/resource.rb
|
67
72
|
- lib/hipcall/resources/cdrs.rb
|
73
|
+
- lib/hipcall/resources/comments.rb
|
74
|
+
- lib/hipcall/resources/extensions.rb
|
75
|
+
- lib/hipcall/resources/greetings.rb
|
68
76
|
- lib/hipcall/resources/numbers.rb
|
69
77
|
- lib/hipcall/resources/tasks.rb
|
78
|
+
- lib/hipcall/resources/teams.rb
|
70
79
|
- lib/hipcall/resources/users.rb
|
71
80
|
- lib/hipcall/version.rb
|
72
81
|
- lib/hipcall_sdk.rb
|
@@ -93,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
102
|
- !ruby/object:Gem::Version
|
94
103
|
version: '0'
|
95
104
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.3.7
|
97
106
|
signing_key:
|
98
107
|
specification_version: 4
|
99
108
|
summary: Hipcall's Ruby SDK
|