freshdesk-rest 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 987d85ec3b80f0fc16f604b39897c8daa94da5aaca9bb6dd08b1c6230fa9db87
4
- data.tar.gz: 8490474bb957d3bd86f1bba8f821ed0cad0a40e6dcc502ccc2b3267f62509307
3
+ metadata.gz: ba7686f61c35d2af5c5a159ca56f00f73db7ad61d28a33d9b6f51eefbd9d723d
4
+ data.tar.gz: 280a3208233d78d5c76f3e978f7bc47e54073cd0a58143416b4f2f7437324aa7
5
5
  SHA512:
6
- metadata.gz: 7099c7a116eb87c28c21895d4a9d73f62e9c2550f4534eea7e05fe6fb7409ff0e76d46ac3d6f236aadfa4e0f1fe2ed7b91ed24ccd0c4daa1596aa340a76c137c
7
- data.tar.gz: e6875ee01ad39b7bf37b204c44c3fdff13f1e02689af93d4c73bb99a205d9ea2dfe4cc7d75fac561e84833fb5c24588705a0efadbe7fd1f4ceaf3ff8003f52b3
6
+ metadata.gz: 695926399da6be98272a9e5343f16d0707ac067127010f74e7f01861ce0fdfc45a11e4e1b639605c6c0a33d14ba9b9a51d21e83e1e43ab89ba6bcd1ec90ee917
7
+ data.tar.gz: '09a21453b83810bc8fac5cee2e0a9ad16cc3acb3311003ddddd65281a3e5aac607e88a6e1a95f33d8a8d8441dc07e02e36b317df8569cb8e488579045410adc1'
@@ -19,6 +19,18 @@ module Freshdesk
19
19
  def self.ticket_resource
20
20
  Freshdesk::Rest::Resource::Ticket.new(client: api)
21
21
  end
22
+
23
+ def self.solutions_article_resource
24
+ Freshdesk::Rest::Resource::Solutions::Article.new(client: api)
25
+ end
26
+
27
+ def self.solutions_category_resource
28
+ Freshdesk::Rest::Resource::Solutions::Category.new(client: api)
29
+ end
30
+
31
+ def self.solutions_folder_resource
32
+ Freshdesk::Rest::Resource::Solutions::Folder.new(client: api)
33
+ end
22
34
  end
23
35
  end
24
36
  end
@@ -1,16 +1,20 @@
1
1
  require_relative 'parser'
2
+ require_relative 'utils'
3
+ require 'uri'
2
4
 
3
5
  module Freshdesk
4
6
  module Rest
5
7
  module Resource
6
8
  class Contact
9
+ include Utils
10
+
7
11
  def initialize(client:)
8
12
  @client = client
9
13
  @path = '/contacts'
10
14
  end
11
15
 
12
16
  def list(params: {})
13
- Parser.parse(@client.get([@path, presence(query(params))].compact.join('?')))
17
+ Parser.parse(@client.get(path_with_params(@path, params)))
14
18
  end
15
19
 
16
20
  def get(id:)
@@ -29,14 +33,9 @@ module Freshdesk
29
33
  Parser.parse(@client.delete("#{@path}/#{id}"))
30
34
  end
31
35
 
32
- private
33
-
34
- def presence(value)
35
- value.empty? ? nil : value
36
- end
37
-
38
- def query(params)
39
- URI.encode_www_form(params.to_a)
36
+ def hard_delete(id:, force: false)
37
+ force_params = force ? { force: true } : {}
38
+ Parser.parse(@client.delete(path_with_params([@path, id, 'hard_delete'], force_params)))
40
39
  end
41
40
  end
42
41
  end
@@ -0,0 +1,31 @@
1
+ require_relative '../parser'
2
+ require_relative '../utils'
3
+ require 'uri'
4
+
5
+ module Freshdesk
6
+ module Rest
7
+ module Resource
8
+ module Solutions
9
+ class Article
10
+ include Utils
11
+
12
+ def initialize(client:)
13
+ @client = client
14
+ end
15
+
16
+ def get(id:, language_code: nil, params: {})
17
+ Parser.parse(@client.get(path_with_params(['/solutions/articles', id, language_code], params)))
18
+ end
19
+
20
+ def list(folder_id:, language_code: nil, params: {})
21
+ Parser.parse(@client.get(path_with_params(['/solutions/folders', folder_id, 'articles', language_code], params)))
22
+ end
23
+
24
+ def search(term:, language_code: nil, params: {})
25
+ Parser.parse(@client.get(path_with_params(['/search/solutions', language_code], params.merge(term: term))))
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,24 @@
1
+ require_relative '../parser'
2
+ require_relative '../utils'
3
+ require 'uri'
4
+
5
+ module Freshdesk
6
+ module Rest
7
+ module Resource
8
+ module Solutions
9
+ class Category
10
+ include Utils
11
+
12
+ def initialize(client:)
13
+ @client = client
14
+ @path = '/solutions/categories'
15
+ end
16
+
17
+ def list(params: {})
18
+ Parser.parse(@client.get(path_with_params(@path, params)))
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../parser'
2
+ require_relative '../utils'
3
+ require 'uri'
4
+
5
+ module Freshdesk
6
+ module Rest
7
+ module Resource
8
+ module Solutions
9
+ class Folder
10
+ include Utils
11
+
12
+ def initialize(client:)
13
+ @client = client
14
+ end
15
+
16
+ def list(category_id:, params: {})
17
+ Parser.parse(@client.get(path_with_params(['/solutions/categories', category_id, 'folders'], params)))
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,8 @@
1
+ module Freshdesk
2
+ module Rest
3
+ module Resource
4
+ module Solutions
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,20 @@
1
+ module Freshdesk
2
+ module Rest
3
+ module Resource
4
+ module Utils
5
+ def presence(value)
6
+ value.empty? ? nil : value
7
+ end
8
+
9
+ def query(params)
10
+ URI.encode_www_form(params.to_a)
11
+ end
12
+
13
+ def path_with_params(path, params = {})
14
+ path = path.compact.join('/') if path.is_a?(Array)
15
+ [path, presence(query(params))].compact.join('?')
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module Freshdesk
2
2
  module Rest
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
@@ -3,6 +3,10 @@ require_relative 'freshdesk-rest/version'
3
3
  require_relative 'freshdesk-rest/configuration'
4
4
  require_relative 'freshdesk-rest/resource/contact'
5
5
  require_relative 'freshdesk-rest/resource/ticket'
6
+ require_relative 'freshdesk-rest/resource/solutions'
7
+ require_relative 'freshdesk-rest/resource/solutions/article'
8
+ require_relative 'freshdesk-rest/resource/solutions/category'
9
+ require_relative 'freshdesk-rest/resource/solutions/folder'
6
10
 
7
11
  module Freshdesk
8
12
  module Rest
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freshdesk-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helpling
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A ruby gem to interact with Freshdesk REST resources
14
14
  email: tech@helpling.com
@@ -22,14 +22,19 @@ files:
22
22
  - lib/freshdesk-rest/factory.rb
23
23
  - lib/freshdesk-rest/resource/contact.rb
24
24
  - lib/freshdesk-rest/resource/parser.rb
25
+ - lib/freshdesk-rest/resource/solutions.rb
26
+ - lib/freshdesk-rest/resource/solutions/article.rb
27
+ - lib/freshdesk-rest/resource/solutions/category.rb
28
+ - lib/freshdesk-rest/resource/solutions/folder.rb
25
29
  - lib/freshdesk-rest/resource/ticket.rb
30
+ - lib/freshdesk-rest/resource/utils.rb
26
31
  - lib/freshdesk-rest/version.rb
27
32
  homepage: https://rubygems.org/gems/freshdesk-rest
28
33
  licenses:
29
34
  - MIT
30
35
  metadata:
31
36
  source_code_uri: https://github.com/Helpling/freshdesk-rest
32
- post_install_message:
37
+ post_install_message:
33
38
  rdoc_options: []
34
39
  require_paths:
35
40
  - lib
@@ -44,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
49
  - !ruby/object:Gem::Version
45
50
  version: '0'
46
51
  requirements: []
47
- rubygems_version: 3.0.3
48
- signing_key:
52
+ rubygems_version: 3.1.6
53
+ signing_key:
49
54
  specification_version: 4
50
55
  summary: Freshdesk rest api resource collection
51
56
  test_files: []