socialfred 0.2.3 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca6fb91232f5dac4b42a2b06b16ba6df4fae263e2c514f2d70d57ffe4f19bfbb
4
- data.tar.gz: dee8f2c59bbb32bcf8011d0295d6559503ff12f33c364ccca945325a3b27861c
3
+ metadata.gz: bf0f7c212bcfde1137b710b1555eae73ac0fd25a6551d98401820693456576d0
4
+ data.tar.gz: eae0c693bcbc04d4ba0d92914c5bfb8662194932435aea0b64a6118a42660a51
5
5
  SHA512:
6
- metadata.gz: c237e66fee876ddeff3c1c2c8b5725d9262e92cd6bcd653e7c2141d1fd51b49f77ddc34a49eff6aea99f682c43f323c1abfa476618d56e41f17a22f2453e3caa
7
- data.tar.gz: 8575e1944034484d44d90fc3708c62492f4a2351d6c025e7b035a3611846856db70f7c1ee997a8bc237d20f88a7929123fc50b741571dd35bcf83fd9d1c32316
6
+ metadata.gz: e15d2266d35b8eff226eecfb951ec306a21ba7715abeab6838fa46778eaa5d59f1c65b0456fb7ceb3f003f22034b365c2d7c4d678a3a4d8f76c9c62e87296ba2
7
+ data.tar.gz: 4060f94ec07eb8fa953442dc76e12157afa1977c8d87ac76c0a58f5818c3e591ee343a6ca8a6c4421a591b064583f5413ee8afd7fb8ccf543c14ebeda9d252f0
@@ -12,3 +12,33 @@ Metrics/BlockLength:
12
12
  Exclude:
13
13
  - 'spec/**/*'
14
14
  - '**/*.gemspec'
15
+
16
+ ### DEFAULT RULES
17
+ Layout/EmptyLinesAroundAttributeAccessor:
18
+ Enabled: true
19
+ Layout/SpaceAroundMethodCallOperator:
20
+ Enabled: true
21
+ Lint/DeprecatedOpenSSLConstant:
22
+ Enabled: true
23
+ Lint/MixedRegexpCaptureTypes:
24
+ Enabled: true
25
+ Lint/RaiseException:
26
+ Enabled: true
27
+ Lint/StructNewOverride:
28
+ Enabled: true
29
+ Style/ExponentialNotation:
30
+ Enabled: true
31
+ Style/HashEachMethods:
32
+ Enabled: true
33
+ Style/HashTransformKeys:
34
+ Enabled: true
35
+ Style/HashTransformValues:
36
+ Enabled: true
37
+ Style/RedundantFetchBlock:
38
+ Enabled: true
39
+ Style/RedundantRegexpCharacterClass:
40
+ Enabled: true
41
+ Style/RedundantRegexpEscape:
42
+ Enabled: true
43
+ Style/SlicingWithRange:
44
+ Enabled: true
@@ -1,25 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- socialfred (0.2.3)
4
+ socialfred (1.0.0)
5
5
  faraday (>= 0.9.0)
6
6
  json (~> 2.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.0)
11
+ ast (2.4.1)
12
12
  diff-lcs (1.3)
13
- faraday (0.17.0)
13
+ faraday (1.0.1)
14
14
  multipart-post (>= 1.2, < 3)
15
- jaro_winkler (1.5.4)
16
- json (2.2.0)
15
+ json (2.3.1)
17
16
  multipart-post (2.1.1)
18
- parallel (1.18.0)
19
- parser (2.6.5.0)
20
- ast (~> 2.4.0)
17
+ parallel (1.19.2)
18
+ parser (2.7.1.4)
19
+ ast (~> 2.4.1)
21
20
  rainbow (3.0.0)
22
- rake (10.5.0)
21
+ rake (13.0.1)
22
+ regexp_parser (1.7.1)
23
+ rexml (3.2.4)
23
24
  rspec (3.9.0)
24
25
  rspec-core (~> 3.9.0)
25
26
  rspec-expectations (~> 3.9.0)
@@ -33,19 +34,23 @@ GEM
33
34
  diff-lcs (>= 1.2.0, < 2.0)
34
35
  rspec-support (~> 3.9.0)
35
36
  rspec-support (3.9.0)
36
- rubocop (0.74.0)
37
- jaro_winkler (~> 1.5.1)
37
+ rubocop (0.86.0)
38
38
  parallel (~> 1.10)
39
- parser (>= 2.6)
39
+ parser (>= 2.7.0.1)
40
40
  rainbow (>= 2.2.2, < 4.0)
41
+ regexp_parser (>= 1.7)
42
+ rexml
43
+ rubocop-ast (>= 0.0.3, < 1.0)
41
44
  ruby-progressbar (~> 1.7)
42
- unicode-display_width (>= 1.4.0, < 1.7)
43
- rubocop-performance (1.5.0)
45
+ unicode-display_width (>= 1.4.0, < 2.0)
46
+ rubocop-ast (0.1.0)
47
+ parser (>= 2.7.0.1)
48
+ rubocop-performance (1.6.1)
44
49
  rubocop (>= 0.71.0)
45
- rubocop-rspec (1.36.0)
50
+ rubocop-rspec (1.40.0)
46
51
  rubocop (>= 0.68.1)
47
52
  ruby-progressbar (1.10.1)
48
- unicode-display_width (1.6.0)
53
+ unicode-display_width (1.7.0)
49
54
  vcr (5.0.0)
50
55
 
51
56
  PLATFORMS
@@ -53,13 +58,13 @@ PLATFORMS
53
58
 
54
59
  DEPENDENCIES
55
60
  bundler (~> 2.0)
56
- rake (~> 10.0)
61
+ rake (~> 13.0)
57
62
  rspec (~> 3.0)
58
- rubocop (= 0.74)
59
- rubocop-performance (~> 1.5)
60
- rubocop-rspec (~> 1.36)
63
+ rubocop (~> 0.86.0)
64
+ rubocop-performance (~> 1.6.1)
65
+ rubocop-rspec (~> 1.40.0)
61
66
  socialfred!
62
67
  vcr (~> 5.0)
63
68
 
64
69
  BUNDLED WITH
65
- 2.0.2
70
+ 2.1.2
data/README.md CHANGED
@@ -33,7 +33,7 @@ api = Socialfred::Api.new(api_key)
33
33
  ```ruby
34
34
  image1 = {data: Base64.encode64(image.download), filename: 'image.jpeg', content_type: 'image/jpeg'}
35
35
  # ...
36
- api.social_posts.create(
36
+ api.publications.create(
37
37
  publish_at: Time.now,
38
38
  text: "example text",
39
39
  images: [image1, image2],
@@ -56,7 +56,7 @@ Response:
56
56
  {
57
57
  'data' => {
58
58
  'id' => '99',
59
- 'type' => 'social_post',
59
+ 'type' => 'publication',
60
60
  'attributes' => {
61
61
  'text' => 'example text',
62
62
  'created_at' => '2019-10-30T23:54:12.147+01:00',
@@ -71,7 +71,7 @@ Response:
71
71
  #### Update a social post
72
72
 
73
73
  ```ruby
74
- api.social_posts.update(99, text: 'another text')
74
+ api.publications.update(99, text: 'another text')
75
75
  ```
76
76
 
77
77
  Response:
@@ -80,7 +80,7 @@ Response:
80
80
  {
81
81
  'data' => {
82
82
  'id' => '99',
83
- 'type' => 'social_post',
83
+ 'type' => 'publication',
84
84
  'attributes' => {
85
85
  'text' => 'another text',
86
86
  'created_at' => '2019-10-30T23:54:12.147+01:00',
@@ -95,7 +95,7 @@ Response:
95
95
  #### Destroy a social post
96
96
 
97
97
  ```ruby
98
- api.social_posts.destroy(99)
98
+ api.publications.destroy(99)
99
99
  ```
100
100
 
101
101
  Response:
@@ -104,7 +104,7 @@ Response:
104
104
  {
105
105
  'data' => {
106
106
  'id' => '99',
107
- 'type' => 'social_post',
107
+ 'type' => 'publication',
108
108
  'attributes' => {
109
109
  'text' => 'another text',
110
110
  'created_at' => '2019-10-30T23:54:12.147+01:00',
@@ -119,7 +119,7 @@ Response:
119
119
  #### List all social posts
120
120
 
121
121
  ```ruby
122
- api.social_posts.all(page: 1, per_page: 10)
122
+ api.publications.all(page: 1, per_page: 10)
123
123
  ```
124
124
 
125
125
  Response:
@@ -129,7 +129,7 @@ Response:
129
129
  'data' => [
130
130
  {
131
131
  'id' => '98',
132
- 'type' => 'social_post',
132
+ 'type' => 'publication',
133
133
  'attributes' => {
134
134
  'text' => 'test1',
135
135
  'created_at' => '2019-10-30T20:54:14.960+01:00',
@@ -141,7 +141,7 @@ Response:
141
141
  # ...
142
142
  {
143
143
  'id' => '95',
144
- 'type' => 'social_post',
144
+ 'type' => 'publication',
145
145
  'attributes' => {
146
146
  'text' => 'test2',
147
147
  'created_at' => '2019-10-29T22:46:35.857+01:00',
@@ -152,9 +152,9 @@ Response:
152
152
  }
153
153
  ],
154
154
  'links' => {
155
- 'first' => 'https://socialfred.com/api/social_posts?page=1&per_page=10',
156
- 'last' => 'https://socialfred.com/api/social_posts?page=26&per_page=10',
157
- 'next' => 'https://socialfred.com/api/social_posts?page=2&per_page=10'
155
+ 'first' => 'https://api.socialfred.com/publications?page=1&per_page=10',
156
+ 'last' => 'https://api.socialfred.com/publications?page=26&per_page=10',
157
+ 'next' => 'https://api.socialfred.com/publications?page=2&per_page=10'
158
158
  },
159
159
  'meta' => { 'total' => 51 }
160
160
  }
@@ -163,7 +163,7 @@ Response:
163
163
  #### Find one social post
164
164
 
165
165
  ```ruby
166
- api.social_posts.find(95)
166
+ api.publications.find(95)
167
167
  ```
168
168
 
169
169
  Response:
@@ -172,7 +172,7 @@ Response:
172
172
  {
173
173
  'data' => {
174
174
  'id' => '95',
175
- 'type' => 'social_post',
175
+ 'type' => 'publication',
176
176
  'attributes' => {
177
177
  'text' => 'test2',
178
178
  'created_at' => '2019-10-29T22:46:35.857+01:00',
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'socialfred/social_posts'
3
+ require 'socialfred/publications'
4
4
 
5
5
  module Socialfred
6
6
  class Api
7
7
  attr_reader :api_key, :api_url
8
8
 
9
- API_URL = 'https://app.socialfred.com/api/'
9
+ API_URL = 'https://api.socialfred.com/'
10
10
 
11
11
  def initialize(api_key, api_url: API_URL)
12
12
  @api_key = api_key
13
13
  @api_url = api_url
14
14
  end
15
15
 
16
- def social_posts
17
- @social_posts ||= SocialPosts.new(api_key, api_url: api_url)
16
+ def publications
17
+ @publications ||= Publications.new(api_key, api_url: api_url)
18
18
  end
19
19
  end
20
20
  end
@@ -4,10 +4,10 @@ require 'socialfred/requester'
4
4
  require 'time'
5
5
 
6
6
  module Socialfred
7
- class SocialPosts
7
+ class Publications
8
8
  attr_reader :api_key, :api_url
9
9
 
10
- ENDPOINT = 'social_posts'
10
+ ENDPOINT = 'publications'
11
11
 
12
12
  def initialize(api_key, api_url:)
13
13
  @api_key = api_key
@@ -22,8 +22,8 @@ module Socialfred
22
22
  JSON.parse(response.body)
23
23
  end
24
24
 
25
- def find(social_post_id)
26
- response = requester.get(ENDPOINT + "/#{social_post_id}")
25
+ def find(publication_id)
26
+ response = requester.get(ENDPOINT + "/#{publication_id}")
27
27
 
28
28
  raise Socialfred::Error unless response.status == 200
29
29
 
@@ -34,28 +34,28 @@ module Socialfred
34
34
  check_images(images) if images
35
35
 
36
36
  publish_at = Time.parse(publish_at.to_s).iso8601 if publish_at
37
- parameters = { social_post: { published_at: publish_at, text: text, images: images, options: options }.compact }
37
+ parameters = { publication: { published_at: publish_at, text: text, images: images, options: options }.compact }
38
38
  response = requester.post(ENDPOINT, parameters)
39
39
 
40
- raise Socialfred::Error unless response.status == 200
40
+ raise Socialfred::Error, response.body unless response.status == 200
41
41
 
42
42
  JSON.parse(response.body)
43
43
  end
44
44
 
45
- def update(social_post_id, publish_at: nil, text: nil, images: nil, options: nil)
45
+ def update(publication_id, publish_at: nil, text: nil, images: nil, options: nil)
46
46
  check_images(images) if images
47
47
 
48
48
  publish_at = Time.parse(publish_at.to_s).iso8601 if publish_at
49
- parameters = { social_post: { published_at: publish_at, text: text, images: images, options: options }.compact }
50
- response = requester.put(ENDPOINT + "/#{social_post_id}", parameters)
49
+ parameters = { publication: { published_at: publish_at, text: text, images: images, options: options }.compact }
50
+ response = requester.put(ENDPOINT + "/#{publication_id}", parameters)
51
51
 
52
52
  raise Socialfred::Error unless response.status == 200
53
53
 
54
54
  JSON.parse(response.body)
55
55
  end
56
56
 
57
- def destroy(social_post_id)
58
- response = requester.delete(ENDPOINT + "/#{social_post_id}")
57
+ def destroy(publication_id)
58
+ response = requester.delete(ENDPOINT + "/#{publication_id}")
59
59
 
60
60
  raise Socialfred::Error unless response.status == 200
61
61
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Socialfred
4
- VERSION = '0.2.3'
4
+ VERSION = '1.0.0'
5
5
  end
@@ -32,10 +32,10 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency 'json', '~> 2.2'
33
33
 
34
34
  spec.add_development_dependency 'bundler', '~> 2.0'
35
- spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rake', '~> 13.0'
36
36
  spec.add_development_dependency 'rspec', '~> 3.0'
37
- spec.add_development_dependency 'rubocop', '0.74'
38
- spec.add_development_dependency 'rubocop-performance', '~> 1.5'
39
- spec.add_development_dependency 'rubocop-rspec', '~> 1.36'
37
+ spec.add_development_dependency 'rubocop', '~> 0.86.0'
38
+ spec.add_development_dependency 'rubocop-performance', '~> 1.6.1'
39
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.40.0'
40
40
  spec.add_development_dependency 'vcr', '~> 5.0'
41
41
  end
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.3
4
+ version: 1.0.0
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-06 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,44 +84,44 @@ dependencies:
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.74'
89
+ version: 0.86.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.74'
96
+ version: 0.86.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop-performance
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.5'
103
+ version: 1.6.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.5'
110
+ version: 1.6.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.36'
117
+ version: 1.40.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.36'
124
+ version: 1.40.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: vcr
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -157,8 +157,8 @@ files:
157
157
  - bin/setup
158
158
  - lib/socialfred.rb
159
159
  - lib/socialfred/api.rb
160
+ - lib/socialfred/publications.rb
160
161
  - lib/socialfred/requester.rb
161
- - lib/socialfred/social_posts.rb
162
162
  - lib/socialfred/version.rb
163
163
  - socialfred.gemspec
164
164
  homepage: https://github.com/socialfred/socialfred
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubygems_version: 3.0.3
186
+ rubygems_version: 3.1.2
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Social Fred API Client