munificent 2.0.0 → 2.0.1

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: e64a165beab753dc83e80dc31cf4e45a1e901cc527e65fc60cc4003ab6151592
4
- data.tar.gz: 2608005621faabe15e562d043f5e28be0b50e8cc38d0b665149f3fef9d746e13
3
+ metadata.gz: 713a0dc64c44c4bee25e0b047556e7f4eb7a4ee57b93c818d7f3022031116fc6
4
+ data.tar.gz: 5903bf9e9e572d8208ef3656f21ae087c51fb355f29cd6b7147eaaaf5a261b4e
5
5
  SHA512:
6
- metadata.gz: ca01a7802d047765ec4155868f9f4e3144c846ee8cba376111e8435e227e7078731afe2b3e1b2693e3cb3cc28b80580b03bbd7c598844bbf04e4211c05669c6a
7
- data.tar.gz: ed7dc3b9c66beac74fe0bc0b2d1f58f52e709f2c07054acfea19efd903b586441b2f388257286453b79319ba3c736a7ad169f3d67f24d8f6c7361ac7ee56321c
6
+ metadata.gz: a1b20e42b100b52f8572f58497af8832e6bfac7a04547e9e229bb00e2515a7b0417fe49316b54ad1766e26c76ad9ef1b700d69c55f4b3aaec4bed5feb84dda5e
7
+ data.tar.gz: a41c4721b4a0c58ee4b04c187b88ac16847cbc45b66949d7699aefbc40db52a84ff57b86a5a2f8a67dcfd54f0e71d30c91af583c93fd7f6b3d0346925e8c8f92
@@ -1,3 +1,3 @@
1
1
  module Munificent
2
- VERSION = "2.0.0".freeze
2
+ VERSION = "2.0.1".freeze
3
3
  end
@@ -0,0 +1,60 @@
1
+ require_relative "lib/munificent/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.required_ruby_version = ">= 3.1"
5
+
6
+ spec.name = "munificent"
7
+ spec.version = Munificent::VERSION
8
+ spec.authors = ["Elliot Crosby-McCullough"]
9
+ spec.email = ["elliot@smart-casual.com"]
10
+ spec.homepage = "https://github.com/SmartCasual/munificent"
11
+ spec.summary = "The core of Munificent, a game-bundle fundraising platform."
12
+ spec.license = "CC-BY-NC-SA-4.0"
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = spec.homepage
16
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/#{spec.version}/CHANGELOG.md"
17
+ spec.metadata["rubygems_mfa_required"] = "true"
18
+
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) {
20
+ Dir[
21
+ "{app,config,db,lib}/**/*",
22
+ "LICENCE",
23
+ "Rakefile",
24
+ "README.md",
25
+ "munificent.gemspec",
26
+ "test/factories/**/*_factory.rb",
27
+ "test/support/aasm_factories.rb",
28
+ ]
29
+ }
30
+
31
+ spec.add_dependency "aasm", "~> 5.2"
32
+ spec.add_dependency "after_commit_everywhere", "~> 1.1"
33
+ spec.add_dependency "authlogic", "~> 6.4"
34
+ spec.add_dependency "aws-sdk-kms", "~> 1.53" # AWS KMS support for `kms_encrypted`
35
+ spec.add_dependency "aws-sdk-rails", "~> 3.6"
36
+ spec.add_dependency "blind_index", "~> 2.3" # Encrypted query support for `lockbox`
37
+ spec.add_dependency "devise", "~> 4.8"
38
+ spec.add_dependency "factory_bot", "~> 6.2"
39
+ spec.add_dependency "factory_bot_namespaced_factories", "~> 0.1"
40
+ spec.add_dependency "factory_bot_rails", "~> 6.2"
41
+ spec.add_dependency "faraday", "~> 2.2"
42
+ spec.add_dependency "faraday-retry", "~> 1.0"
43
+ spec.add_dependency "hmac", "~> 2.1"
44
+ spec.add_dependency "kms_encrypted", "~> 1.4" # KMS support for `lockbox`
45
+ spec.add_dependency "lockbox", "~> 0.6" # Game key encryption
46
+ spec.add_dependency "monetize", "~> 1.12"
47
+ spec.add_dependency "money-rails", "~> 1.15"
48
+ spec.add_dependency "net-smtp", "~> 0.3"
49
+ spec.add_dependency "omniauth", "~> 2.0"
50
+ spec.add_dependency "omniauth-rails_csrf_protection", "~> 1.0"
51
+ spec.add_dependency "omniauth-token", "~> 1.0"
52
+ spec.add_dependency "omniauth-twitch_smartcasual", "~> 1.1"
53
+ spec.add_dependency "paypal-rest", "~> 1.1"
54
+ spec.add_dependency "rails", "~> 7.0"
55
+ spec.add_dependency "redis", "~> 4.6"
56
+ spec.add_dependency "rollbar", "~> 3.3"
57
+ spec.add_dependency "scrypt", "~> 3.0"
58
+ spec.add_dependency "sidekiq", "~> 6.4"
59
+ spec.add_dependency "stripe", "~> 5.43"
60
+ end
@@ -0,0 +1,33 @@
1
+ require_relative "../support/aasm_factories"
2
+
3
+ Munificent::Factories.define :bundle do
4
+ sequence(:name) { |n| "Bundle #{n}" }
5
+
6
+ fundraiser { Munificent::Fundraiser.active.first || association(:fundraiser, :active) }
7
+
8
+ transient do
9
+ price { Money.new(25_00, "GBP") }
10
+ end
11
+
12
+ bundle_tiers do
13
+ build_list(:bundle_tier, 1, bundle: @instance, price:)
14
+ end
15
+
16
+ trait :empty do
17
+ bundle_tiers do
18
+ build_list(:bundle_tier, 1, :empty, bundle: @instance, price:)
19
+ end
20
+ end
21
+
22
+ trait :tiered do
23
+ bundle_tiers do
24
+ [
25
+ build(:bundle_tier, bundle: @instance, price:),
26
+ build(:bundle_tier, bundle: @instance, price: Money.new(15_00, "GBP")),
27
+ build(:bundle_tier, bundle: @instance, price: Money.new(10_00, "GBP")),
28
+ ]
29
+ end
30
+ end
31
+
32
+ AASMFactories.init(self, @definition)
33
+ end
@@ -0,0 +1,21 @@
1
+ Munificent::Factories.define :bundle_tier do
2
+ bundle
3
+
4
+ price { Money.new(5_00, "GBP") }
5
+
6
+ transient do
7
+ game { build(:game, :with_keys) }
8
+ end
9
+
10
+ bundle_tier_games do
11
+ FactoryBot.build_list(:bundle_tier_game, 1, bundle_tier: @instance, game:)
12
+ end
13
+
14
+ trait :empty do
15
+ bundle_tier_games { [] }
16
+ end
17
+
18
+ trait :without_keys do
19
+ game { build(:game) }
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ Munificent::Factories.define :bundle_tier_game do
2
+ bundle_tier
3
+ association(:game, :with_keys)
4
+ end
@@ -0,0 +1,3 @@
1
+ Munificent::Factories.define :charity do
2
+ sequence(:name) { |n| "Charity #{n}" }
3
+ end
@@ -0,0 +1,3 @@
1
+ Munificent::Factories.define :curated_streamer do
2
+ sequence(:twitch_username) { |n| "streamer_#{n}" }
3
+ end
@@ -0,0 +1,26 @@
1
+ require_relative "../support/aasm_factories"
2
+
3
+ Munificent::Factories.define :donation do
4
+ donator
5
+ amount { Money.new(25_000) }
6
+ message { "Some standard message" }
7
+ sequence(:stripe_payment_intent_id) { |n| "stripe_payment_intent_id_#{n}" }
8
+
9
+ fundraiser { Munificent::Fundraiser.active.first || association(:fundraiser, :active) }
10
+
11
+ transient do
12
+ charity_split { {} }
13
+ end
14
+
15
+ AASMFactories.init(self, @definition)
16
+
17
+ after(:build) do |donation, evaluator|
18
+ evaluator.charity_split.each do |charity, split_amount|
19
+ donation.charity_splits.build(
20
+ donation:,
21
+ charity:,
22
+ amount: split_amount,
23
+ )
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ Munificent::Factories.define :donator_bundle do
2
+ bundle
3
+ donator
4
+ end
@@ -0,0 +1,22 @@
1
+ Munificent::Factories.define :donator_bundle_tier do
2
+ donator_bundle
3
+ bundle_tier
4
+
5
+ trait :fulfilled do
6
+ keys do
7
+ bundle_tier.games.map do |game|
8
+ build(:key, game:, donator_bundle_tier: @instance)
9
+ end
10
+ end
11
+ end
12
+
13
+ trait :unfulfilled
14
+
15
+ trait :locked do
16
+ unlocked { false }
17
+ end
18
+
19
+ trait :unlocked do
20
+ unlocked { true }
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ Munificent::Factories.define :donator do
2
+ sequence(:name) { |n| "Donator #{n}" }
3
+
4
+ trait :with_email_address do
5
+ sequence(:email_address) { |n| "test-#{n}@example.com" }
6
+ end
7
+
8
+ trait :confirmed do
9
+ confirmed { true }
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ Munificent::Factories.define :fundraiser do
2
+ sequence(:name) { |n| "Fundraiser #{n}" }
3
+
4
+ AASMFactories.init(self, @definition)
5
+
6
+ trait :with_live_bundle do
7
+ bundles do
8
+ build_list(:bundle, 1, :live)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ Munificent::Factories.define :game do
2
+ sequence(:name) { |n| "Game #{n}" }
3
+
4
+ trait :with_keys do
5
+ keys { FactoryBot.build_list(:key, 1, game: @instance) }
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ Munificent::Factories.define :key do
2
+ code { SecureRandom.uuid }
3
+ game
4
+ donator_bundle_tier { nil }
5
+
6
+ trait :unassigned
7
+
8
+ trait :assigned do
9
+ donator_bundle_tier
10
+ end
11
+ end
@@ -0,0 +1 @@
1
+ Munificent::Factories.define :payment
@@ -0,0 +1,20 @@
1
+ module AASMFactories
2
+ SCOPE = "Munificent".freeze
3
+
4
+ def self.init(definition_proxy, definition, class_name: nil)
5
+ class_name ||= definition.name
6
+
7
+ trimmed_name = class_name
8
+ .to_s
9
+ .gsub(/^#{SCOPE.downcase}_/, "")
10
+ .camelize
11
+
12
+ klass = "#{SCOPE}::#{trimmed_name}".constantize
13
+
14
+ klass.aasm.states.each do |state|
15
+ definition_proxy.trait(state.name) do
16
+ add_attribute(klass.aasm.attribute_name) { state.name }
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: munificent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough
@@ -466,13 +466,28 @@ files:
466
466
  - lib/tasks/default.rake
467
467
  - lib/tasks/key_assignment.rake
468
468
  - lib/tasks/munificent_tasks.rake
469
+ - munificent.gemspec
470
+ - test/factories/bundle_factory.rb
471
+ - test/factories/bundle_tier_factory.rb
472
+ - test/factories/bundle_tier_game_factory.rb
473
+ - test/factories/charity_factory.rb
474
+ - test/factories/curated_streamer_factory.rb
475
+ - test/factories/donation_factory.rb
476
+ - test/factories/donator_bundle_factory.rb
477
+ - test/factories/donator_bundle_tier_factory.rb
478
+ - test/factories/donator_factory.rb
479
+ - test/factories/fundraiser_factory.rb
480
+ - test/factories/game_factory.rb
481
+ - test/factories/key_factory.rb
482
+ - test/factories/payment_factory.rb
483
+ - test/support/aasm_factories.rb
469
484
  homepage: https://github.com/SmartCasual/munificent
470
485
  licenses:
471
486
  - CC-BY-NC-SA-4.0
472
487
  metadata:
473
488
  homepage_uri: https://github.com/SmartCasual/munificent
474
489
  source_code_uri: https://github.com/SmartCasual/munificent
475
- changelog_uri: https://github.com/SmartCasual/munificent/blob/2.0.0/CHANGELOG.md
490
+ changelog_uri: https://github.com/SmartCasual/munificent/blob/2.0.1/CHANGELOG.md
476
491
  rubygems_mfa_required: 'true'
477
492
  post_install_message:
478
493
  rdoc_options: []