writeas 0.2.0 → 0.3.0
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/Gemfile.lock +1 -1
- data/lib/writeas/client.rb +31 -1
- data/lib/writeas/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f0316889070295b12bb3ab218941074b309d2fce0b824d4a6f1f60ca2b6ff2d
|
4
|
+
data.tar.gz: 250958c08e2dc85a16cd6e8740df66a5fe29d4742033775b2e0ae85da68d4852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3da9ca8be2b45661c5a088ab6019570bce7cb9ecca443714e693c95adc0110c52b6431eca171095548525f4afecb7db5eae960c7d8d11b0ab5d48c388459b859
|
7
|
+
data.tar.gz: 8daf937647c141b339527e80fcb72fb3ffb6bfe89eee421fc4d0b2d2e94ed2a4a9aee39d6cbf7ab5d8c723d69b3b0f847250d1a25586f4601692fbbabcfdb9d4
|
data/Gemfile.lock
CHANGED
data/lib/writeas/client.rb
CHANGED
@@ -66,7 +66,37 @@ module Writeas
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
|
69
|
+
def update_post(post_id:, body:, token:, title: nil, font: nil, lang: nil, rtl: nil)
|
70
|
+
request_body = {
|
71
|
+
body: body,
|
72
|
+
token: token,
|
73
|
+
title: title,
|
74
|
+
font: font,
|
75
|
+
lang: lang,
|
76
|
+
rtl: rtl
|
77
|
+
}
|
78
|
+
|
79
|
+
response = @conn.post("/api/posts/#{post_id}", request_body.to_json)
|
80
|
+
|
81
|
+
if error_response?(response)
|
82
|
+
raise ClientError.new(response.reason_phrase, response.status)
|
83
|
+
else
|
84
|
+
post = Writeas::Post.new(response.body)
|
85
|
+
return post
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def delete_post(post_id:, token:)
|
90
|
+
response = @conn.delete("/api/posts/#{post_id}", {token: token})
|
91
|
+
|
92
|
+
if error_response?(response)
|
93
|
+
raise ClientError.new(response.reason_phrase, response.status)
|
94
|
+
else
|
95
|
+
return true
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
70
100
|
|
71
101
|
def error_response?(response)
|
72
102
|
[400, 401, 403, 404, 405, 410, 429, 500, 502, 503].include? response.status
|
data/lib/writeas/version.rb
CHANGED