userlist 0.8.1 → 0.9.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
  SHA256:
3
- metadata.gz: 4d6e93ef4ff51c272a689c07261fd423941a7244bec1cedf84af7207cd702816
4
- data.tar.gz: 6c424b3183ec05af8a620dd39dea582bd097fc1514e800f8cd2b63aab342b90f
3
+ metadata.gz: 569696fa5acbb7f0c5520aff129c6418666e4006039e128dbbe97590a74d10ae
4
+ data.tar.gz: 73a0880766c7e8a17f9a0cae70eb07afdef8a202202f4ab17d4888d8e3ea459f
5
5
  SHA512:
6
- metadata.gz: f8ef2403697c2a9369f0b74737a5429cd0f650c4c22f1e09ab18d024dc7750622032077eb1fb392611ee1fa1907ea48b8e2d2aad2afbf6246fe3eb96c7f2fddd
7
- data.tar.gz: e2578be25dd0be0db2d721d900f14910f238a72554918319ecad8ba16d3fffaac5da982b6e4c306c4af6bc540f12baeea71c6e7a4e9a0c4418a150028cb38fee
6
+ metadata.gz: 9f63af4821d7d61af74c0c593ce97a597a6aa1c647b3d61b81fd69e9973daa4d9aedb6cc2a5744bb6fbae2170814e7955e3ff97b59a216146ecf1254be84cc35
7
+ data.tar.gz: 8ec2008d7bf08e60b0d4dc0f43586e9dc62a17dea20f8c704efd8d186236683c4b2a4fd624b99f839247ef22d255f23bf258282d7ea52e7cfe31bcf97171b556
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Userlist for Ruby Changelog
2
2
 
3
+ ## v0.9.0 (2024-03-19)
4
+
5
+ - Allows deleteing resources by using other identifiers (like email)
6
+ - Relaxes requirement for providing associations. Incomplete resources will not be pushed anyways.
7
+ - Improves checks for whether a resource is pushable or not
8
+ - Fixes a typo in the occurred_at attribute of events while maintaining backwards compatibility
9
+
3
10
  ## v0.8.1 (2023-11-30)
4
11
 
5
12
  - Fixes issue with customizability of push? and delete? methods on events and relationships
@@ -11,13 +11,6 @@ module Userlist
11
11
  has_many :relationships, type: 'Userlist::Push::Relationship', inverse: :company
12
12
  has_many :users, type: 'Userlist::Push::User'
13
13
  has_one :user, type: 'Userlist::Push::User'
14
-
15
- def initialize(payload = {}, config = Userlist.config)
16
- raise Userlist::ArgumentError, 'Missing required payload hash' unless payload
17
- raise Userlist::ArgumentError, 'Missing required parameter :identifier' unless payload[:identifier]
18
-
19
- super
20
- end
21
14
  end
22
15
  end
23
16
  end
@@ -9,17 +9,14 @@ module Userlist
9
9
  def initialize(payload = {}, config = Userlist.config)
10
10
  raise Userlist::ArgumentError, 'Missing required payload' unless payload
11
11
  raise Userlist::ArgumentError, 'Missing required parameter :name' unless payload[:name]
12
- raise Userlist::ArgumentError, 'Missing required parameter :user or :company' unless payload[:user] || payload[:company]
13
12
 
14
- super
15
- end
13
+ payload[:occurred_at] ||= payload[:occured_at] || Time.now
16
14
 
17
- def occured_at
18
- payload[:occured_at] || Time.now
15
+ super
19
16
  end
20
17
 
21
18
  def push?
22
- super && (user.nil? || user.push?) && (company.nil? || company.push?)
19
+ super && (user || company) && (user.nil? || user.push?) && (company.nil? || company.push?)
23
20
  end
24
21
  end
25
22
  end
@@ -6,7 +6,7 @@ module Userlist
6
6
  def delete(payload = {}, config = self.config)
7
7
  return false unless resource = from_payload(payload, config)
8
8
 
9
- strategy.call(:delete, resource.url) if resource.delete?
9
+ strategy.call(:delete, endpoint, resource) if resource.delete?
10
10
  end
11
11
  end
12
12
 
@@ -7,21 +7,6 @@ module Userlist
7
7
  has_one :user, type: 'Userlist::Push::User'
8
8
  has_one :company, type: 'Userlist::Push::Company'
9
9
 
10
- def initialize(payload = {}, config = Userlist.config)
11
- raise Userlist::ArgumentError, 'Missing required payload' unless payload
12
- raise Userlist::ArgumentError, 'Missing required parameter :user' unless payload[:user]
13
- raise Userlist::ArgumentError, 'Missing required parameter :company' unless payload[:company]
14
-
15
- super
16
- end
17
-
18
- def url
19
- raise Userlist::Error, "Cannot generate url for #{self.class.name} without a user" unless user
20
- raise Userlist::Error, "Cannot generate url for #{self.class.name} without a company" unless company
21
-
22
- "#{self.class.endpoint}/#{user.identifier}/#{company.identifier}"
23
- end
24
-
25
10
  def push?
26
11
  super && user&.push? && company&.push?
27
12
  end
@@ -61,6 +61,8 @@ module Userlist
61
61
  attr_reader :payload, :config
62
62
 
63
63
  def initialize(payload = {}, config = Userlist.config)
64
+ raise Userlist::ArgumentError, 'Missing required payload' unless payload
65
+
64
66
  @payload = payload
65
67
  @config = config
66
68
  end
@@ -79,10 +81,6 @@ module Userlist
79
81
  to_hash.to_json(*args)
80
82
  end
81
83
 
82
- def url
83
- "#{self.class.endpoint}/#{identifier}"
84
- end
85
-
86
84
  def identifier
87
85
  payload[:identifier]
88
86
  end
@@ -7,13 +7,6 @@ module Userlist
7
7
  has_many :relationships, type: 'Userlist::Push::Relationship', inverse: :user
8
8
  has_many :companies, type: 'Userlist::Push::Company'
9
9
  has_one :company, type: 'Userlist::Push::Company'
10
-
11
- def initialize(payload = {}, config = Userlist.config)
12
- raise Userlist::ArgumentError, 'Missing required payload' unless payload
13
- raise Userlist::ArgumentError, 'Missing required parameter :identifier or :email' unless payload[:identifier] || payload[:email]
14
-
15
- super
16
- end
17
10
  end
18
11
  end
19
12
  end
@@ -1,3 +1,3 @@
1
1
  module Userlist
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userlist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benedikt Deicke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-30 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.4.21
151
+ rubygems_version: 3.5.3
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Ruby wrapper for the Userlist API