rubykassa 0.1.0 → 0.1.1

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: fb7b7735b191f748207076ea975421b7fa513025
4
- data.tar.gz: ae694c27916cd5dbe1365f047cd9e8324c8c58a0
3
+ metadata.gz: b21115e2d037d94d54779b400b762b31cbe79e11
4
+ data.tar.gz: 483e42685380f113d2c309d911a697570a971ce2
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: 5861395cf63acbd75ac9d1a0b798f26d548a084a40ec6555c9fe5809b75fcbf59bf0a0f742216ca4d2316a7e6df334d8aa4dc852c49e57b3d6971d68b893043c
7
- data.tar.gz: 1d8565a5151e30169e5ae1c3ac33e06069d6be4b0e6e3f1faf0628240ca43ba46da1e78a113e51986dc39fc6362706f53c13c07a8460cf37a0e4de4608442c11
6
+ metadata.gz: ead1b43e4512e9f364c426ad8f3f806643519f0d31dbe11eb369c6a4dc892d4a17dd8177193c0c7c831d6d542a0ef1c73c9e77c414eca66e3094c8fe668114b6
7
+ data.tar.gz: 8b3784c955556cc99f3c1b7316332679f74052f26d94f14eeda7aee06ae804968916df40f8207f1d83f40023cd24861849cdd36e06f3110924a43366795b855a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubykassa (0.0.1)
4
+ rubykassa (0.1.0)
5
5
  multi_xml
6
6
  rails (~> 3.2.13)
7
7
 
data/README.md CHANGED
@@ -1,26 +1,68 @@
1
1
  ## The Rubykassa gem
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/rubykassa.png)](http://badge.fury.io/rb/rubykassa)
3
4
  [![Build Status](https://secure.travis-ci.org/ZeroOneStudio/rubykassa.png)](http://travis-ci.org/ZeroOneStudio/rubykassa)
4
5
 
5
6
  by [Zero One][]
6
7
 
7
8
  [Zero One]: http://zeroone.st
8
9
 
9
- Yet another Ruby wrapper for Robokassa API. Took the best from [robokassa gem][] and [Active Merchant Robokassa integration] but easier to use and setup.
10
+ Yet another Ruby wrapper for [Robokassa API][]. Rubykassa took the best from [robokassa gem][] and [Active Merchant Robokassa integration] but easier to use and setup.
10
11
 
12
+ [Robokassa API]: http://robokassa.ru/ru/Doc/Ru/Interface.aspx
11
13
  [robokassa gem]: https://github.com/shaggyone/robokassa
12
14
  [Active Merchant Robokassa integration]: https://github.com/Shopify/active_merchant/tree/master/lib/active_merchant/billing/integrations/robokassa
13
15
 
14
16
  ## Installation
15
17
 
16
- gem install rubykassa
17
-
18
- Or put to your `Gemfile`
18
+ Add to your `Gemfile`:
19
19
 
20
20
  gem "rubykassa"
21
21
 
22
22
  ## Usage
23
23
 
24
+ Run `rails g rubykassa:install`, get an initializer with the following code:
25
+
26
+ Rubykassa.configure do |config|
27
+ config.login = ENV["ROBOKASSA_LOGIN"]
28
+ config.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
29
+ config.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
30
+ config.mode = :test # or :production
31
+ config.http_method = :get # or :post
32
+ config.xml_http_method = :get # or :post
33
+ end
34
+
35
+ and configure it with your credentials.
36
+
37
+ Mode is `:test` by default. For production you have to use `:production`.
38
+ `http_method` and `xml_http_method` are `:get` by default but can be configured as `:post`
39
+
40
+ Once you are done, simple use `pay_url` helper in your view:
41
+
42
+ <%= pay_url "Pay with Robokassa", ivoice_id, total_sum %>
43
+
44
+ Additionally you may want to pass extra options. There is no problem:
45
+
46
+ <%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { description: "Invoice description", email: "foo@bar.com", currency: "WMZM", culture: :ru } %>
47
+
48
+ If you need to implement Robokassa's XML interface functionality you have to the following:
49
+
50
+ xml_interface = Rubykassa::XmlInterface.new do
51
+ self.invoice_id = your_invioce_id
52
+ self.total = your_total_sum
53
+ self.language = :ru # can be :en, :ru is default
54
+ end
55
+
56
+ then call whatever you need
57
+
58
+ xml_interface.get_currencies_list
59
+ xml_interface.get_payment_methods
60
+ xml_interface.get_rates
61
+ xml_interface.op_state
62
+
24
63
  ## License
25
64
 
26
- This project rocks and uses MIT-LICENSE.
65
+ This project rocks and uses MIT-LICENSE
66
+ Copyright (c) 2013 [Zero One][]
67
+
68
+ [ZERO.ONE]: http://www.zeroone.st
data/config/routes.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  Rails.application.routes.draw do
3
- scope '/robokassa' do
4
- %w(paid success fail).map do |route|
5
- method(Rubykassa.http_method).call "/#{route}" => "robokassa##{route}", as: "robokassa_#{route}".to_sym
3
+ if Rubykassa::Client.configuration
4
+ scope '/robokassa' do
5
+ %w(paid success fail).map do |route|
6
+ method(Rubykassa.http_method).call "/#{route}" => "robokassa##{route}", as: "robokassa_#{route}".to_sym
7
+ end
6
8
  end
7
9
  end
8
10
  end
@@ -0,0 +1,10 @@
1
+ require 'rails/generators'
2
+
3
+ module Rubykassa
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("../templates", __FILE__)
6
+ def create_initializer_file
7
+ template 'rubykassa.rb', File.join('config', 'initializers', 'rubykassa.rb')
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Rubykassa.configure do |c|
3
+ c.login = ENV["ROBOKASSA_LOGIN"]
4
+ c.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
5
+ c.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
6
+ c.mode = :test # or :production
7
+ c.http_method = :get # or :post
8
+ c.xml_http_method = :get # or :post
9
+ end
@@ -9,7 +9,7 @@ module Rubykassa
9
9
  self.second_password = "second_password"
10
10
  self.mode = :test
11
11
  self.http_method = :get
12
- self.xml_http_method = :get
12
+ self.xml_http_method = :get
13
13
  end
14
14
  end
15
15
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Rubykassa
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
data/lib/rubykassa.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require "rubykassa/engine"
2
+ require 'rubykassa/engine'
3
3
  require 'rubykassa/client'
4
4
  require 'rubykassa/payment_interface'
5
5
  require 'rubykassa/xml_interface'
@@ -3,6 +3,7 @@ Rubykassa.configure do |c|
3
3
  c.login = ENV["ROBOKASSA_LOGIN"]
4
4
  c.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
5
5
  c.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
6
- c.mode = :test
7
- c.http_method = :get
6
+ c.mode = :test # or :production
7
+ c.http_method = :get # or :post
8
+ c.xml_http_method = :get # or :post
8
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubykassa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Kishenin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-06 00:00:00.000000000 Z
11
+ date: 2013-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -127,6 +127,8 @@ files:
127
127
  - app/controllers/.gitkeep
128
128
  - app/controllers/robokassa_controller.rb
129
129
  - config/routes.rb
130
+ - lib/generators/rubykassa/install_generator.rb
131
+ - lib/generators/rubykassa/templates/rubykassa.rb
130
132
  - lib/rubykassa.rb
131
133
  - lib/rubykassa/action_view_extension.rb
132
134
  - lib/rubykassa/client.rb