frontapp 0.0.9 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/frontapp/client/attachments.rb +15 -0
- data/lib/frontapp/client/conversations.rb +46 -1
- data/lib/frontapp/client/links.rb +64 -0
- data/lib/frontapp/client/topics.rb +4 -3
- data/lib/frontapp/client.rb +14 -1
- data/lib/frontapp/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 137dd83548a9b04722f92973d145361bc5a9cc54a8f3b4ef7838123fa1d577f2
|
4
|
+
data.tar.gz: 2e27f67b3cb694fa4d9d80b7080c5164ade7279ca1882433f3838cfaa3211a21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c535fe7e6d2576bcff22a3f0b9cad3626d64a7abfd998cb0314b727722a3eec79ad0ea57f34cc46173b7bba7c5a316f7773af8f76d171f7a045d7d76bc73bd9
|
7
|
+
data.tar.gz: e59366a309d89dffe65ee6383d79211267ae135883c0c93bbf79941ffcc81942b3826a974e1166ce17f7a66c97d291a4c4443eb929c39da3ba3586e033d5f5b6
|
@@ -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
|
@@ -70,6 +70,51 @@ module Frontapp
|
|
70
70
|
def get_conversation_messages(conversation_id)
|
71
71
|
list("conversations/#{conversation_id}/messages")
|
72
72
|
end
|
73
|
+
|
74
|
+
# Parameters
|
75
|
+
# Name Type Description
|
76
|
+
# ----------------------------------------------
|
77
|
+
# conversation_id string The conversation Id
|
78
|
+
# link_ids array (optional) Link IDs to add Either link_ids or link_external_urls must be specified but not both
|
79
|
+
# link_external_urls array (optional) Link external urls to add. Creates links if necessary. Either link_ids or link_external_urls must be specified but not both
|
80
|
+
# ----------------------------------------------
|
81
|
+
def add_conversation_links!(conversation_id, params = {})
|
82
|
+
cleaned = params.permit(:link_ids, :link_external_urls)
|
83
|
+
create_without_response("conversations/#{conversation_id}/links", cleaned)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Parameters
|
87
|
+
# Name Type Description
|
88
|
+
# ----------------------------------------------
|
89
|
+
# conversation_id string The conversation Id
|
90
|
+
# link_ids array of strings link IDs to remove
|
91
|
+
# ----------------------------------------------
|
92
|
+
def remove_conversation_links!(conversation_id, params = {})
|
93
|
+
cleaned = params.permit(:link_ids)
|
94
|
+
delete("conversations/#{conversation_id}/links", cleaned)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Parameters
|
98
|
+
# Name Type Description
|
99
|
+
# ----------------------------------------------
|
100
|
+
# conversation_id string The conversation Id
|
101
|
+
# teammate_ids array of strings follower IDs to remove
|
102
|
+
# ----------------------------------------------
|
103
|
+
def remove_conversation_followers!(conversation_id, params = {})
|
104
|
+
cleaned = params.permit(:teammate_ids)
|
105
|
+
delete("conversations/#{conversation_id}/followers", cleaned)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Parameters
|
109
|
+
# Name Type Description
|
110
|
+
# ----------------------------------------------
|
111
|
+
# conversation_id string The conversation Id
|
112
|
+
# teammate_ids array of strings follower IDs to add
|
113
|
+
# ----------------------------------------------
|
114
|
+
def add_conversation_followers!(conversation_id, params = {})
|
115
|
+
cleaned = params.permit(:teammate_ids)
|
116
|
+
create_without_response("conversations/#{conversation_id}/followers", cleaned)
|
117
|
+
end
|
73
118
|
end
|
74
119
|
end
|
75
|
-
end
|
120
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Frontapp
|
2
|
+
class Client
|
3
|
+
module Links
|
4
|
+
|
5
|
+
def links(params = {})
|
6
|
+
cleaned = params.permit({ q: [:statuses] })
|
7
|
+
list("links", cleaned)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Parameters
|
11
|
+
# Name Type Description
|
12
|
+
# -------------------------------
|
13
|
+
# link_id string Id of the requested link
|
14
|
+
# -------------------------------
|
15
|
+
def get_link(link_id)
|
16
|
+
get("links/#{link_id}")
|
17
|
+
end
|
18
|
+
|
19
|
+
# Allowed attributes:
|
20
|
+
# Name Type Description
|
21
|
+
# ------------------------------------
|
22
|
+
# name string (optional) Name of the link. If none is specified, the external_url is used as a default
|
23
|
+
# external_url string Underlying identifying link/url of the link
|
24
|
+
# ------------------------------------
|
25
|
+
def create_link!(params = {})
|
26
|
+
cleaned = params.permit(:name, :external_url)
|
27
|
+
create("links", cleaned)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Parameters
|
31
|
+
# Name Type Description
|
32
|
+
# -----------------------------
|
33
|
+
# link_id string Id of the requested link
|
34
|
+
# -----------------------------
|
35
|
+
#
|
36
|
+
# Allowed attributes:
|
37
|
+
# Name Type Description
|
38
|
+
# ------------------------------------
|
39
|
+
# name string New name of the link
|
40
|
+
# ------------------------------------
|
41
|
+
def update_link!(link_id, params = {})
|
42
|
+
cleaned = params.permit(:name)
|
43
|
+
update("links/#{link_id}", cleaned)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Parameters
|
47
|
+
# Name Type Description
|
48
|
+
# -----------------------------
|
49
|
+
# link_id string Id of the requested link
|
50
|
+
# -----------------------------
|
51
|
+
#
|
52
|
+
# Allowed params:
|
53
|
+
# Name Type Description
|
54
|
+
# ------------------------------------------
|
55
|
+
# q object (optional) Search query.
|
56
|
+
# q.statuses array (optional) List of the statuses of the conversations you want to list
|
57
|
+
# ------------------------------------------
|
58
|
+
def get_link_conversations(link_id, params = {})
|
59
|
+
cleaned = params.permit({ q: [:statuses] })
|
60
|
+
list("links/#{link_id}/conversations", cleaned)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -15,9 +15,10 @@ module Frontapp
|
|
15
15
|
# q.statuses array (optional) List of the statuses of the conversations you want to list
|
16
16
|
# ------------------------------------------
|
17
17
|
def get_topic_conversations(topic_id, params = {})
|
18
|
-
|
19
|
-
|
18
|
+
warn "[DEPRECATION] `Topics` is deprecated. Please use `Links` instead."
|
19
|
+
|
20
|
+
get_link_conversations(topic_id, params)
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
23
|
-
end
|
24
|
+
end
|
data/lib/frontapp/client.rb
CHANGED
@@ -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'
|
@@ -14,6 +15,7 @@ require_relative 'client/tags.rb'
|
|
14
15
|
require_relative 'client/teammates.rb'
|
15
16
|
require_relative 'client/teams.rb'
|
16
17
|
require_relative 'client/topics.rb'
|
18
|
+
require_relative 'client/links.rb'
|
17
19
|
require_relative 'client/exports.rb'
|
18
20
|
require_relative 'error'
|
19
21
|
require_relative 'version'
|
@@ -21,6 +23,7 @@ require_relative 'version'
|
|
21
23
|
module Frontapp
|
22
24
|
class Client
|
23
25
|
|
26
|
+
include Frontapp::Client::Attachments
|
24
27
|
include Frontapp::Client::Channels
|
25
28
|
include Frontapp::Client::Comments
|
26
29
|
include Frontapp::Client::ContactGroups
|
@@ -34,6 +37,7 @@ module Frontapp
|
|
34
37
|
include Frontapp::Client::Teammates
|
35
38
|
include Frontapp::Client::Teams
|
36
39
|
include Frontapp::Client::Topics
|
40
|
+
include Frontapp::Client::Links
|
37
41
|
include Frontapp::Client::Exports
|
38
42
|
|
39
43
|
def initialize(options={})
|
@@ -75,7 +79,7 @@ module Frontapp
|
|
75
79
|
end
|
76
80
|
JSON.parse(res.to_s)
|
77
81
|
end
|
78
|
-
|
82
|
+
|
79
83
|
def get_plain(path)
|
80
84
|
headers_copy = @headers.dup
|
81
85
|
res = @headers.accept("text/plain").get("#{base_url}#{path}")
|
@@ -85,6 +89,15 @@ module Frontapp
|
|
85
89
|
res.to_s
|
86
90
|
end
|
87
91
|
|
92
|
+
def get_raw(path)
|
93
|
+
headers_copy = @headers.dup
|
94
|
+
res = @headers.get("#{base_url}#{path}")
|
95
|
+
if !res.status.success?
|
96
|
+
raise Error.from_response(res)
|
97
|
+
end
|
98
|
+
res
|
99
|
+
end
|
100
|
+
|
88
101
|
def create(path, body)
|
89
102
|
res = @headers.post("#{base_url}#{path}", json: body)
|
90
103
|
response = JSON.parse(res.to_s)
|
data/lib/frontapp/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.12
|
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
|
@@ -82,6 +83,7 @@ files:
|
|
82
83
|
- lib/frontapp/client/events.rb
|
83
84
|
- lib/frontapp/client/exports.rb
|
84
85
|
- lib/frontapp/client/inboxes.rb
|
86
|
+
- lib/frontapp/client/links.rb
|
85
87
|
- lib/frontapp/client/messages.rb
|
86
88
|
- lib/frontapp/client/rules.rb
|
87
89
|
- lib/frontapp/client/tags.rb
|
@@ -110,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
112
|
- !ruby/object:Gem::Version
|
111
113
|
version: '0'
|
112
114
|
requirements: []
|
113
|
-
|
114
|
-
rubygems_version: 2.5.2.1
|
115
|
+
rubygems_version: 3.1.6
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: Ruby client for Frontapp API
|