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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b149577bc4d28f5f06aa97dd1430d79d392c5a1a6e77c74e864194dc119280b
4
- data.tar.gz: ae78ddf716d616228a72b5fface990f9d966df17ec607f5326a971b5622ffe74
3
+ metadata.gz: 0d50e9ee7f37914f1d9538bab2fc8f97a9dcb06dbf819de10fb6d75442a94fd5
4
+ data.tar.gz: 031a1a1878c40b79d2158502d6e2e2cb7d4bfe409ebca5a1536b7101f0f9a6fe
5
5
  SHA512:
6
- metadata.gz: 4db4649e1992b3ccfc154c37616a115673e0046b2e391b242cd3a361b90a13eb191082d51ddedc47eaba24ffe0006779b93d4f1d14f55f7fd5c83bfefbeab104
7
- data.tar.gz: abb1cceb7228c4090b1dbca813bf67f6f40777c7ca76bf64945a4cad88b559f88bef200af6ed31cc77f67046573c83eac2e0d475c7a0c0e870d236d3377f769d
6
+ metadata.gz: b13b487d982ffb7692bf283767fb61f314cca3e1485822ef607bd817dad59eb799e4f6cd376705985b92bd9354363327a3c645515a3e0be49ee2c3f0b04f834f
7
+ data.tar.gz: 2159bef356cd8e3e8248fbe81d9fd9617c1750c7bfd008390c59954518e0849fc746fbc6d1b25a5a29fc4acce7e354d892aa37b5943247ce10ce47cc0c09c127
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- onepost (0.1.2)
4
+ onepost (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 `X-OnePost-Authorization-Id`, `X-OnePost-Provider-Id`, and `X-OnePost-Public-Key` header values in the request sent to your `callback_url`)
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
- authorized_page.created | Created automatically when a new AuthorizedPage is created (after an Authorization is created)
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/[USERNAME]/onepost. 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/[USERNAME]/onepost/blob/master/CODE_OF_CONDUCT.md).
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/[USERNAME]/onepost/blob/master/CODE_OF_CONDUCT.md).
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
@@ -11,5 +11,6 @@ require 'onepost/post_intent'
11
11
  require 'onepost/social_post'
12
12
  require 'onepost/webhook'
13
13
  require 'onepost/event'
14
+ require 'onepost/image'
14
15
 
15
16
  require "onepost/client"
@@ -8,6 +8,7 @@ module Onepost
8
8
  include Onepost::SocialPost
9
9
  include Onepost::Webhook
10
10
  include Onepost::Event
11
+ include Onepost::Image
11
12
 
12
13
  RAPID_API_HOST = "onepost1.p.rapidapi.com"
13
14
  TIMEOUT = 180
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Onepost
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-02 00:00:00.000000000 Z
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