frontapp 0.0.9 → 0.0.10

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
  SHA1:
3
- metadata.gz: c84f037b7cc7663aee1d15e20998de2ba93ac6b9
4
- data.tar.gz: '0587e127ce575fd3e15b710e89238dc9064baab4'
3
+ metadata.gz: 0b7ef8cbd97c8e2e8ea8e9688e0bfabdc7f6a5c9
4
+ data.tar.gz: a527bdfcd864d6d2bd086d6c0e4c063f7d21e46b
5
5
  SHA512:
6
- metadata.gz: d93206614d9d0524e19e2322dd77457a39ed0682aad6da9f6e1ea12c4e9b860d2a56a916ee8fb731f72120e3f80af99ae569f845e8e59f3a4699bc88aa7fa50c
7
- data.tar.gz: b5878450b98cd27e239f24748ed8efab4785bc9d57850cf7d36a35be792eeebdf93eb3c76087856faf41f7b34df91cc78ee181a2df79bd5b6f9e857a979aec5c
6
+ metadata.gz: 6a4ff932cc6d255323210d38cb9fe1a40d56af5101920d3f03299412efa50417e16b3ea3cc00237f36ec4875b95f3aeb8fa00686228ce49a3f91700f04805e97
7
+ data.tar.gz: 88a1cf071c6e3e202e18efb24660d36d301b8fdd5ac6cd5323342f9c56466a9e33173bd13b1eccd4f9389c75c1c82e7238915835bf1fc23ede98f2577c535d16
@@ -1,6 +1,7 @@
1
1
  require 'uri'
2
2
  require 'http'
3
3
  require 'json'
4
+ require_relative 'client/attachments.rb'
4
5
  require_relative 'client/channels.rb'
5
6
  require_relative 'client/comments.rb'
6
7
  require_relative 'client/contact_groups.rb'
@@ -21,6 +22,7 @@ require_relative 'version'
21
22
  module Frontapp
22
23
  class Client
23
24
 
25
+ include Frontapp::Client::Attachments
24
26
  include Frontapp::Client::Channels
25
27
  include Frontapp::Client::Comments
26
28
  include Frontapp::Client::ContactGroups
@@ -75,7 +77,7 @@ module Frontapp
75
77
  end
76
78
  JSON.parse(res.to_s)
77
79
  end
78
-
80
+
79
81
  def get_plain(path)
80
82
  headers_copy = @headers.dup
81
83
  res = @headers.accept("text/plain").get("#{base_url}#{path}")
@@ -85,6 +87,15 @@ module Frontapp
85
87
  res.to_s
86
88
  end
87
89
 
90
+ def get_raw(path)
91
+ headers_copy = @headers.dup
92
+ res = @headers.get("#{base_url}#{path}")
93
+ if !res.status.success?
94
+ raise Error.from_response(res)
95
+ end
96
+ res
97
+ end
98
+
88
99
  def create(path, body)
89
100
  res = @headers.post("#{base_url}#{path}", json: body)
90
101
  response = JSON.parse(res.to_s)
@@ -0,0 +1,15 @@
1
+ module Frontapp
2
+ class Client
3
+ module Attachments
4
+
5
+ # Parameters
6
+ # Name Type Description
7
+ # ----------------------------------------------------------
8
+ # attachment_link_id string Id of the requested attachment
9
+ # ----------------------------------------------------------
10
+ def download_attachment(attachment_link_id)
11
+ get_raw("download/#{attachment_link_id}")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Frontapp
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frontapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niels van der Zanden
@@ -74,6 +74,7 @@ extra_rdoc_files: []
74
74
  files:
75
75
  - lib/frontapp.rb
76
76
  - lib/frontapp/client.rb
77
+ - lib/frontapp/client/attachments.rb
77
78
  - lib/frontapp/client/channels.rb
78
79
  - lib/frontapp/client/comments.rb
79
80
  - lib/frontapp/client/contact_groups.rb