mock_chargebee 0.0.5 → 0.0.6

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: 5a1dacacdeaba17195a81469b6255b93b42281e4c8bca5007240c5eb2462e230
4
- data.tar.gz: 6647cf5f6df2dcf813f71f9e497b93319d8164019687b1c339fb9997423350e8
3
+ metadata.gz: a36c40ee9e6e0d9598ff713875529e000c4f58d644a70985a71225511c579f36
4
+ data.tar.gz: 57a0fb4a5ab40dda5bb06553309a9c3f8b2affd4509456b10b2243f86ca54906
5
5
  SHA512:
6
- metadata.gz: 559f494502225903758e9048a7f73efd92f6b632c02b15dcd615c28395a3a12c6dc61289323428852136368b7be13944f465b4175a6d4875ea2d408c43bcfb22
7
- data.tar.gz: 8bf154b7ecc6093547226918eb12259674aadca138c7167639983ae22e4d92759be2523d82eaf7988eb3dc1a04a4580dfc91319b7d299c3658997e6c0b1980fd
6
+ metadata.gz: 4c9e7b359bf61970ea86b9e5b9a64095c98613d1da794c3cd2703add5a1075fe24dc921c41186ea679898e91ef3c5393a7a7738e3f36f89cf9a34791abff6a22
7
+ data.tar.gz: 812aebdb61d7db4eaf12938df3f51bfa42a6859a340aaac9fdb38df9beae08901745243571341dc504ae7127d425aed37c31e46a53a6831b39fd5a0b01d4a74a
@@ -0,0 +1,24 @@
1
+ {
2
+ "addon_applicability": "all",
3
+ "charge_model": "flat_fee",
4
+ "currency_code": "USD",
5
+ "enabled_in_hosted_pages": true,
6
+ "enabled_in_portal": true,
7
+ "free_quantity": 0,
8
+ "giftable": false,
9
+ "id": "silver",
10
+ "invoice_name": "sample plan",
11
+ "is_shippable": false,
12
+ "name": "Silver",
13
+ "object": "plan",
14
+ "period": 1,
15
+ "period_unit": "month",
16
+ "price": 5000,
17
+ "pricing_model": "flat_fee",
18
+ "resource_version": 1517505797000,
19
+ "show_description_in_invoices": false,
20
+ "show_description_in_quotes": false,
21
+ "status": "active",
22
+ "taxable": true,
23
+ "updated_at": 1517505797
24
+ }
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MockChargebee
4
+ module Models
5
+ class Plan < Base
6
+ RESOURCE_ID_PREFIX = 'plan'
7
+
8
+ load_fixtures :plan
9
+
10
+ def self.find(id)
11
+ repositories.plans.fetch(id)
12
+ end
13
+
14
+ def self.create(params)
15
+ params['id'] ||= unique_id
16
+ plan = plan_fixture.merge(params)
17
+ repositories.plans.store(plan['id'], plan)
18
+
19
+ plan
20
+ end
21
+
22
+ def self.update(id, params)
23
+ plan = find(id)
24
+ plan.merge!(params)
25
+ repositories.plans.store(plan['id'], plan)
26
+
27
+ plan
28
+ end
29
+ end
30
+ end
31
+ end
@@ -13,7 +13,8 @@ module MockChargebee
13
13
  add_repositories :customers,
14
14
  :subscriptions,
15
15
  :coupons,
16
- :portal_sessions
16
+ :portal_sessions,
17
+ :plans
17
18
 
18
19
  class RepoHash < Hash
19
20
  def fetch(*)
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MockChargebee
4
+ module RequestHandlers
5
+ class Plans < Base
6
+ private
7
+
8
+ def post
9
+ plan = if id.nil?
10
+ Models::Plan.create(params)
11
+ else
12
+ Models::Plan.update(id, params)
13
+ end
14
+
15
+ { plan: plan }
16
+ end
17
+
18
+ def get
19
+ plan = Models::Plan.find(id)
20
+ binding.pry
21
+
22
+ { plan: plan }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MockChargebee
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_chargebee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Cass
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,6 +110,7 @@ files:
110
110
  - lib/mock_chargebee/errors.rb
111
111
  - lib/mock_chargebee/fixtures/coupon.json
112
112
  - lib/mock_chargebee/fixtures/customer.json
113
+ - lib/mock_chargebee/fixtures/plan.json
113
114
  - lib/mock_chargebee/fixtures/portal_session.json
114
115
  - lib/mock_chargebee/fixtures/subscription.json
115
116
  - lib/mock_chargebee/fixtures/subscription_cancel_response.json
@@ -209,6 +210,7 @@ files:
209
210
  - lib/mock_chargebee/models/base.rb
210
211
  - lib/mock_chargebee/models/coupon.rb
211
212
  - lib/mock_chargebee/models/customer.rb
213
+ - lib/mock_chargebee/models/plan.rb
212
214
  - lib/mock_chargebee/models/portal_session.rb
213
215
  - lib/mock_chargebee/models/subscription.rb
214
216
  - lib/mock_chargebee/repositories.rb
@@ -216,6 +218,7 @@ files:
216
218
  - lib/mock_chargebee/request_handlers/base.rb
217
219
  - lib/mock_chargebee/request_handlers/coupons.rb
218
220
  - lib/mock_chargebee/request_handlers/customers.rb
221
+ - lib/mock_chargebee/request_handlers/plans.rb
219
222
  - lib/mock_chargebee/request_handlers/portal_sessions.rb
220
223
  - lib/mock_chargebee/request_handlers/subscriptions.rb
221
224
  - lib/mock_chargebee/services/apply_coupons.rb