paymill_on_rails 0.0.7 → 0.0.8

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
  !binary "U0hBMQ==":
3
- metadata.gz: ea3ee02300a229b82328d4f49d63f27beec87aab
4
- data.tar.gz: cb57e59040aa3f47f30d8dd180c5c4f1c0ae7593
3
+ metadata.gz: 049fc0f46665d7d2948ef9d91c5fc2b852236639
4
+ data.tar.gz: e1cec1b688b3c334d6592fd6a8dd12bd7210fd10
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: 6b78612ca6b13385c6831892bf14dbc60a51526f79c4479f478662d15e0cd3bebf07c845592708b3bb9e366f1d8d3e7b46d60e77bd7d81c7f99816fca34592ec
7
- data.tar.gz: 1859b44e09c4187c619f2083eed64b5b6d11edee1064df7d368a0fd12acb602b4c15da762bf1d3b8e8bde89138f5a28f46fc5b50975bd02232e7a862535fd817
6
+ metadata.gz: ee50327db322cb584175607dcb414ad21aec626d53e72638778c01abb0a9c0c933fd21a4959fcd65cefeaabb0e9d4606b2949a9df08be917f38e9cdae5da6b97
7
+ data.tar.gz: 7facb7a50b4a9b3c8cb0d1c539a0bdda8e378eda573aceef667e4215b207786361e26b63df6f3d5a89aa9cbbb54545f6f7316835dd8e10029165e4db4f3818bf
@@ -2,29 +2,16 @@ require_dependency "paymill_on_rails/application_controller"
2
2
 
3
3
  module PaymillOnRails
4
4
  class SubscriptionsController < ApplicationController
5
- before_action :set_subscription, only: [:show, :edit, :update, :destroy]
5
+ before_action :set_subscription, only: [:show]
6
6
 
7
- # GET /subscriptions
8
- #def index
9
- # @subscriptions = Subscription.all
10
- #end
11
-
12
- # GET /subscriptions/1
13
7
  def show
14
- @subscription = Subscription.find(params[:id])
15
8
  end
16
9
 
17
- # GET /subscriptions/new
18
10
  def new
19
11
  plan = Plan.find(params[:plan_id])
20
12
  @subscription = plan.subscriptions.build
21
13
  end
22
14
 
23
- # GET /subscriptions/1/edit
24
- #def edit
25
- #end
26
-
27
- # POST /subscriptions
28
15
  def create
29
16
  @subscription = Subscription.new( subscription_params )
30
17
  if @subscription.save_with_payment
@@ -34,37 +21,18 @@ module PaymillOnRails
34
21
  end
35
22
  end
36
23
 
37
- # PATCH/PUT /subscriptions/1
38
- #def update
39
- # if @subscription.update(subscription_params)
40
- # redirect_to @subscription, notice: 'Subscription was successfully updated.'
41
- # else
42
- # render action: 'edit'
43
- # end
44
- #end
45
-
46
- # DELETE /subscriptions/1
47
- #def destroy
48
- # @subscription.destroy
49
- # redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.'
50
- #end
51
-
52
24
  private
53
25
 
54
- # orig
55
- #def subscription_params
56
- # params[:subscription]
57
- #end
58
-
59
- # Only allow a trusted parameter "white list" through.
26
+ # Only allow a trusted parameter "white list" through with ( see Rails 4 Strong Parameters ).
60
27
  def subscription_params
61
28
  # specialize this private method with per-user checking of permissible attributes with params.require :
62
29
  params.require(:subscription).permit(:name, :email, :paymill_id, :plan_id, :paymill_card_token)
63
30
  end
64
31
 
65
- # Use callbacks to share common setup or constraints between actions.
32
+ # Use callbacks to share common setup or constraints between actions ( see Rails 4 Strong Parameters ).
66
33
  def set_subscription
67
34
  @subscription = Subscription.find(params[:id])
68
35
  end
36
+
69
37
  end
70
38
  end
@@ -1,7 +1,5 @@
1
1
  module PaymillOnRails
2
2
  class Plan < ActiveRecord::Base
3
- include ActiveModel::ForbiddenAttributesProtection
4
-
5
3
  has_many :subscriptions
6
4
  end
7
5
  end
@@ -1,12 +1,11 @@
1
1
  module PaymillOnRails
2
2
  class Subscription < ActiveRecord::Base
3
- include ActiveModel::ForbiddenAttributesProtection
4
3
  attr_accessor :paymill_card_token
5
-
4
+
6
5
  belongs_to :plan
7
6
  validates_presence_of :plan_id
8
7
  validates_presence_of :email
9
-
8
+
10
9
  def save_with_payment
11
10
  if valid?
12
11
  client = Paymill::Client.create email: email, description: name
@@ -1,3 +1,3 @@
1
1
  module PaymillOnRails
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paymill_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca G. Soave
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-16 00:00:00.000000000 Z
11
+ date: 2013-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails