planningcenter_orbit 0.0.1 → 0.0.2

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: 0cff67f2a9d1f77853c4b726045549eb0b6a767708c4edfe14422f9baa6f475a
4
- data.tar.gz: 43141d9e286837e7275cd021bbd873130123d92b4eabe95236e888d185e20be0
3
+ metadata.gz: '09bf43330f19510626739d4909cb24b419e3c2f24ac9fe100a3c17aa4771b6fc'
4
+ data.tar.gz: bffb2da031d7551ab624d3a24fa3d541d5bf2e6cefb329fe3b65d899dedde5ab
5
5
  SHA512:
6
- metadata.gz: 607e6155cc958936d0181a91ac49929afea8d98e1f813c7010c29277ec623c45401ddb4213bc08d053121e07bea9353de213bbce48498cc1160bb7f5e50e8cca
7
- data.tar.gz: 29a12b554def3403c5fbc237ee262471908e683c2f90384e68b6ee930a518871873c886c7cf925f6fe4511fa364b254f963177932681780ce3cac8eb23cab388
6
+ metadata.gz: c9259693c23dcb24479b021567dc8145fff8497bbd618e623dd4b40895486114f486b0afe5d95bcd2a39104b4e0f21e8e861024d8ded1bd67eaec00992f0bb24
7
+ data.tar.gz: f2c514c45f3cd941ff81f0e2aa744c67408eae5cc3e246b00833da18a78464b55584e6aaec8f88e5f26c54f0f9bf178bf94577d5d0f6f00186f604718e362361
data/Gemfile.lock CHANGED
@@ -6,14 +6,14 @@ PATH
6
6
  dotenv (~> 2.7)
7
7
  http (~> 4.4)
8
8
  json (~> 2.5)
9
- orbit_activities (~> 0.1)
9
+ orbit_activities (~> 0.2.2)
10
10
  thor (~> 1.1)
11
11
  zeitwerk (~> 2.4)
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (6.1.3.2)
16
+ activesupport (6.1.4)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
@@ -49,7 +49,7 @@ GEM
49
49
  concurrent-ruby (~> 1.0)
50
50
  json (2.5.1)
51
51
  minitest (5.14.4)
52
- orbit_activities (0.1.0)
52
+ orbit_activities (0.2.2)
53
53
  http (~> 4.4)
54
54
  json (~> 2.5)
55
55
  rake (~> 13.0)
@@ -24,7 +24,7 @@ module PlanningcenterOrbit
24
24
 
25
25
  times = 0
26
26
  checkins.each do |checkin|
27
- unless @historical_import
27
+ unless @historical_import && last_orbit_activity_timestamp
28
28
  next if checkin["attributes"]["created_at"] < last_orbit_activity_timestamp
29
29
  end
30
30
 
@@ -94,28 +94,13 @@ module PlanningcenterOrbit
94
94
 
95
95
  def last_orbit_activity_timestamp
96
96
  @last_orbit_activity_timestamp ||= begin
97
- url = URI("https://app.orbit.love/api/v1/#{@orbit_workspace}/activities")
98
- params = {
99
- items: 10,
100
- direction: "DESC",
101
- activity_type: "custom:planning_center:check_in"
102
- }
103
- url.query = URI.encode_www_form(params)
104
- http = Net::HTTP.new(url.host, url.port)
105
- http.use_ssl = true
106
- req = Net::HTTP::Get.new(url)
107
- req["Accept"] = "application/json"
108
- req["Content-Type"] = "application/json"
109
- req["Authorization"] = "Bearer #{@orbit_api_key}"
110
- req["User-Agent"] = "community-ruby-planningcenter-orbit/#{PlanningcenterOrbit::VERSION}"
111
-
112
- response = http.request(req)
113
-
114
- response = JSON.parse(response.body)
115
-
116
- return nil if response["data"].nil? || response["data"].empty?
117
-
118
- response["data"][0]["attributes"]["created_at"]
97
+ OrbitActivities::Request.new(
98
+ api_key: @orbit_api_key,
99
+ workspace_id: @orbit_workspace,
100
+ user_agent: "community-ruby-planningcenter-orbit/#{PlanningcenterOrbit::VERSION}",
101
+ action: "latest_activity_timestamp",
102
+ filters: { activity_type: "custom:planning_center:check_in" }
103
+ ).response
119
104
  end
120
105
  end
121
106
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlanningcenterOrbit
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "zeitwerk", "~> 2.4"
32
32
  spec.add_dependency "thor", "~> 1.1"
33
33
  spec.add_dependency "dotenv", "~> 2.7"
34
- spec.add_dependency "orbit_activities", "~> 0.1"
34
+ spec.add_dependency "orbit_activities", "~> 0.2.2"
35
35
  spec.add_dependency "activesupport", "~> 6.1"
36
36
  spec.add_development_dependency "rspec", "~> 3.4"
37
37
  spec.add_development_dependency "webmock", "~> 3.12"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planningcenter_orbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-24 00:00:00.000000000 Z
12
+ date: 2021-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0.1'
90
+ version: 0.2.2
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0.1'
97
+ version: 0.2.2
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: activesupport
100
100
  requirement: !ruby/object:Gem::Requirement