open_recycling 0.0.6 → 0.0.8

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: ff2467ed1213baf30828c0cf72f12bb27b5727103181799938cbcde8ed1ac128
4
- data.tar.gz: ef8518d3d45ec28970fce71e1e64f1663afd791ffc81872e5b47ff54e3dabac1
3
+ metadata.gz: '09af4596cdb587c1566f7bdb898e5e06d5e607ca15f9ac9ef2b4513bf2d78dd7'
4
+ data.tar.gz: 21d2b70a241d24cdfb4a36add8aff87cd7c4b74163824aab82bb1e75e082e81d
5
5
  SHA512:
6
- metadata.gz: 9460ba7ad3456b2bdf7f9613238d94808fb0b7b08834b51044a2238aab0aec4368e1ff8719e2cf9a4e80a3d006d2d40213ed98e37fbc435e76734a179a4689cf
7
- data.tar.gz: 24dd2b69a059dbb3ba91ccc4df349d1d0052ef46fc03b26e51e2ba022fa6d2b064bb55227348a6ea15d1c9c1aa2fc2ccf098eca7f5128339ebb6f582ea12a7ab
6
+ metadata.gz: 0ff9a8f6c63696b855c7f5705a39ecb2225a99de77f1d28fdc20a25dcb6381e6b25e175376715d88ff8ec1ad42ad4bdc6db72af3117cefc7d42a84f4f09557fe
7
+ data.tar.gz: cb8ed806b75d424fe11811b478173c2911d6978430b321642bf917fdfca7a67f9d3b44cd2c00e28288ebd1961ebd551e1b647c253115ca639bde3e7fe68ae697
@@ -1,4 +1,5 @@
1
1
  require_relative "applications"
2
+ require_relative "webhooks"
2
3
 
3
4
  module OpenRecycling
4
5
  module Apps
@@ -10,6 +11,13 @@ module OpenRecycling
10
11
  )
11
12
  end
12
13
 
14
+ def webhooks
15
+ @webhooks ||= OpenRecycling::Org::Webhooks.new(
16
+ base_url: module_url,
17
+ jwt_token: jwt_token
18
+ )
19
+ end
20
+
13
21
  private
14
22
 
15
23
  def module_url
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenRecycling
4
+ module Org
5
+ class Webhooks < OpenRecycling::Resource
6
+ def initialize(base_url: nil, jwt_token: nil)
7
+ super(
8
+ root_node_singular: "webhook",
9
+ root_node_plural: "webhooks",
10
+ api_url: "#{base_url}/webhooks",
11
+ jwt_token: jwt_token
12
+ )
13
+ end
14
+ end
15
+ end
16
+ end
@@ -14,7 +14,7 @@ module OpenRecycling
14
14
  )
15
15
  end
16
16
 
17
- def create(file_path:, mime_type:, organization_id:)
17
+ def create(file_path:, mime_type:, organization_id:, issued_by_organization_id: nil)
18
18
  uri = URI(api_url)
19
19
 
20
20
  # Prepare the file and boundary
@@ -32,10 +32,18 @@ module OpenRecycling
32
32
 
33
33
  # Add the `upload[organizationId]` part
34
34
  post_body << "--#{boundary}\r\n"
35
- post_body << "Content-Disposition: form-data; name=\"upload[organizationId]\"\r\n\r\n"
35
+ post_body << "Content-Disposition: form-data; name=\"upload[issuedToOrganizationId]\"\r\n\r\n"
36
36
  post_body << organization_id.to_s
37
37
  post_body << "\r\n"
38
38
 
39
+ if issued_by_organization_id
40
+ # Add the `upload[issuedByOrganizationId]` part
41
+ post_body << "--#{boundary}\r\n"
42
+ post_body << "Content-Disposition: form-data; name=\"upload[issuedByOrganizationId]\"\r\n\r\n"
43
+ post_body << issued_by_organization_id.to_s
44
+ post_body << "\r\n"
45
+ end
46
+
39
47
  post_body << "--#{boundary}--\r\n"
40
48
 
41
49
  # Create and send the POST request
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenRecycling
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_recycling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Open Recycling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-14 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -45,6 +45,7 @@ files:
45
45
  - lib/open_recycling.rb
46
46
  - lib/open_recycling/apps/applications.rb
47
47
  - lib/open_recycling/apps/client.rb
48
+ - lib/open_recycling/apps/webhooks.rb
48
49
  - lib/open_recycling/client.rb
49
50
  - lib/open_recycling/client_error.rb
50
51
  - lib/open_recycling/core/client.rb