hipcall 2.3.0 → 3.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33548822c10c31fae51a043b9301c8db7977fc016b75dbf2de68229001c9e87e
4
- data.tar.gz: beeea3ad16d0d6ddf22c97a305670cff873f25ff37f1bdfd569188a50f836a5f
3
+ metadata.gz: 86fa5797a95b72bd2b60b4c8d147c478ed1fa59bba67a465ae5572fe6a044a8c
4
+ data.tar.gz: 82d9521bd9aa970ef05a203f056891cfcf0e445b5021a25bf580465e5fb60b2a
5
5
  SHA512:
6
- metadata.gz: 2c694a802279ff03c8d1fa26d254a0edd4fe42513f8a164135e425b2b3bdd9466a36bb44557496b6ea5035b99f5d3e176ee60ba5e7cc58bd4affbfe50effc5e4
7
- data.tar.gz: 41c40f8faa2212aea7f5c4f46a05825218eecdbb4f951b354ec06670e287c12eb047e6e267391f0ddc6e45076a232e74c876ae74d5d1ec0001ff5c7d7759fe5e
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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.0.0
4
+
5
+ - Start support new Hipcall API.
6
+ - Change `Cdr` resource name to `Call`
7
+
3
8
  ## v2.3.0
4
9
 
5
10
  - Add tags to Contact
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hipcall (2.2.0)
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.3.0)
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 you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/hipcall`. To experiment with that code, run `bin/console` for an interactive prompt.
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(api_key: "YOUR_TOKEN_IS_HERE", version: "v20211124", base_url: "https://app.hipcall.com/api/")
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
- ### Cdr resource
36
+ ### Call resource
30
37
 
31
38
  ```ruby
32
39
  # List
33
- cdrs = hipcall.cdrs.list
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
- cdr_uuid = "caedfd1b-25ec-447e-ad87-3b7eb3d358ea"
40
- cdr = hipcall.cdrs.retrieve(year: year, mounth: mounth, day: day, cdr_uuid: cdr_uuid)
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
- ### Comment resource
89
+ #### Add comment to contact
76
90
 
77
91
  ```ruby
78
- # Create
79
- new_comment = hipcall.comments.create(commentable_type: 'company', commentable_id: 8777, content: 'Comment body, note, etc')
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: 1)
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: 1)
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
+ ```
@@ -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: "v20211124", base_url: "https://app.hipcall.com/api/", adapter: Faraday.default_adapter, stubs: nil)
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 cdrs
26
- CdrResource.new(self)
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
@@ -1,19 +1,17 @@
1
1
  module HipcallSdk
2
2
  class Collection
3
- attr_reader :data, :links, :meta
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:, links:, meta:)
13
+ def initialize(data:, meta:)
15
14
  @data = data
16
- @links = links
17
15
  @meta = meta
18
16
  end
19
17
  end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Call < Object
3
+ end
4
+ end
@@ -41,6 +41,8 @@ module HipcallSdk
41
41
  raise Error, message
42
42
  when 419
43
43
  raise Error, message
44
+ when 422
45
+ raise Error, message
44
46
  when 429
45
47
  raise Error, message
46
48
  when 500
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HipcallSdk
4
- VERSION = "2.3.0"
4
+ VERSION = "3.0.0"
5
5
  end
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 :Cdr, "hipcall/objects/cdr"
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 :CdrResource, "hipcall/resources/cdrs"
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: 2.3.0
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: 2023-04-16 00:00:00.000000000 Z
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/cdr.rb
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/cdrs.rb
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.3.7
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: []
@@ -1,4 +0,0 @@
1
- module HipcallSdk
2
- class Cdr < Object
3
- end
4
- end
@@ -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
@@ -1,7 +0,0 @@
1
- module HipcallSdk
2
- class CommentResource < Resource
3
- def create(**attributes)
4
- Comment.new post_request("comments", body: attributes).body.dig("data")
5
- end
6
- end
7
- end