hipcall 2.1.0 → 2.3.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: 3898ac66ac26f13ccb829f6969fe89b0595b3129cd2fbb747b045f58cb4ba25c
4
- data.tar.gz: 055b881593bc0154d28cfd50e44d663067281dd54e2740b67ff7df52e59b61d9
3
+ metadata.gz: 33548822c10c31fae51a043b9301c8db7977fc016b75dbf2de68229001c9e87e
4
+ data.tar.gz: beeea3ad16d0d6ddf22c97a305670cff873f25ff37f1bdfd569188a50f836a5f
5
5
  SHA512:
6
- metadata.gz: 92ee173408c2ea56060d9637c6fb827155039344312981766a724dba0a0bf15d954d7806274569ecd0b0ff4a434051e6d218908e7acb4008b9d6aa779cf546e7
7
- data.tar.gz: 53433259f647a88586d27377426905a2c2b8e168c7021ac1412c8c22b828d7e80c8b492749ecc48d1b5260690fe44712902c3288cdc6d7990a8f8a40420303d3
6
+ metadata.gz: 2c694a802279ff03c8d1fa26d254a0edd4fe42513f8a164135e425b2b3bdd9466a36bb44557496b6ea5035b99f5d3e176ee60ba5e7cc58bd4affbfe50effc5e4
7
+ data.tar.gz: 41c40f8faa2212aea7f5c4f46a05825218eecdbb4f951b354ec06670e287c12eb047e6e267391f0ddc6e45076a232e74c876ae74d5d1ec0001ff5c7d7759fe5e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.3.0
4
+
5
+ - Add tags to Contact
6
+ - Remove tags from Contact.
7
+ - Add tags to Company
8
+ - Remove tags from Company.
9
+
10
+ ## v2.2.0
11
+
12
+ ### Features
13
+
14
+ - Add extension resource
15
+ - Add team resource
16
+ - Add greeting resource
17
+
18
+ ## v2.1.0
19
+
20
+ ### Features
21
+
22
+ - Add comment resource
23
+
3
24
  ## v2.0.0
4
25
 
5
26
  ### Refactor
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hipcall (2.0.0)
4
+ hipcall (2.2.0)
5
5
  faraday (~> 1.10)
6
6
  faraday_middleware (~> 1.2)
7
7
 
@@ -70,7 +70,6 @@ PLATFORMS
70
70
  x86_64-linux
71
71
 
72
72
  DEPENDENCIES
73
- faraday (~> 1.10, >= 1.10.3)
74
73
  hipcall!
75
74
  minitest (>= 5.0.5)
76
75
  rake (~> 13.0)
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  ```ruby
24
24
  require "hipcall_sdk"
25
25
 
26
- hipcall = HipcallSdk::Client.new(api_key: "YOUR_TOKEN_IS_HERE", version: "v20211124", base_url: "https://app.hipcall.com.tr/api/")
26
+ hipcall = HipcallSdk::Client.new(api_key: "YOUR_TOKEN_IS_HERE", version: "v20211124", base_url: "https://app.hipcall.com/api/")
27
27
  ```
28
28
 
29
29
  ### Cdr resource
@@ -40,6 +40,65 @@ cdr_uuid = "caedfd1b-25ec-447e-ad87-3b7eb3d358ea"
40
40
  cdr = hipcall.cdrs.retrieve(year: year, mounth: mounth, day: day, cdr_uuid: cdr_uuid)
41
41
  ```
42
42
 
43
+ ### Company resource
44
+
45
+ #### Add tags to company
46
+
47
+ ```ruby
48
+ # Add tags to company
49
+ tags = hipcall.companies.create_tags(company_id: 1, tags: ["tag1", "tag2"]);
50
+ ```
51
+
52
+ #### Remove a tag from company
53
+
54
+ ```ruby
55
+ # Remove a tag from company
56
+ hipcall.companies.delete_tags(company_id: 1, tag_id: 1);
57
+ ```
58
+
59
+ ### Contact resource
60
+
61
+ #### Add tags to contact
62
+
63
+ ```ruby
64
+ # Add tags to contact
65
+ tags = hipcall.contacts.create_tags(contact_id: 1, tags: ["tag1", "tag2"]);
66
+ ```
67
+
68
+ #### Remove a tag from contact
69
+
70
+ ```ruby
71
+ # Remove a tag from contact
72
+ hipcall.contacts.delete_tags(contact_id: 1, tag_id: 1);
73
+ ```
74
+
75
+ ### Comment resource
76
+
77
+ ```ruby
78
+ # Create
79
+ new_comment = hipcall.comments.create(commentable_type: 'company', commentable_id: 8777, content: 'Comment body, note, etc')
80
+ ```
81
+
82
+ ### Extension resource
83
+
84
+ ```ruby
85
+ # List
86
+ extensions = hipcall.extensions.list
87
+
88
+ # Retrieve
89
+ extension = hipcall.extensions.retrieve(extension_id: 1)
90
+ ```
91
+
92
+ ### Greetings resource
93
+
94
+ ```ruby
95
+ # List
96
+ greetings = hipcall.greetings.list
97
+
98
+ # Retrieve
99
+ greeting = hipcall.greetings.retrieve(greeting_id: 1)
100
+ ```
101
+
43
102
  ### Number resource
44
103
 
45
104
  ```ruby
@@ -63,32 +122,35 @@ task = hipcall.tasks.retrieve(task_id: 1)
63
122
  new_task = hipcall.tasks.create(name: 'Lets email the contact')
64
123
  ```
65
124
 
66
- ### User resource
125
+ ### Team resource
67
126
 
68
127
  ```ruby
69
128
  # List
70
- users = hipcall.users.list
129
+ teams = hipcall.teams.list
71
130
 
72
131
  # Retrieve
73
- user = hipcall.users.retrieve(user_id: 1)
132
+ team = hipcall.teams.retrieve(team_id: 1)
74
133
  ```
75
134
 
76
- ### Comment resource
135
+ ### User resource
77
136
 
78
137
  ```ruby
79
- # Create
80
- new_comment = hipcall.comments.create(commentable_type: 'company', commentable_id: 8777, content: 'Comment body, note, etc')
138
+ # List
139
+ users = hipcall.users.list
140
+
141
+ # Retrieve
142
+ user = hipcall.users.retrieve(user_id: 1)
81
143
  ```
82
144
 
83
145
  ## Contributing
84
146
 
85
147
  Bug reports and pull requests are welcome on GitHub at https://github.com/hipcall/ruby-sdk .
86
148
 
87
-
88
149
  ### Some useful commands
89
150
 
90
151
  ```
91
152
  rake test
92
153
  rake build
93
154
  sudo gem install --local pkg/hipcall-X.X.X.gem
155
+ gem push pkg/hipcall-x.x.x.gem
94
156
  ```
@@ -13,10 +13,39 @@ 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 companies
34
+ CompanyResource.new(self)
35
+ end
36
+
37
+ def contacts
38
+ ContactResource.new(self)
39
+ end
40
+
41
+ def extensions
42
+ ExtensionResource.new(self)
43
+ end
44
+
45
+ def greetings
46
+ GreetingResource.new(self)
47
+ end
48
+
20
49
  def numbers
21
50
  NumberResource.new(self)
22
51
  end
@@ -25,21 +54,12 @@ module HipcallSdk
25
54
  TaskResource.new(self)
26
55
  end
27
56
 
28
- def users
29
- UserResource.new(self)
30
- end
31
-
32
- def comments
33
- CommentResource.new(self)
57
+ def teams
58
+ TeamResource.new(self)
34
59
  end
35
60
 
36
- def connection
37
- @connection ||= Faraday.new (base_url + version) do |connection|
38
- connection.request :authorization, :Bearer, api_key
39
- connection.request :json, :accept => 'application/json'
40
- connection.response :json, content_type: "application/json"
41
- connection.adapter adapter, @stubs
42
- end
61
+ def users
62
+ UserResource.new(self)
43
63
  end
44
64
  end
45
65
  end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Company < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Contact < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Extension < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Greeting < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Tag < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module HipcallSdk
2
+ class Team < Object
3
+ end
4
+ end
@@ -0,0 +1,12 @@
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
+ end
12
+ end
@@ -0,0 +1,12 @@
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
+ end
12
+ 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HipcallSdk
4
- VERSION = "2.1.0"
4
+ VERSION = "2.3.0"
5
5
  end
data/lib/hipcall_sdk.rb CHANGED
@@ -10,14 +10,25 @@ module HipcallSdk
10
10
  autoload :Resource, "hipcall/resource"
11
11
 
12
12
  autoload :Cdr, "hipcall/objects/cdr"
13
+ autoload :Contact, "hipcall/objects/contact"
14
+ autoload :Company, "hipcall/objects/company"
15
+ autoload :Comment, "hipcall/objects/comment"
16
+ autoload :Extension, "hipcall/objects/extension"
17
+ autoload :Greeting, "hipcall/objects/greeting"
13
18
  autoload :Number, "hipcall/objects/number"
19
+ autoload :Tag, "hipcall/objects/tag"
14
20
  autoload :Task, "hipcall/objects/task"
21
+ autoload :Team, "hipcall/objects/team"
15
22
  autoload :User, "hipcall/objects/user"
16
- autoload :Comment, "hipcall/objects/comment"
17
23
 
18
24
  autoload :CdrResource, "hipcall/resources/cdrs"
25
+ autoload :ContactResource, "hipcall/resources/contacts"
26
+ autoload :CompanyResource, "hipcall/resources/companies"
27
+ autoload :CommentResource, "hipcall/resources/comments"
28
+ autoload :ExtensionResource, "hipcall/resources/extensions"
29
+ autoload :GreetingResource, "hipcall/resources/greetings"
19
30
  autoload :NumberResource, "hipcall/resources/numbers"
20
31
  autoload :TaskResource, "hipcall/resources/tasks"
32
+ autoload :TeamResource, "hipcall/resources/teams"
21
33
  autoload :UserResource, "hipcall/resources/users"
22
- autoload :CommentResource, "hipcall/resources/comments"
23
34
  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.1.0
4
+ version: 2.3.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: 2023-03-06 00:00:00.000000000 Z
13
+ date: 2023-04-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -62,14 +62,25 @@ files:
62
62
  - lib/hipcall/object.rb
63
63
  - lib/hipcall/objects/cdr.rb
64
64
  - lib/hipcall/objects/comment.rb
65
+ - lib/hipcall/objects/company.rb
66
+ - lib/hipcall/objects/contact.rb
67
+ - lib/hipcall/objects/extension.rb
68
+ - lib/hipcall/objects/greeting.rb
65
69
  - lib/hipcall/objects/number.rb
70
+ - lib/hipcall/objects/tag.rb
66
71
  - lib/hipcall/objects/task.rb
72
+ - lib/hipcall/objects/team.rb
67
73
  - lib/hipcall/objects/user.rb
68
74
  - lib/hipcall/resource.rb
69
75
  - lib/hipcall/resources/cdrs.rb
70
76
  - lib/hipcall/resources/comments.rb
77
+ - lib/hipcall/resources/companies.rb
78
+ - lib/hipcall/resources/contacts.rb
79
+ - lib/hipcall/resources/extensions.rb
80
+ - lib/hipcall/resources/greetings.rb
71
81
  - lib/hipcall/resources/numbers.rb
72
82
  - lib/hipcall/resources/tasks.rb
83
+ - lib/hipcall/resources/teams.rb
73
84
  - lib/hipcall/resources/users.rb
74
85
  - lib/hipcall/version.rb
75
86
  - lib/hipcall_sdk.rb