onepost 0.1.2 → 0.1.3
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/README.md +6 -5
- data/lib/onepost.rb +1 -0
- data/lib/onepost/client.rb +1 -0
- data/lib/onepost/image.rb +91 -0
- data/lib/onepost/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d50e9ee7f37914f1d9538bab2fc8f97a9dcb06dbf819de10fb6d75442a94fd5
|
4
|
+
data.tar.gz: 031a1a1878c40b79d2158502d6e2e2cb7d4bfe409ebca5a1536b7101f0f9a6fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b13b487d982ffb7692bf283767fb61f314cca3e1485822ef607bd817dad59eb799e4f6cd376705985b92bd9354363327a3c645515a3e0be49ee2c3f0b04f834f
|
7
|
+
data.tar.gz: 2159bef356cd8e3e8248fbe81d9fd9617c1750c7bfd008390c59954518e0849fc746fbc6d1b25a5a29fc4acce7e354d892aa37b5943247ce10ce47cc0c09c127
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Use OnePost to quickly integrate your application with Twitter, Facebook, and In
|
|
8
8
|
2. Then, use OnePost to allow your application's users to log in to each service through their web browser, thereby giving your application permission to post on their behalf.
|
9
9
|
3. Finally, post to one (or many) social pages owned by the user with a single API call. Use OnePost to track the performance of each post over time.
|
10
10
|
|
11
|
-
Learn more at [https://www.getonepost.com/](https://www.getonepost.com/).
|
11
|
+
Learn more at [https://www.getonepost.com/](https://www.getonepost.com/). If you're building a web application using OnePost then check out [OnepostUI](https://github.com/akdarrah/onepost-ui).
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -95,7 +95,7 @@ In your web browser, navigate to the `url` value. You will be prompted to log in
|
|
95
95
|
|
96
96
|
<img width="1000" alt="twitter-browser" src="https://user-images.githubusercontent.com/69064/108530520-aea1b100-72a3-11eb-94f8-123e9e256e44.png">
|
97
97
|
|
98
|
-
Once you've authorized your Twitter account, the Authorization record is available on the OnePost API. (Note: In addition to finding the `Authorization` record via the API, look for the `
|
98
|
+
Once you've authorized your Twitter account, the Authorization record is available on the OnePost API. (Note: In addition to finding the `Authorization` record via the API, look for the `authorization_id`, `provider_Id`, and `public_key` GET parameter values in the request sent to your `callback_url`)
|
99
99
|
|
100
100
|
```ruby
|
101
101
|
client.get_authorizations
|
@@ -178,8 +178,9 @@ At the time of writing, OnePost has just a handful of events (check back later f
|
|
178
178
|
|
179
179
|
Name | Description
|
180
180
|
------------ | -------------
|
181
|
+
authorized_page.authorized | Created automatically when a new AuthorizedPage is "touched" (after a user signs in to the provider to allow access)
|
181
182
|
events.test | Created manually by the API user to test Webhook endpoints are configured correctly
|
182
|
-
|
183
|
+
post.published | Created automatically when a Post has successfully posted to all AuthorizedPages (i.e. All SocialPosts have a state of "sent")
|
183
184
|
social_post.updated | Created automatically for each SocialPost after a Post has been published. Listen for this event if you want to track performance (such as number of likes, retweets, etc).
|
184
185
|
|
185
186
|
### Reference
|
@@ -204,7 +205,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
204
205
|
|
205
206
|
## Contributing
|
206
207
|
|
207
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
208
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/akdarrah/onepost-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/akdarrah/onepost-gem/blob/master/CODE_OF_CONDUCT.md).
|
208
209
|
|
209
210
|
|
210
211
|
## License
|
@@ -213,4 +214,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
213
214
|
|
214
215
|
## Code of Conduct
|
215
216
|
|
216
|
-
Everyone interacting in the Onepost project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
217
|
+
Everyone interacting in the Onepost project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/akdarrah/onepost-gem/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/onepost.rb
CHANGED
data/lib/onepost/client.rb
CHANGED
@@ -0,0 +1,91 @@
|
|
1
|
+
module Onepost
|
2
|
+
module Image
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
def get_images(options={})
|
7
|
+
url = construct_url("api/v1/images")
|
8
|
+
query = default_query.merge(options.fetch(:query, {}))
|
9
|
+
body = default_body.merge(options.fetch(:body, {}))
|
10
|
+
headers = default_headers.merge(options.fetch(:headers, {}))
|
11
|
+
|
12
|
+
response = HTTParty.get(url, {
|
13
|
+
query: query,
|
14
|
+
body: body.to_json,
|
15
|
+
headers: headers,
|
16
|
+
timeout: Onepost::Client::TIMEOUT
|
17
|
+
})
|
18
|
+
|
19
|
+
JSON.parse(response.body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_image(id, options={})
|
23
|
+
url = construct_url("api/v1/images/#{id}")
|
24
|
+
query = default_query.merge(options.fetch(:query, {}))
|
25
|
+
body = default_body.merge(options.fetch(:body, {}))
|
26
|
+
headers = default_headers.merge(options.fetch(:headers, {}))
|
27
|
+
|
28
|
+
response = HTTParty.get(url, {
|
29
|
+
query: query,
|
30
|
+
body: body.to_json,
|
31
|
+
headers: headers,
|
32
|
+
timeout: Onepost::Client::TIMEOUT
|
33
|
+
})
|
34
|
+
|
35
|
+
JSON.parse(response.body)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_image(options={})
|
39
|
+
url = construct_url("api/v1/images")
|
40
|
+
query = default_query.merge(options.fetch(:query, {}))
|
41
|
+
body = default_body.merge(options.fetch(:body, {}))
|
42
|
+
headers = default_headers.merge(options.fetch(:headers, {}))
|
43
|
+
|
44
|
+
if headers["Content-Type"] == Onepost::Client::JSON_CONTENT_TYPE
|
45
|
+
body = body.to_json
|
46
|
+
end
|
47
|
+
|
48
|
+
response = HTTParty.post(url, {
|
49
|
+
query: query,
|
50
|
+
body: body,
|
51
|
+
headers: headers,
|
52
|
+
timeout: Onepost::Client::TIMEOUT
|
53
|
+
})
|
54
|
+
|
55
|
+
JSON.parse(response.body)
|
56
|
+
end
|
57
|
+
|
58
|
+
def update_image(id, options={})
|
59
|
+
url = construct_url("api/v1/images/#{id}")
|
60
|
+
query = default_query.merge(options.fetch(:query, {}))
|
61
|
+
body = default_body.merge(options.fetch(:body, {}))
|
62
|
+
headers = default_headers.merge(options.fetch(:headers, {}))
|
63
|
+
|
64
|
+
response = HTTParty.put(url, {
|
65
|
+
query: query,
|
66
|
+
body: body.to_json,
|
67
|
+
headers: headers,
|
68
|
+
timeout: Onepost::Client::TIMEOUT
|
69
|
+
})
|
70
|
+
|
71
|
+
JSON.parse(response.body)
|
72
|
+
end
|
73
|
+
|
74
|
+
def delete_image(id, options={})
|
75
|
+
url = construct_url("api/v1/images/#{id}")
|
76
|
+
query = default_query.merge(options.fetch(:query, {}))
|
77
|
+
body = default_body.merge(options.fetch(:body, {}))
|
78
|
+
headers = default_headers.merge(options.fetch(:headers, {}))
|
79
|
+
|
80
|
+
response = HTTParty.delete(url, {
|
81
|
+
query: query,
|
82
|
+
body: body.to_json,
|
83
|
+
headers: headers,
|
84
|
+
timeout: Onepost::Client::TIMEOUT
|
85
|
+
})
|
86
|
+
|
87
|
+
JSON.parse(response.body)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/lib/onepost/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onepost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Darrah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/onepost/authorized_page.rb
|
89
89
|
- lib/onepost/client.rb
|
90
90
|
- lib/onepost/event.rb
|
91
|
+
- lib/onepost/image.rb
|
91
92
|
- lib/onepost/post.rb
|
92
93
|
- lib/onepost/post_intent.rb
|
93
94
|
- lib/onepost/provider.rb
|