freshdesk-rest 0.1.4 → 0.1.5

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: 6a91a877ed5848074f846fc83cc85b82d94dd604f7889e277e7aa8ec5a7c785d
4
+ data.tar.gz: 7aa93e67667119908453f47735eae76573c5ac0ebe890ce9667c0fde57dc418d
5
5
  SHA512:
6
- metadata.gz: 7099c7a116eb87c28c21895d4a9d73f62e9c2550f4534eea7e05fe6fb7409ff0e76d46ac3d6f236aadfa4e0f1fe2ed7b91ed24ccd0c4daa1596aa340a76c137c
7
- data.tar.gz: e6875ee01ad39b7bf37b204c44c3fdff13f1e02689af93d4c73bb99a205d9ea2dfe4cc7d75fac561e84833fb5c24588705a0efadbe7fd1f4ceaf3ff8003f52b3
6
+ metadata.gz: 42f564d1a0f0fe7fce5a9eeb320b479c67ce79048aee25cfa86033973b31512e05bc925b5207055fb98adf1ddd0ccf26f998d43958e6746797e8376ce5bc79db
7
+ data.tar.gz: 1bc8f392c8509a14547d46a584decfdcd0554f8836a1f03c02a3ee4947a7a7baebbb21dce3bd91d811e885abaec274de53e9ec4f835e4d25693cf79cd5374cdd
@@ -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:)
@@ -28,16 +32,6 @@ module Freshdesk
28
32
  def delete(id:)
29
33
  Parser.parse(@client.delete("#{@path}/#{id}"))
30
34
  end
31
-
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)
40
- end
41
35
  end
42
36
  end
43
37
  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.5'
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helpling
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2022-12-19 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,7 +22,12 @@ 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:
@@ -44,7 +49,7 @@ 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
52
+ rubygems_version: 3.2.33
48
53
  signing_key:
49
54
  specification_version: 4
50
55
  summary: Freshdesk rest api resource collection