artemis_api 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 4ebdb821d7dca5b2888ded8eeef552f22486a866
4
- data.tar.gz: f18fbf29bed0e7b67fda21717711edf85f253b53
3
+ metadata.gz: 32db9ba97ad1d05952feab8c6bd9b4ee8de457ba
4
+ data.tar.gz: 51c060027ec42f376727b5306458757050fefbec
5
5
  SHA512:
6
- metadata.gz: 4d7baf2ba2584ccd7ce8f53f84fd5e0611b5d31fa70eea2a1f8207c6bf8b614a8325cd6e39bc50530ae2a6eacc207f1f3edb92f8112a6024b99a572d750e7761
7
- data.tar.gz: b7f58a2902751e5e86319e489fb6aece341e139c02cb441252a40b0181d37dc86d2eaf5e92c5e0c0de039a626dc8e3fad82b31e05ad909767e88af73ae98b8fa
6
+ metadata.gz: 68232ded4b5b706fd7ddcc3be017a7d054063df9af3090447449833d5eb16177da445c863eeac10153cc7b98d168fdbb7c9a23877eaf73c4cee222f38c2a8039
7
+ data.tar.gz: cc72bb823a05f33d8cbda6e231464aee7ed1f3555016c60952fcaeaeb9fc8c956e0d18b840a1b79fd057be6f0884002a71be9c61dc0391dc007c90de0a0f16ae
data/History.txt CHANGED
@@ -1,8 +1,12 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 0.2.0 / 2019-10-24
4
+
5
+ * Added the ability to delete Subscriptions
6
+
3
7
  === 0.1.0 / 2019-10-03
4
8
 
5
9
  * Initial public release of the Artemis API wrapper
6
10
 
7
11
  Includes initial support for the following Artemis classes:
8
- User, Facility, Organization, Batch, Zone, Completion, Harvest, Discard, HarvestUnit, SeedingUnit
12
+ User, Facility, Organization, Batch, Zone, Completion, Harvest, Discard, HarvestUnit, SeedingUnit, Item, Subscription
Binary file
@@ -74,6 +74,10 @@ module ArtemisApi
74
74
  @objects[type]&.[](id.to_i)
75
75
  end
76
76
 
77
+ def remove_record(type, id)
78
+ @objects[type].delete(id.to_i)
79
+ end
80
+
77
81
  def refresh
78
82
  @oauth_token = @oauth_token.refresh!
79
83
  end
@@ -20,5 +20,14 @@ module ArtemisApi
20
20
 
21
21
  response.status == 200 ? client.process_response(response, 'subscriptions') : false
22
22
  end
23
+
24
+ def self.delete(id:, facility_id:, client:)
25
+ client.oauth_token.refresh! if client.oauth_token.expired?
26
+
27
+ url = "#{client.options[:base_uri]}/api/v3/facilities/#{facility_id}/subscriptions/#{id}"
28
+
29
+ response = client.oauth_token.delete(url)
30
+ client.remove_record('subscriptions', id) if response.status == 204
31
+ end
23
32
  end
24
33
  end
@@ -1,3 +1,3 @@
1
1
  module ArtemisApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artemis_api
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
  - Jamey Hampton
@@ -110,6 +110,7 @@ files:
110
110
  - LICENSE.txt
111
111
  - README.md
112
112
  - Rakefile
113
+ - artemis_api-0.1.0.gem
113
114
  - artemis_api.gemspec
114
115
  - bin/console
115
116
  - bin/setup