frontapp 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/frontapp/client.rb +14 -3
- data/lib/frontapp/client/messages.rb +11 -1
- data/lib/frontapp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0522968d2e8b1f97cb59f34f8a86022039a7e1
|
4
|
+
data.tar.gz: 013b5659e5bd3809db836ebac2c4ffd959cb2357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 481574973b11099d435743dc39422baf5f1dee01909a36c00e4ff151e2b36b49deb9656f8d574d666c2b1645e70e98f70a2075a360d52506d5c86a0fa3586095
|
7
|
+
data.tar.gz: ce86316658c5e5b4909641c5e0b48030edf75d26548d5e4ac68348a618c6f49c7fed54904376a22e60d6ee6f0040ea1e18ddee881d37c04c702ca2e0e2816b5b
|
data/lib/frontapp/client.rb
CHANGED
@@ -75,6 +75,15 @@ module Frontapp
|
|
75
75
|
end
|
76
76
|
JSON.parse(res.to_s)
|
77
77
|
end
|
78
|
+
|
79
|
+
def get_plain(path)
|
80
|
+
headers_copy = @headers.dup
|
81
|
+
res = @headers.accept("text/plain").get("#{base_url}#{path}")
|
82
|
+
if !res.status.success?
|
83
|
+
raise Error.from_response(res)
|
84
|
+
end
|
85
|
+
res.to_s
|
86
|
+
end
|
78
87
|
|
79
88
|
def create(path, body)
|
80
89
|
res = @headers.post("#{base_url}#{path}", json: body)
|
@@ -114,13 +123,15 @@ module Frontapp
|
|
114
123
|
res << q.map do |k, v|
|
115
124
|
case v
|
116
125
|
when Symbol, String
|
117
|
-
"q[#{k}]
|
126
|
+
"q[#{k}]=#{URI.encode(v)}"
|
118
127
|
when Array then
|
119
|
-
v.map { |c| "q[#{k}][]=#{URI.encode(c)}" }.join("&")
|
128
|
+
v.map { |c| "q[#{k}][]=#{URI.encode(c.to_s)}" }.join("&")
|
129
|
+
else
|
130
|
+
"q[#{k}]=#{URI.encode(v.to_s)}"
|
120
131
|
end
|
121
132
|
end
|
122
133
|
end
|
123
|
-
res << params.map {|k,v| "#{k}=#{URI.encode(v)}"}
|
134
|
+
res << params.map {|k,v| "#{k}=#{URI.encode(v.to_s)}"}
|
124
135
|
res.join("&")
|
125
136
|
end
|
126
137
|
|
@@ -10,7 +10,17 @@ module Frontapp
|
|
10
10
|
def get_message(message_id)
|
11
11
|
get("messages/#{message_id}")
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
|
+
# Parameters
|
15
|
+
# Name Type Description
|
16
|
+
# -------------------------------
|
17
|
+
# message_id string Id of the requested message
|
18
|
+
# -------------------------------
|
19
|
+
def get_message_source(message_id)
|
20
|
+
get_plain("messages/#{message_id}").b
|
21
|
+
# .b sets encoding to ASCII-8BIT, which is safer for raw emails than UTF-8
|
22
|
+
end
|
23
|
+
|
14
24
|
# Parameters
|
15
25
|
# Name Type Description
|
16
26
|
# -------------------------------
|
data/lib/frontapp/version.rb
CHANGED