hipcall 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +3 -3
- data/README.md +76 -19
- data/lib/hipcall/client.rb +9 -5
- data/lib/hipcall/collection.rb +2 -4
- data/lib/hipcall/objects/call.rb +4 -0
- data/lib/hipcall/objects/company.rb +4 -0
- data/lib/hipcall/objects/contact.rb +4 -0
- data/lib/hipcall/objects/{cdr.rb → tag.rb} +1 -1
- data/lib/hipcall/resource.rb +2 -0
- data/lib/hipcall/resources/calls.rb +12 -0
- data/lib/hipcall/resources/companies.rb +17 -0
- data/lib/hipcall/resources/contacts.rb +17 -0
- data/lib/hipcall/version.rb +1 -1
- data/lib/hipcall_sdk.rb +7 -2
- metadata +15 -10
- data/lib/hipcall/resources/cdrs.rb +0 -12
- data/lib/hipcall/resources/comments.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fa5797a95b72bd2b60b4c8d147c478ed1fa59bba67a465ae5572fe6a044a8c
|
4
|
+
data.tar.gz: 82d9521bd9aa970ef05a203f056891cfcf0e445b5021a25bf580465e5fb60b2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 047a6f008aee5f9328f02b93cb1c14e980d3820257f0914267740386d25cbfa7b5b81d86b60f5a3cba9d7930f776140bcfcc21b2befed94759069978625b494e
|
7
|
+
data.tar.gz: af39ed341c79bcef2b7361af744fdb7da616a7c65adb46a1a7d0e6c84db7c4ed9b5ebdac19479b027788ce0b80a80ad5538bc2748daa03cced47972103b27fd6
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v3.0.0
|
4
|
+
|
5
|
+
- Start support new Hipcall API.
|
6
|
+
- Change `Cdr` resource name to `Call`
|
7
|
+
|
8
|
+
## v2.3.0
|
9
|
+
|
10
|
+
- Add tags to Contact
|
11
|
+
- Remove tags from Contact.
|
12
|
+
- Add tags to Company
|
13
|
+
- Remove tags from Company.
|
14
|
+
|
3
15
|
## v2.2.0
|
4
16
|
|
5
17
|
### Features
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hipcall (
|
4
|
+
hipcall (3.0.0)
|
5
5
|
faraday (~> 1.10)
|
6
6
|
faraday_middleware (~> 1.2)
|
7
7
|
|
@@ -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.4.0)
|
39
39
|
parallel (1.22.1)
|
40
40
|
parser (3.1.2.0)
|
41
41
|
ast (~> 2.4.1)
|
@@ -66,11 +66,11 @@ GEM
|
|
66
66
|
|
67
67
|
PLATFORMS
|
68
68
|
arm64-darwin-21
|
69
|
+
ruby
|
69
70
|
x86_64-darwin-22
|
70
71
|
x86_64-linux
|
71
72
|
|
72
73
|
DEPENDENCIES
|
73
|
-
faraday (~> 1.10, >= 1.10.3)
|
74
74
|
hipcall!
|
75
75
|
minitest (>= 5.0.5)
|
76
76
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Hipcall
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files
|
4
|
+
you need to be able to package up your Ruby library into a gem.
|
5
|
+
Put your Ruby code in the file `lib/hipcall`. To experiment with
|
6
|
+
that code, run `bin/console` for an interactive prompt.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -23,45 +26,88 @@ Or install it yourself as:
|
|
23
26
|
```ruby
|
24
27
|
require "hipcall_sdk"
|
25
28
|
|
26
|
-
hipcall = HipcallSdk::Client.new(
|
29
|
+
hipcall = HipcallSdk::Client.new(
|
30
|
+
api_key: "YOUR TOKEN IS HERE",
|
31
|
+
version: "v3",
|
32
|
+
base_url: "https://use.hipcall.com/api/"
|
33
|
+
)
|
27
34
|
```
|
28
35
|
|
29
|
-
###
|
36
|
+
### Call resource
|
30
37
|
|
31
38
|
```ruby
|
32
39
|
# List
|
33
|
-
|
40
|
+
calls = hipcall.calls.list(limit: 10, offset: 0, sort: "started_at.asc,user_id.desc_nulls_last")
|
34
41
|
|
35
42
|
# Retrieve
|
36
43
|
year = 2022
|
37
44
|
mounth = 07
|
38
45
|
day = 07
|
39
|
-
|
40
|
-
|
46
|
+
call_uuid = "caedfd1b-25ec-447e-ad87-3b7eb3d358ea"
|
47
|
+
call = hipcall.calls.retrieve(year: year, mounth: mounth, day: day, call_uuid: call_uuid)
|
41
48
|
```
|
42
49
|
|
43
|
-
###
|
50
|
+
### Company resource
|
51
|
+
|
52
|
+
#### Add tags to company
|
44
53
|
|
45
54
|
```ruby
|
46
|
-
#
|
47
|
-
|
55
|
+
# Add tags to company
|
56
|
+
tags = hipcall.companies.create_tags(company_id: 1, tags: ["tag1", "tag2"]);
|
57
|
+
```
|
58
|
+
|
59
|
+
#### Remove a tag from company
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
# Remove a tag from company
|
63
|
+
hipcall.companies.delete_tags(company_id: 1, tag_id: 1);
|
64
|
+
```
|
65
|
+
|
66
|
+
#### Add comment to company
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# Add tags to company
|
70
|
+
comment = hipcall.companies.create_tags(company_id: 4, content: "Hello world!");
|
71
|
+
```
|
72
|
+
|
73
|
+
### Contact resource
|
74
|
+
|
75
|
+
#### Add tags to contact
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
# Add tags to contact
|
79
|
+
tags = hipcall.contacts.create_tags(contact_id: 1, tags: ["tag1", "tag2"]);
|
80
|
+
```
|
81
|
+
|
82
|
+
#### Remove a tag from contact
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
# Remove a tag from contact
|
86
|
+
hipcall.contacts.delete_tags(contact_id: 1, tag_id: 1);
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Add comment to contact
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
# Add tags to contact
|
93
|
+
comment = hipcall.contacts.create_tags(contact_id: 4, content: "Hello world!");
|
48
94
|
```
|
49
95
|
|
50
96
|
### Extension resource
|
51
97
|
|
52
98
|
```ruby
|
53
99
|
# List
|
54
|
-
extensions = hipcall.extensions.list
|
100
|
+
extensions = hipcall.extensions.list(limit: 10, offset: 0, sort: "id.asc")
|
55
101
|
|
56
102
|
# Retrieve
|
57
|
-
extension = hipcall.extensions.retrieve(extension_id:
|
103
|
+
extension = hipcall.extensions.retrieve(extension_id: 1234)
|
58
104
|
```
|
59
105
|
|
60
106
|
### Greetings resource
|
61
107
|
|
62
108
|
```ruby
|
63
109
|
# List
|
64
|
-
greetings = hipcall.greetings.list
|
110
|
+
greetings = hipcall.greetings.list(limit: 10, offset: 0, sort: "id.asc")
|
65
111
|
|
66
112
|
# Retrieve
|
67
113
|
greeting = hipcall.greetings.retrieve(greeting_id: 1)
|
@@ -71,17 +117,17 @@ greeting = hipcall.greetings.retrieve(greeting_id: 1)
|
|
71
117
|
|
72
118
|
```ruby
|
73
119
|
# List
|
74
|
-
numbers = hipcall.numbers.list
|
120
|
+
numbers = hipcall.numbers.list(limit: 10, offset: 0, sort: "id.asc")
|
75
121
|
|
76
122
|
# Retrieve
|
77
|
-
number = hipcall.numbers.retrieve(number_id:
|
123
|
+
number = hipcall.numbers.retrieve(number_id: 2)
|
78
124
|
```
|
79
125
|
|
80
126
|
### Task resource
|
81
127
|
|
82
128
|
```ruby
|
83
129
|
# List
|
84
|
-
tasks = hipcall.tasks.list
|
130
|
+
tasks = hipcall.tasks.list(limit: 10, offset: 0, sort: "id.asc")
|
85
131
|
|
86
132
|
# Retrieve
|
87
133
|
task = hipcall.tasks.retrieve(task_id: 1)
|
@@ -94,7 +140,7 @@ new_task = hipcall.tasks.create(name: 'Lets email the contact')
|
|
94
140
|
|
95
141
|
```ruby
|
96
142
|
# List
|
97
|
-
teams = hipcall.teams.list
|
143
|
+
teams = hipcall.teams.list(limit: 10, offset: 0, sort: "id.asc")
|
98
144
|
|
99
145
|
# Retrieve
|
100
146
|
team = hipcall.teams.retrieve(team_id: 1)
|
@@ -104,14 +150,12 @@ team = hipcall.teams.retrieve(team_id: 1)
|
|
104
150
|
|
105
151
|
```ruby
|
106
152
|
# List
|
107
|
-
users = hipcall.users.list
|
153
|
+
users = hipcall.users.list(limit: 10, offset: 0, sort: "id.asc")
|
108
154
|
|
109
155
|
# Retrieve
|
110
156
|
user = hipcall.users.retrieve(user_id: 1)
|
111
157
|
```
|
112
158
|
|
113
|
-
|
114
|
-
|
115
159
|
## Contributing
|
116
160
|
|
117
161
|
Bug reports and pull requests are welcome on GitHub at https://github.com/hipcall/ruby-sdk .
|
@@ -122,4 +166,17 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/hipcal
|
|
122
166
|
rake test
|
123
167
|
rake build
|
124
168
|
sudo gem install --local pkg/hipcall-X.X.X.gem
|
169
|
+
gem push pkg/hipcall-x.x.x.gem
|
170
|
+
```
|
171
|
+
|
172
|
+
For local development
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
require "hipcall_sdk"
|
176
|
+
|
177
|
+
hipcall = HipcallSdk::Client.new(
|
178
|
+
api_key: "g2gDbQAAACQwMDZiYzA4Ni00OGI4LTRjMGItYjQxNy01MzAzNWFjZDVjOGFuBgBfEMd9jQFiAeNPSA.v4O0DvJ9IbzH_GOk6Uo4XpXPNpuM9GF4WvxqKmHB7Is",
|
179
|
+
version: "v3",
|
180
|
+
base_url: "http://localhost:4000/api/"
|
181
|
+
)
|
125
182
|
```
|
data/lib/hipcall/client.rb
CHANGED
@@ -5,7 +5,7 @@ module HipcallSdk
|
|
5
5
|
class Client
|
6
6
|
attr_reader :api_key, :version, :base_url, :adapter
|
7
7
|
|
8
|
-
def initialize(api_key:, version: "
|
8
|
+
def initialize(api_key:, version: "v3", base_url: "https://use.hipcall.com/api/", adapter: Faraday.default_adapter, stubs: nil)
|
9
9
|
@api_key = api_key
|
10
10
|
@version = version
|
11
11
|
@base_url = base_url
|
@@ -22,12 +22,16 @@ module HipcallSdk
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
25
|
+
def calls
|
26
|
+
CallResource.new(self)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
|
29
|
+
def companies
|
30
|
+
CompanyResource.new(self)
|
31
|
+
end
|
32
|
+
|
33
|
+
def contacts
|
34
|
+
ContactResource.new(self)
|
31
35
|
end
|
32
36
|
|
33
37
|
def extensions
|
data/lib/hipcall/collection.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
module HipcallSdk
|
2
2
|
class Collection
|
3
|
-
attr_reader :data, :
|
3
|
+
attr_reader :data, :meta
|
4
4
|
|
5
5
|
def self.from_response(response, key:, type:)
|
6
6
|
body = response.body
|
7
7
|
new(
|
8
8
|
data: body[key].map { |attrs| type.new(attrs) },
|
9
|
-
links: body["links"],
|
10
9
|
meta: body["meta"],
|
11
10
|
)
|
12
11
|
end
|
13
12
|
|
14
|
-
def initialize(data:,
|
13
|
+
def initialize(data:, meta:)
|
15
14
|
@data = data
|
16
|
-
@links = links
|
17
15
|
@meta = meta
|
18
16
|
end
|
19
17
|
end
|
data/lib/hipcall/resource.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
module HipcallSdk
|
2
|
+
class CallResource < Resource
|
3
|
+
def list(**params)
|
4
|
+
response = get_request("calls", params: params)
|
5
|
+
Collection.from_response(response, key: "data", type: Call)
|
6
|
+
end
|
7
|
+
|
8
|
+
def retrieve(year:, mounth:, day:, call_uuid:)
|
9
|
+
Call.new get_request("calls/#{year}/#{mounth}/#{day}/#{call_uuid}").body.dig("data")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module HipcallSdk
|
2
|
+
class CompanyResource < Resource
|
3
|
+
def create_tags(company_id:, **attributes)
|
4
|
+
response = post_request("companies/#{company_id}/tags", body: attributes)
|
5
|
+
Collection.from_response(response, key: "data", type: Tag)
|
6
|
+
end
|
7
|
+
|
8
|
+
def delete_tags(company_id:, tag_id:)
|
9
|
+
delete_request("companies/#{company_id}/tags/#{tag_id}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_comment(company_id:, **attributes)
|
13
|
+
response = post_request("companies/#{company_id}/comments", body: attributes)
|
14
|
+
Comment.new response.body.dig("data")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module HipcallSdk
|
2
|
+
class ContactResource < Resource
|
3
|
+
def create_tags(contact_id:, **attributes)
|
4
|
+
response = post_request("contacts/#{contact_id}/tags", body: attributes)
|
5
|
+
Collection.from_response(response, key: "data", type: Tag)
|
6
|
+
end
|
7
|
+
|
8
|
+
def delete_tags(contact_id:, tag_id:)
|
9
|
+
delete_request("contacts/#{contact_id}/tags/#{tag_id}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_comment(contact_id:, **attributes)
|
13
|
+
response = post_request("contacts/#{company_id}/comments", body: attributes)
|
14
|
+
Comment.new response.body.dig("data")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/hipcall/version.rb
CHANGED
data/lib/hipcall_sdk.rb
CHANGED
@@ -9,16 +9,21 @@ module HipcallSdk
|
|
9
9
|
autoload :Object, "hipcall/object"
|
10
10
|
autoload :Resource, "hipcall/resource"
|
11
11
|
|
12
|
-
autoload :
|
12
|
+
autoload :Call, "hipcall/objects/call"
|
13
|
+
autoload :Contact, "hipcall/objects/contact"
|
14
|
+
autoload :Company, "hipcall/objects/company"
|
13
15
|
autoload :Comment, "hipcall/objects/comment"
|
14
16
|
autoload :Extension, "hipcall/objects/extension"
|
15
17
|
autoload :Greeting, "hipcall/objects/greeting"
|
16
18
|
autoload :Number, "hipcall/objects/number"
|
19
|
+
autoload :Tag, "hipcall/objects/tag"
|
17
20
|
autoload :Task, "hipcall/objects/task"
|
18
21
|
autoload :Team, "hipcall/objects/team"
|
19
22
|
autoload :User, "hipcall/objects/user"
|
20
23
|
|
21
|
-
autoload :
|
24
|
+
autoload :CallResource, "hipcall/resources/calls"
|
25
|
+
autoload :ContactResource, "hipcall/resources/contacts"
|
26
|
+
autoload :CompanyResource, "hipcall/resources/companies"
|
22
27
|
autoload :CommentResource, "hipcall/resources/comments"
|
23
28
|
autoload :ExtensionResource, "hipcall/resources/extensions"
|
24
29
|
autoload :GreetingResource, "hipcall/resources/greetings"
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hipcall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hipcall Development Team
|
8
8
|
- Onur Ozgur OZKAN
|
9
9
|
- Kendal BOZKURT
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-02-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -40,13 +40,14 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '1.2'
|
43
|
-
description:
|
43
|
+
description:
|
44
44
|
email:
|
45
45
|
- hello@hipcall.com
|
46
46
|
executables: []
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
+
- ".tool-versions"
|
50
51
|
- CHANGELOG.md
|
51
52
|
- Dockerfile
|
52
53
|
- Gemfile
|
@@ -60,17 +61,21 @@ files:
|
|
60
61
|
- lib/hipcall/collection.rb
|
61
62
|
- lib/hipcall/error.rb
|
62
63
|
- lib/hipcall/object.rb
|
63
|
-
- lib/hipcall/objects/
|
64
|
+
- lib/hipcall/objects/call.rb
|
64
65
|
- lib/hipcall/objects/comment.rb
|
66
|
+
- lib/hipcall/objects/company.rb
|
67
|
+
- lib/hipcall/objects/contact.rb
|
65
68
|
- lib/hipcall/objects/extension.rb
|
66
69
|
- lib/hipcall/objects/greeting.rb
|
67
70
|
- lib/hipcall/objects/number.rb
|
71
|
+
- lib/hipcall/objects/tag.rb
|
68
72
|
- lib/hipcall/objects/task.rb
|
69
73
|
- lib/hipcall/objects/team.rb
|
70
74
|
- lib/hipcall/objects/user.rb
|
71
75
|
- lib/hipcall/resource.rb
|
72
|
-
- lib/hipcall/resources/
|
73
|
-
- lib/hipcall/resources/
|
76
|
+
- lib/hipcall/resources/calls.rb
|
77
|
+
- lib/hipcall/resources/companies.rb
|
78
|
+
- lib/hipcall/resources/contacts.rb
|
74
79
|
- lib/hipcall/resources/extensions.rb
|
75
80
|
- lib/hipcall/resources/greetings.rb
|
76
81
|
- lib/hipcall/resources/numbers.rb
|
@@ -87,7 +92,7 @@ metadata:
|
|
87
92
|
homepage_uri: https://www.hipcall.com
|
88
93
|
source_code_uri: https://github.com/hipcall/ruby-sdk
|
89
94
|
changelog_uri: https://github.com/hipcall/ruby-sdk/blob/master/CHANGELOG.md
|
90
|
-
post_install_message:
|
95
|
+
post_install_message:
|
91
96
|
rdoc_options: []
|
92
97
|
require_paths:
|
93
98
|
- lib
|
@@ -102,8 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
107
|
- !ruby/object:Gem::Version
|
103
108
|
version: '0'
|
104
109
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
106
|
-
signing_key:
|
110
|
+
rubygems_version: 3.1.6
|
111
|
+
signing_key:
|
107
112
|
specification_version: 4
|
108
113
|
summary: Hipcall's Ruby SDK
|
109
114
|
test_files: []
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module HipcallSdk
|
2
|
-
class CdrResource < Resource
|
3
|
-
def list(**params)
|
4
|
-
response = get_request("cdrs", params: params)
|
5
|
-
Collection.from_response(response, key: "data", type: Cdr)
|
6
|
-
end
|
7
|
-
|
8
|
-
def retrieve(year:, mounth:, day:, cdr_uuid:)
|
9
|
-
Cdr.new get_request("cdrs/#{year}/#{mounth}/#{day}/#{cdr_uuid}").body.dig("data")
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|