latergram 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64001762488bc5f3690f25bbe9f17d5b90ecc1dddcf68abc36bad54e12133f62
4
- data.tar.gz: 5a16162eba4050ae1ab9937a56d19f478e1c9d29198252fe25875e78692b1756
3
+ metadata.gz: 3fb1550ff17123fe9cc2cd8d74e476bc1a5c45bec8addff05a08c050ef613943
4
+ data.tar.gz: bc64f1d3fdf9288c40a8767e8232c40bb59f76852cf4403f2200bf49342811e7
5
5
  SHA512:
6
- metadata.gz: 01ce88c3f1b39cf324626a1aa75347a8f3ad4eaaccdb495a36e51e17d614c1b6fd72ec158ed2748cee3412fa9750360fd8aae64a3bcf97169bea8a9cffda07df
7
- data.tar.gz: 01bc1ff85bdea9e02cbc141562112d0a3aa9307fa189f74be5de83fc186457aa73e98b1bb29e150e31ab29ed4e160db191cba5d51b9ee71b7a3aa55345feb134
6
+ metadata.gz: 399657da6ce215155543436cffe99650dc62c3f45db89c8a4fbd7488c5084eabf81ce6d48c616abfc4beac37214f96809755de361c6148413db862dadf611397
7
+ data.tar.gz: be2c0f7f61d5a97ef55557e6329777fb39845cc591d1880a70513d7d758c7d7dc06e42902af7511ff4c18078a92f7a9547c1c15105c698dab2f847e26431e9c5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- latergram (1.0.0)
4
+ latergram (1.0.1)
5
5
  faraday (>= 0.9.0)
6
6
  json (~> 2.2)
7
7
 
data/README.md CHANGED
@@ -26,12 +26,12 @@ Or install it yourself as:
26
26
  api = Latergram::Api.new(api_key)
27
27
  ```
28
28
 
29
- ### Social Posts
29
+ ### Publications
30
30
 
31
- #### Create a social post
31
+ #### Create a publication
32
32
 
33
33
  ```ruby
34
- api.social_posts.create(
34
+ api.publications.create(
35
35
  text: "example text",
36
36
  image_urls: [url1, url2]
37
37
  )
@@ -43,7 +43,7 @@ Response:
43
43
  {
44
44
  'data' => {
45
45
  'id' => '99',
46
- 'type' => 'social_post',
46
+ 'type' => 'publication',
47
47
  'attributes' => {
48
48
  'text' => 'example text',
49
49
  'created_at' => '2019-10-30T23:54:12.147+01:00',
@@ -55,10 +55,10 @@ Response:
55
55
  }
56
56
  ```
57
57
 
58
- #### Update a social post
58
+ #### Update a publication
59
59
 
60
60
  ```ruby
61
- api.social_posts.update(99, text: 'another text')
61
+ api.publications.update(99, text: 'another text')
62
62
  ```
63
63
 
64
64
  Response:
@@ -67,7 +67,7 @@ Response:
67
67
  {
68
68
  'data' => {
69
69
  'id' => '99',
70
- 'type' => 'social_post',
70
+ 'type' => 'publication',
71
71
  'attributes' => {
72
72
  'text' => 'another text',
73
73
  'created_at' => '2019-10-30T23:54:12.147+01:00',
@@ -79,10 +79,10 @@ Response:
79
79
  }
80
80
  ```
81
81
 
82
- #### Destroy a social post
82
+ #### Destroy a publication
83
83
 
84
84
  ```ruby
85
- api.social_posts.destroy(99)
85
+ api.publications.destroy(99)
86
86
  ```
87
87
 
88
88
  Response:
@@ -91,7 +91,7 @@ Response:
91
91
  {
92
92
  'data' => {
93
93
  'id' => '99',
94
- 'type' => 'social_post',
94
+ 'type' => 'publication',
95
95
  'attributes' => {
96
96
  'text' => 'another text',
97
97
  'created_at' => '2019-10-30T23:54:12.147+01:00',
@@ -103,10 +103,10 @@ Response:
103
103
  }
104
104
  ```
105
105
 
106
- #### List all social posts
106
+ #### List all publications
107
107
 
108
108
  ```ruby
109
- api.social_posts.all(page: 1, per_page: 10)
109
+ api.publications.all(page: 1, per_page: 10)
110
110
  ```
111
111
 
112
112
  Response:
@@ -116,7 +116,7 @@ Response:
116
116
  'data' => [
117
117
  {
118
118
  'id' => '98',
119
- 'type' => 'social_post',
119
+ 'type' => 'publication',
120
120
  'attributes' => {
121
121
  'text' => 'test1',
122
122
  'created_at' => '2019-10-30T20:54:14.960+01:00',
@@ -128,7 +128,7 @@ Response:
128
128
  # ...
129
129
  {
130
130
  'id' => '95',
131
- 'type' => 'social_post',
131
+ 'type' => 'publication',
132
132
  'attributes' => {
133
133
  'text' => 'test2',
134
134
  'created_at' => '2019-10-29T22:46:35.857+01:00',
@@ -139,18 +139,18 @@ Response:
139
139
  }
140
140
  ],
141
141
  'links' => {
142
- 'first' => 'http://localhost/api/social_posts?page=1&per_page=10',
143
- 'last' => 'http://localhost/api/social_posts?page=26&per_page=10',
144
- 'next' => 'http://localhost/api/social_posts?page=2&per_page=10'
142
+ 'first' => 'https://api.latergr.am/v1/publications?page=1&per_page=10',
143
+ 'last' => 'https://api.latergr.am/v1/publications?page=26&per_page=10',
144
+ 'next' => 'https://api.latergr.am/v1/publications?page=2&per_page=10'
145
145
  },
146
146
  'meta' => { 'total' => 51 }
147
147
  }
148
148
  ```
149
149
 
150
- #### Find one social post
150
+ #### Find one publication
151
151
 
152
152
  ```ruby
153
- api.social_posts.find(95)
153
+ api.publications.find(95)
154
154
  ```
155
155
 
156
156
  Response:
@@ -159,7 +159,7 @@ Response:
159
159
  {
160
160
  'data' => {
161
161
  'id' => '95',
162
- 'type' => 'social_post',
162
+ 'type' => 'publication',
163
163
  'attributes' => {
164
164
  'text' => 'test2',
165
165
  'created_at' => '2019-10-29T22:46:35.857+01:00',
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'latergram/social_posts'
3
+ require 'latergram/publications'
4
4
 
5
5
  module Latergram
6
6
  class Api
@@ -13,8 +13,8 @@ module Latergram
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 'latergram/requester'
4
4
  require 'time'
5
5
 
6
6
  module Latergram
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 Latergram
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 Latergram::Error, response.body unless response.status == 200
29
29
 
@@ -33,7 +33,7 @@ module Latergram
33
33
  def create(text:, image_urls: [])
34
34
  check_images(image_urls)
35
35
 
36
- parameters = { social_post: { text: text, image_urls: image_urls }.compact }
36
+ parameters = { publication: { text: text, image_urls: image_urls }.compact }
37
37
  response = requester.post(ENDPOINT, parameters)
38
38
 
39
39
  raise Latergram::Error, response.body unless response.status == 200
@@ -41,17 +41,17 @@ module Latergram
41
41
  JSON.parse(response.body)
42
42
  end
43
43
 
44
- def update(social_post_id, text: nil)
45
- parameters = { social_post: { text: text }.compact }
46
- response = requester.put(ENDPOINT + "/#{social_post_id}", parameters)
44
+ def update(publication_id, text: nil)
45
+ parameters = { publication: { text: text }.compact }
46
+ response = requester.put(ENDPOINT + "/#{publication_id}", parameters)
47
47
 
48
48
  raise Latergram::Error, response.body unless response.status == 200
49
49
 
50
50
  JSON.parse(response.body)
51
51
  end
52
52
 
53
- def destroy(social_post_id)
54
- response = requester.delete(ENDPOINT + "/#{social_post_id}")
53
+ def destroy(publication_id)
54
+ response = requester.delete(ENDPOINT + "/#{publication_id}")
55
55
 
56
56
  raise Latergram::Error, response.body unless response.status == 200
57
57
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Latergram
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latergram
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.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: 2020-02-01 00:00:00.000000000 Z
11
+ date: 2020-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -156,8 +156,8 @@ files:
156
156
  - latergram.gemspec
157
157
  - lib/latergram.rb
158
158
  - lib/latergram/api.rb
159
+ - lib/latergram/publications.rb
159
160
  - lib/latergram/requester.rb
160
- - lib/latergram/social_posts.rb
161
161
  - lib/latergram/version.rb
162
162
  homepage:
163
163
  licenses: