stripe-ruby-mock 2.5.5 → 2.5.6

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: 8bb56a9378124dffc3cb2d4d9900ced89323ec9a
4
- data.tar.gz: 9181762220a2d8d1fb5ff7e37d479b2b75290d76
3
+ metadata.gz: 0b5d9cbcf4490a6413cf153d1c2a1a21acf38929
4
+ data.tar.gz: cb9f625fc17632de27cfeef7ec97f429fa79804d
5
5
  SHA512:
6
- metadata.gz: 390ca8cee59e0584d03dc2a9c6decb8b6df5b70278984baefbd00f6b053efa747c623cf5d867fa53c8ad964d66e48d5155e9a34ee0a27846d36177f8f67a6904
7
- data.tar.gz: 7d4bd0d536ed0b21d4eac5f0e16161e4c46e2ba00e927c74fe6fa1f88bbf1fda335b314dffe04704afccf9f226330e0b7f8c3e3b3afbf4ad03cba078562739f7
6
+ metadata.gz: bde32906b3e0c262da53cbea9263250a497736e81c824a08c6c668546317f8209ed3bd5e6c4ef34df5414af3d753d6a6fdcaedf956e7e4f9a31a50f327e4174b
7
+ data.tar.gz: 182a87b8a9f5cc078ecb5c8a3afbcfd6d51d14d72518928aad1e2e85effb1bb3667888fee21a658dc428c4fd1e7c6a1303ea09599e9b2d7791801576fc6b5029
data/README.md CHANGED
@@ -12,7 +12,7 @@ This gem has unexpectedly grown in popularity and I've gotten pretty busy, so I'
12
12
 
13
13
  In your gemfile:
14
14
 
15
- gem 'stripe-ruby-mock', '~> 2.5.5', :require => 'stripe_mock'
15
+ gem 'stripe-ruby-mock', '~> 2.5.6', :require => 'stripe_mock'
16
16
 
17
17
  ## Features
18
18
 
@@ -291,6 +291,7 @@ module StripeMock
291
291
  current_period_start: 1308595038,
292
292
  current_period_end: 1308681468,
293
293
  status: 'trialing',
294
+ trial_from_plan: false,
294
295
  plan: {
295
296
  interval: 'month',
296
297
  amount: 7500,
@@ -1,12 +1,13 @@
1
1
  module StripeMock
2
2
  module Data
3
3
  class List
4
- attr_reader :data, :limit, :offset, :starting_after
4
+ attr_reader :data, :limit, :offset, :starting_after, :ending_before
5
5
 
6
6
  def initialize(data, options = {})
7
7
  @data = Array(data.clone)
8
8
  @limit = [[options[:limit] || 10, 100].min, 1].max # restrict @limit to 1..100
9
9
  @starting_after = options[:starting_after]
10
+ @ending_before = options[:ending_before]
10
11
  if @data.first.is_a?(Hash) && @data.first[:created]
11
12
  @data.sort_by! { |x| x[:created] }
12
13
  @data.reverse!
@@ -46,9 +47,13 @@ module StripeMock
46
47
  private
47
48
 
48
49
  def offset
49
- if starting_after
50
+ case
51
+ when starting_after
50
52
  index = data.index { |datum| datum[:id] == starting_after }
51
53
  (index || raise("No such object id: #{starting_after}")) + 1
54
+ when ending_before
55
+ index = data.index { |datum| datum[:id] == ending_before }
56
+ (index || raise("No such object id: #{ending_before}")) - 1
52
57
  else
53
58
  0
54
59
  end
@@ -11,7 +11,7 @@ module StripeMock
11
11
  subscription[:items][:data] = plans.map do |plan|
12
12
  if options[:items] && options[:items].size == plans.size
13
13
  quantity = options[:items] &&
14
- options[:items].values.detect { |item| item[:plan] == plan[:id] }[:quantity] || 1
14
+ options[:items].detect { |item| item[:plan] == plan[:id] }[:quantity] || 1
15
15
  Data.mock_subscription_item({ plan: plan, quantity: quantity })
16
16
  else
17
17
  Data.mock_subscription_item({ plan: plan })
@@ -1,4 +1,4 @@
1
1
  module StripeMock
2
2
  # stripe-ruby-mock version
3
- VERSION = "2.5.5"
3
+ VERSION = "2.5.6"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-ruby-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2018-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stripe