socialfred 0.2.0 → 0.2.1
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/socialfred/social_posts.rb +8 -4
- data/lib/socialfred/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdf0d16bc214f06cf82bbece379057ab5027a2b4332cff4bf54f967f8e93a1e8
|
4
|
+
data.tar.gz: 5d53c8d181642879d89ce77d72bae239522880cf1d3904fa4f9587c0dad841c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec533b07db247b4c2d720b2b66f7c7fa0ee58284670126f5e50d30a9e261e0dcba1f161e0bea18f5b90f9f4476f3a5618b4aa5e4ade24d4365135281d2c9bf41
|
7
|
+
data.tar.gz: 857112d106a002a7315ed12018e8bab8a0e3af96e461abcba9c69b004cfb1e19b32c0053e0d93fea49f04e91e7ccb1e7e3191f42faa690e339bf221f457d011c
|
data/Gemfile.lock
CHANGED
@@ -32,7 +32,10 @@ module Socialfred
|
|
32
32
|
def create(publish_at: nil, text:, images: nil, options: nil)
|
33
33
|
publish_at = Time.parse(publish_at.to_s).iso8601 if publish_at
|
34
34
|
parameters = { social_post: { published_at: publish_at, text: text, images: images, options: options }.compact }
|
35
|
-
response = conn.post(ENDPOINT
|
35
|
+
response = conn.post(ENDPOINT) do |req|
|
36
|
+
req.headers[:content_type] = 'application/json'
|
37
|
+
req.body = JSON.generate(parameters)
|
38
|
+
end
|
36
39
|
|
37
40
|
raise Socialfred::Error unless response.status == 200
|
38
41
|
|
@@ -42,7 +45,10 @@ module Socialfred
|
|
42
45
|
def update(social_post_id, publish_at: nil, text:, images: nil, options: nil)
|
43
46
|
publish_at = Time.parse(publish_at.to_s).iso8601 if publish_at
|
44
47
|
parameters = { social_post: { published_at: publish_at, text: text, images: images, options: options }.compact }
|
45
|
-
response = conn.put(ENDPOINT + "/#{social_post_id}"
|
48
|
+
response = conn.put(ENDPOINT + "/#{social_post_id}") do |req|
|
49
|
+
req.headers[:content_type] = 'application/json'
|
50
|
+
req.body = JSON.generate(parameters)
|
51
|
+
end
|
46
52
|
|
47
53
|
raise Socialfred::Error unless response.status == 200
|
48
54
|
|
@@ -61,8 +67,6 @@ module Socialfred
|
|
61
67
|
|
62
68
|
def conn
|
63
69
|
@conn ||= Faraday.new(url: api_url) do |faraday|
|
64
|
-
faraday.request :multipart
|
65
|
-
faraday.request :url_encoded
|
66
70
|
faraday.adapter Faraday.default_adapter
|
67
71
|
faraday.headers['Api-Key'] = api_key
|
68
72
|
end
|
data/lib/socialfred/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialfred
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Krasnoperov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|