hipcall 2.3.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 +5 -0
- data/Gemfile.lock +3 -2
- data/README.md +43 -17
- data/lib/hipcall/client.rb +3 -7
- data/lib/hipcall/collection.rb +2 -4
- data/lib/hipcall/objects/call.rb +4 -0
- data/lib/hipcall/resource.rb +2 -0
- data/lib/hipcall/resources/calls.rb +12 -0
- data/lib/hipcall/resources/companies.rb +5 -0
- data/lib/hipcall/resources/contacts.rb +5 -0
- data/lib/hipcall/version.rb +1 -1
- data/lib/hipcall_sdk.rb +2 -2
- metadata +10 -10
- data/lib/hipcall/objects/cdr.rb +0 -4
- 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
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,6 +66,7 @@ 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
|
|
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,21 +26,25 @@ 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
|
@@ -56,6 +63,13 @@ tags = hipcall.companies.create_tags(company_id: 1, tags: ["tag1", "tag2"]);
|
|
56
63
|
hipcall.companies.delete_tags(company_id: 1, tag_id: 1);
|
57
64
|
```
|
58
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
|
+
|
59
73
|
### Contact resource
|
60
74
|
|
61
75
|
#### Add tags to contact
|
@@ -72,28 +86,28 @@ tags = hipcall.contacts.create_tags(contact_id: 1, tags: ["tag1", "tag2"]);
|
|
72
86
|
hipcall.contacts.delete_tags(contact_id: 1, tag_id: 1);
|
73
87
|
```
|
74
88
|
|
75
|
-
|
89
|
+
#### Add comment to contact
|
76
90
|
|
77
91
|
```ruby
|
78
|
-
#
|
79
|
-
|
92
|
+
# Add tags to contact
|
93
|
+
comment = hipcall.contacts.create_tags(contact_id: 4, content: "Hello world!");
|
80
94
|
```
|
81
95
|
|
82
96
|
### Extension resource
|
83
97
|
|
84
98
|
```ruby
|
85
99
|
# List
|
86
|
-
extensions = hipcall.extensions.list
|
100
|
+
extensions = hipcall.extensions.list(limit: 10, offset: 0, sort: "id.asc")
|
87
101
|
|
88
102
|
# Retrieve
|
89
|
-
extension = hipcall.extensions.retrieve(extension_id:
|
103
|
+
extension = hipcall.extensions.retrieve(extension_id: 1234)
|
90
104
|
```
|
91
105
|
|
92
106
|
### Greetings resource
|
93
107
|
|
94
108
|
```ruby
|
95
109
|
# List
|
96
|
-
greetings = hipcall.greetings.list
|
110
|
+
greetings = hipcall.greetings.list(limit: 10, offset: 0, sort: "id.asc")
|
97
111
|
|
98
112
|
# Retrieve
|
99
113
|
greeting = hipcall.greetings.retrieve(greeting_id: 1)
|
@@ -103,17 +117,17 @@ greeting = hipcall.greetings.retrieve(greeting_id: 1)
|
|
103
117
|
|
104
118
|
```ruby
|
105
119
|
# List
|
106
|
-
numbers = hipcall.numbers.list
|
120
|
+
numbers = hipcall.numbers.list(limit: 10, offset: 0, sort: "id.asc")
|
107
121
|
|
108
122
|
# Retrieve
|
109
|
-
number = hipcall.numbers.retrieve(number_id:
|
123
|
+
number = hipcall.numbers.retrieve(number_id: 2)
|
110
124
|
```
|
111
125
|
|
112
126
|
### Task resource
|
113
127
|
|
114
128
|
```ruby
|
115
129
|
# List
|
116
|
-
tasks = hipcall.tasks.list
|
130
|
+
tasks = hipcall.tasks.list(limit: 10, offset: 0, sort: "id.asc")
|
117
131
|
|
118
132
|
# Retrieve
|
119
133
|
task = hipcall.tasks.retrieve(task_id: 1)
|
@@ -126,7 +140,7 @@ new_task = hipcall.tasks.create(name: 'Lets email the contact')
|
|
126
140
|
|
127
141
|
```ruby
|
128
142
|
# List
|
129
|
-
teams = hipcall.teams.list
|
143
|
+
teams = hipcall.teams.list(limit: 10, offset: 0, sort: "id.asc")
|
130
144
|
|
131
145
|
# Retrieve
|
132
146
|
team = hipcall.teams.retrieve(team_id: 1)
|
@@ -136,7 +150,7 @@ team = hipcall.teams.retrieve(team_id: 1)
|
|
136
150
|
|
137
151
|
```ruby
|
138
152
|
# List
|
139
|
-
users = hipcall.users.list
|
153
|
+
users = hipcall.users.list(limit: 10, offset: 0, sort: "id.asc")
|
140
154
|
|
141
155
|
# Retrieve
|
142
156
|
user = hipcall.users.retrieve(user_id: 1)
|
@@ -154,3 +168,15 @@ rake build
|
|
154
168
|
sudo gem install --local pkg/hipcall-X.X.X.gem
|
155
169
|
gem push pkg/hipcall-x.x.x.gem
|
156
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
|
+
)
|
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,8 @@ module HipcallSdk
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def comments
|
30
|
-
CommentResource.new(self)
|
25
|
+
def calls
|
26
|
+
CallResource.new(self)
|
31
27
|
end
|
32
28
|
|
33
29
|
def companies
|
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
|
@@ -8,5 +8,10 @@ module HipcallSdk
|
|
8
8
|
def delete_tags(company_id:, tag_id:)
|
9
9
|
delete_request("companies/#{company_id}/tags/#{tag_id}")
|
10
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
|
11
16
|
end
|
12
17
|
end
|
@@ -8,5 +8,10 @@ module HipcallSdk
|
|
8
8
|
def delete_tags(contact_id:, tag_id:)
|
9
9
|
delete_request("contacts/#{contact_id}/tags/#{tag_id}")
|
10
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
|
11
16
|
end
|
12
17
|
end
|
data/lib/hipcall/version.rb
CHANGED
data/lib/hipcall_sdk.rb
CHANGED
@@ -9,7 +9,7 @@ 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
13
|
autoload :Contact, "hipcall/objects/contact"
|
14
14
|
autoload :Company, "hipcall/objects/company"
|
15
15
|
autoload :Comment, "hipcall/objects/comment"
|
@@ -21,7 +21,7 @@ module HipcallSdk
|
|
21
21
|
autoload :Team, "hipcall/objects/team"
|
22
22
|
autoload :User, "hipcall/objects/user"
|
23
23
|
|
24
|
-
autoload :
|
24
|
+
autoload :CallResource, "hipcall/resources/calls"
|
25
25
|
autoload :ContactResource, "hipcall/resources/contacts"
|
26
26
|
autoload :CompanyResource, "hipcall/resources/companies"
|
27
27
|
autoload :CommentResource, "hipcall/resources/comments"
|
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,7 +61,7 @@ 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
|
65
66
|
- lib/hipcall/objects/company.rb
|
66
67
|
- lib/hipcall/objects/contact.rb
|
@@ -72,8 +73,7 @@ files:
|
|
72
73
|
- lib/hipcall/objects/team.rb
|
73
74
|
- lib/hipcall/objects/user.rb
|
74
75
|
- lib/hipcall/resource.rb
|
75
|
-
- lib/hipcall/resources/
|
76
|
-
- lib/hipcall/resources/comments.rb
|
76
|
+
- lib/hipcall/resources/calls.rb
|
77
77
|
- lib/hipcall/resources/companies.rb
|
78
78
|
- lib/hipcall/resources/contacts.rb
|
79
79
|
- lib/hipcall/resources/extensions.rb
|
@@ -92,7 +92,7 @@ metadata:
|
|
92
92
|
homepage_uri: https://www.hipcall.com
|
93
93
|
source_code_uri: https://github.com/hipcall/ruby-sdk
|
94
94
|
changelog_uri: https://github.com/hipcall/ruby-sdk/blob/master/CHANGELOG.md
|
95
|
-
post_install_message:
|
95
|
+
post_install_message:
|
96
96
|
rdoc_options: []
|
97
97
|
require_paths:
|
98
98
|
- lib
|
@@ -107,8 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
111
|
-
signing_key:
|
110
|
+
rubygems_version: 3.1.6
|
111
|
+
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Hipcall's Ruby SDK
|
114
114
|
test_files: []
|
data/lib/hipcall/objects/cdr.rb
DELETED
@@ -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
|