circle_orbit 0.1.0 → 0.2.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: fb34d0a49d0faedec68de8090ca49b128254bb362e2ac3dd5766dd81f77078ee
4
- data.tar.gz: 3559155b79bdcfc9d0acdfad1d015afc9671defe748a2f1abbf2da41d126b8bb
3
+ metadata.gz: a94ea6cd860815ca30591d74789dbcd5c1e9cc2cd4466af456c7f2fe6ec221ee
4
+ data.tar.gz: dbd5fb0440033dc1ca083d158a04208cf01eb7b7376bddb0cddeefb021e768cc
5
5
  SHA512:
6
- metadata.gz: f8b7577ddd24e448ac577f9adfa4033749d7407ae72246de36db5ee90ffea1863d7adeb1dd8da444ac5178b728639cfb3a6b2a346446f326420847721c20637a
7
- data.tar.gz: 02ff348d42763b30afe08044b83c48d57784f5da42324f6556f99e105bcd176c5115aef722d7e0e319967d2671e5c0448aca76fec417aa3b273fa5ce55058d47
6
+ metadata.gz: dcc668b1f9ab4ad5b119ef7758ecc13edf53e76e3450c6e43ee99a902fff5d7f3552018ec4664c6f9d911159a1043cfd0518f7e81aa8ebf186434506210191fc
7
+ data.tar.gz: 7b6cb5980ef2ef663fe303214692e5c2ffc0aa2b848b9e4bec91cf3f505eb1147490cba24fbc26f1cf9cd7ba2ba4b9b7129c05e6a867c17a0a6143966a70bff3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circle_orbit (0.0.2)
4
+ circle_orbit (0.1.0)
5
5
  actionview (~> 6.1)
6
6
  activesupport (~> 6.1)
7
7
  dotenv (~> 2.7)
@@ -26,7 +26,7 @@ GEM
26
26
  minitest (>= 5.1)
27
27
  tzinfo (~> 2.0)
28
28
  zeitwerk (~> 2.3)
29
- addressable (2.7.0)
29
+ addressable (2.8.0)
30
30
  public_suffix (>= 2.0.2, < 5.0)
31
31
  ast (2.4.2)
32
32
  builder (3.2.4)
@@ -64,8 +64,6 @@ GEM
64
64
  minitest (5.14.4)
65
65
  nokogiri (1.11.7-arm64-darwin)
66
66
  racc (~> 1.4)
67
- nokogiri (1.11.7-x86_64-linux)
68
- racc (~> 1.4)
69
67
  orbit_activities (0.2.2)
70
68
  http (~> 4.4)
71
69
  json (~> 2.5)
@@ -82,7 +80,7 @@ GEM
82
80
  rails-html-sanitizer (1.3.0)
83
81
  loofah (~> 2.3)
84
82
  rainbow (3.0.0)
85
- rake (13.0.3)
83
+ rake (13.0.4)
86
84
  regexp_parser (2.1.1)
87
85
  rexml (3.2.5)
88
86
  rspec (3.10.0)
@@ -98,7 +96,7 @@ GEM
98
96
  diff-lcs (>= 1.2.0, < 2.0)
99
97
  rspec-support (~> 3.10.0)
100
98
  rspec-support (3.10.2)
101
- rubocop (1.18.0)
99
+ rubocop (1.18.3)
102
100
  parallel (~> 1.10)
103
101
  parser (>= 3.0.0.0)
104
102
  rainbow (>= 2.2.2, < 4.0)
@@ -125,7 +123,6 @@ GEM
125
123
 
126
124
  PLATFORMS
127
125
  arm64-darwin-20
128
- x86_64-linux
129
126
 
130
127
  DEPENDENCIES
131
128
  byebug
@@ -19,6 +19,7 @@ module CircleOrbit
19
19
 
20
20
  times = 0
21
21
  orbit_timestamp = last_orbit_activity_timestamp(type: "post")
22
+
22
23
  posts.each do |post|
23
24
  next if post.nil? || post.empty?
24
25
 
@@ -97,17 +98,30 @@ module CircleOrbit
97
98
  end
98
99
 
99
100
  def get_posts(id)
100
- url = URI("#{@circle_url}/api/v1/posts?community_id=#{@circle_community_id}&space_id=#{id}")
101
+ page = 1
102
+ posts = []
103
+ looped_at_least_once = false
101
104
 
102
- https = Net::HTTP.new(url.host, url.port)
103
- https.use_ssl = true
105
+ while page >= 1
106
+ page += 1 if looped_at_least_once
107
+ url = URI("#{@circle_url}/api/v1/posts?community_id=#{@circle_community_id}&space_id=#{id}&page=#{page}")
104
108
 
105
- request = Net::HTTP::Get.new(url)
106
- request["Authorization"] = "Token #{@circle_api_key}"
109
+ https = Net::HTTP.new(url.host, url.port)
110
+ https.use_ssl = true
107
111
 
108
- response = https.request(request)
112
+ request = Net::HTTP::Get.new(url)
113
+ request["Authorization"] = "Token #{@circle_api_key}"
109
114
 
110
- JSON.parse(response.body)
115
+ response = https.request(request)
116
+
117
+ response = JSON.parse(response.body)
118
+ posts << response unless response.empty? || response.nil?
119
+ looped_at_least_once = true
120
+
121
+ break if response.empty? || response.nil?
122
+ end
123
+
124
+ posts.flatten!
111
125
  end
112
126
 
113
127
  def get_comments
@@ -3,5 +3,5 @@
3
3
  # frozen_string_literal = true
4
4
 
5
5
  module CircleOrbit
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circle_orbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orbit DevRel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-30 00:00:00.000000000 Z
12
+ date: 2021-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview