Skip to content

Commit

Permalink
Merge pull request #19 from Gazler/feature/metadata
Browse files Browse the repository at this point in the history
add metadata to plans
  • Loading branch information
cowboyd committed Aug 26, 2014
2 parents 7cb6ac4 + a01a566 commit e5b23ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/stripe/plans.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Plans
include ConfigurationBuilder

configuration_for :plan do
attr_accessor :name, :amount, :interval, :interval_count, :trial_period_days, :currency
attr_accessor :name, :amount, :interval, :interval_count, :trial_period_days, :currency, :metadata

validates_presence_of :id, :name, :amount
validates_inclusion_of :interval, :in => %w(week month year), :message => "'%{value}' is not one of 'week', 'month' or 'year'"
Expand All @@ -22,7 +22,8 @@ def create_options
:amount => @amount,
:interval => @interval,
:interval_count => @interval_count,
:trial_period_days => @trial_period_days
:trial_period_days => @trial_period_days,
:metadata => @metadata
}
end
end
Expand Down
7 changes: 5 additions & 2 deletions test/plan_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
plan.interval = 'month'
plan.interval_count = 3
plan.trial_period_days = 30
plan.metadata = {:number_of_awesome_things => 5}
end
end
after do
Expand Down Expand Up @@ -83,7 +84,8 @@
:amount => 699,
:interval => 'month',
:interval_count => 1,
:trial_period_days => 0
:trial_period_days => 0,
:metadata => nil
)
Stripe::Plans::GOLD.put!
end
Expand All @@ -96,7 +98,8 @@
:amount => 699,
:interval => 'month',
:interval_count => 1,
:trial_period_days => 0
:trial_period_days => 0,
:metadata => nil
)
Stripe::Plans::ALTERNATIVE_CURRENCY.put!
end
Expand Down

0 comments on commit e5b23ea

Please sign in to comment.