freshdesk-rest 0.0.1 → 0.1.4

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: c4dba7609ed11098e454c7df3efed04ce87562d4dd155a41f0cb3fe61132c8bc
4
- data.tar.gz: c5a1782f15f2a4d6d9d843dfd32a32f8bc2c3033aab4b633835f7645344aad4d
3
+ metadata.gz: 987d85ec3b80f0fc16f604b39897c8daa94da5aaca9bb6dd08b1c6230fa9db87
4
+ data.tar.gz: 8490474bb957d3bd86f1bba8f821ed0cad0a40e6dcc502ccc2b3267f62509307
5
5
  SHA512:
6
- metadata.gz: 54824fb46ebf235ecfbd4bd9a9b29e4a40f149a7f4e5515cbe1671ad87e9879e819a21c6b17c1f4c1fc56abf37d3ab8bc5203a3b0aa0f29f11b7f432edefa511
7
- data.tar.gz: e262751269bdbfa9eedc23faf475089b53a05e40292d913ce9ce2c0a1eb682ae649070a90366e515210f5e687e5d953bb51e2ff6ab647824d6f6060ae22d303c
6
+ metadata.gz: 7099c7a116eb87c28c21895d4a9d73f62e9c2550f4534eea7e05fe6fb7409ff0e76d46ac3d6f236aadfa4e0f1fe2ed7b91ed24ccd0c4daa1596aa340a76c137c
7
+ data.tar.gz: e6875ee01ad39b7bf37b204c44c3fdff13f1e02689af93d4c73bb99a205d9ea2dfe4cc7d75fac561e84833fb5c24588705a0efadbe7fd1f4ceaf3ff8003f52b3
@@ -2,6 +2,7 @@ require_relative 'freshdesk-rest/factory'
2
2
  require_relative 'freshdesk-rest/version'
3
3
  require_relative 'freshdesk-rest/configuration'
4
4
  require_relative 'freshdesk-rest/resource/contact'
5
+ require_relative 'freshdesk-rest/resource/ticket'
5
6
 
6
7
  module Freshdesk
7
8
  module Rest
@@ -9,9 +9,6 @@ module Freshdesk
9
9
 
10
10
  def get(path)
11
11
  resource(path).get.body
12
- rescue @client::ExceptionWithResponse => e
13
- return '[]' if e.response.code == 404
14
- raise e
15
12
  end
16
13
 
17
14
  def post(path, data)
@@ -15,6 +15,10 @@ module Freshdesk
15
15
  def self.contact_resource
16
16
  Freshdesk::Rest::Resource::Contact.new(client: api)
17
17
  end
18
+
19
+ def self.ticket_resource
20
+ Freshdesk::Rest::Resource::Ticket.new(client: api)
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -10,9 +10,7 @@ module Freshdesk
10
10
  end
11
11
 
12
12
  def list(params: {})
13
- query = URI.encode_www_form(params.to_a)
14
- path = [@path, (query.empty? ? nil : query)].compact.join('?')
15
- Parser.parse(@client.get(path))
13
+ Parser.parse(@client.get([@path, presence(query(params))].compact.join('?')))
16
14
  end
17
15
 
18
16
  def get(id:)
@@ -30,6 +28,16 @@ module Freshdesk
30
28
  def delete(id:)
31
29
  Parser.parse(@client.delete("#{@path}/#{id}"))
32
30
  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
33
41
  end
34
42
  end
35
43
  end
@@ -0,0 +1,18 @@
1
+ require_relative 'parser'
2
+
3
+ module Freshdesk
4
+ module Rest
5
+ module Resource
6
+ class Ticket
7
+ def initialize(client:)
8
+ @client = client
9
+ @path = '/tickets'
10
+ end
11
+
12
+ def post(data:)
13
+ Parser.parse(@client.post(@path, data))
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  module Freshdesk
2
2
  module Rest
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freshdesk-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
- - Paweł Placzyński
8
- autorequire:
7
+ - Helpling
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A ruby gem to interact with Freshdesk REST resources
14
- email: placzynski.pawel@gmail.com
14
+ email: tech@helpling.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
@@ -22,13 +22,14 @@ 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/ticket.rb
25
26
  - lib/freshdesk-rest/version.rb
26
27
  homepage: https://rubygems.org/gems/freshdesk-rest
27
28
  licenses:
28
29
  - MIT
29
30
  metadata:
30
- source_code_uri: https://github.com/placek/freshdesk-rest
31
- post_install_message:
31
+ source_code_uri: https://github.com/Helpling/freshdesk-rest
32
+ post_install_message:
32
33
  rdoc_options: []
33
34
  require_paths:
34
35
  - lib
@@ -43,9 +44,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
44
  - !ruby/object:Gem::Version
44
45
  version: '0'
45
46
  requirements: []
46
- rubyforge_project:
47
- rubygems_version: 2.7.3
48
- signing_key:
47
+ rubygems_version: 3.0.3
48
+ signing_key:
49
49
  specification_version: 4
50
50
  summary: Freshdesk rest api resource collection
51
51
  test_files: []