payture_api 0.1.7 → 0.1.8

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
  SHA1:
3
- metadata.gz: 7c0aaf7fd6858271698480c959f9a4146c3fb007
4
- data.tar.gz: 90b46a1ccb7fa8c977b6176a2b1013a1bf72a275
3
+ metadata.gz: ee413a9ff649f0a6d2502ef8a274d5aac82bd516
4
+ data.tar.gz: 61c5df04be3997c220d82ae34c7949e5ba43ffde
5
5
  SHA512:
6
- metadata.gz: 3ce176a455687c4c00258dee0d56e9a4056104587f27836dcd86fad0b519e80950f1f25d88f52ced8a2071311081b403392d3a644685e928df10d3ac969882dd
7
- data.tar.gz: 459cbaec570843c7a95f1979eb48e6f1706735f3c92da1edb9b562d8b18667a8b9037e83fb957447b0a0f1985f5750315f464d0199c0e59366b132cf528ab3a3
6
+ metadata.gz: 743dbb834b1152482226f2e03290a9dde49bc92b7313194c1352569a9c6a6777853adc881ca6c64040a840632c050adefef83503ed5fbb1a1fab9d4ae5dfdaf9
7
+ data.tar.gz: 9996d421a8561a57827f6ef61389cc5f356c65708bef8c44db98c7a390551be564d9046c28bca7d919349fa81578c6a5a408be87f8a4fa6103032908dbed86b1
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # PaytureRuby
1
+ # Payture for Ruby
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/payture_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Welcome to the Payture for Ruby gem! This gem allows you to integrate Payture into your Ruby application (Rails, etc.)
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,13 +20,108 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ In your code you will need to require the gem:
24
+ ```ruby
25
+ require 'payture'
26
+ ```
27
+
28
+ ## API
29
+
30
+ ### Payture::Wallet
31
+
32
+ #### Init
33
+ ```ruby
34
+ HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
35
+ MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
36
+
37
+ payload = {
38
+ OrderId: 'ABC123',
39
+ SessionType: 'Block',
40
+ VWUserLgn: @user.email,
41
+ VWUserPsw: @user.token,
42
+ Amount: 100
43
+ }
44
+
45
+ wallet = Payture::Wallet.new(HOST)
46
+ result = wallet.init(MERCHANT_ADD, payload)
47
+ ```
48
+
49
+ #### Pay
50
+ ```ruby
51
+ HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
52
+ MERCHANT_PAY = ENV['PAYTURE_PAY'] // VWMerchantExamplePay
53
+
54
+ payload = {
55
+ OrderId: 'DCB312',
56
+ VWUserLgn: @user.email,
57
+ VWUserPsw: @user.token,
58
+ Amount: 100
59
+ CardId: @order.card_id
60
+ }
61
+
62
+ wallet = Payture::Wallet.new(HOST)
63
+ result = wallet.pay(MERCHANT_PAY, payload)
64
+ ```
65
+
66
+ ### Payture::User
67
+
68
+ #### Register
69
+ ```ruby
70
+ HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
71
+ MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
72
+
73
+ payload = {
74
+ VWUserLgn: @user.email,
75
+ VWUserPsw: @user.token
76
+ }
26
77
 
27
- ## Development
78
+ wallet = Payture::User.new(HOST)
79
+ result = wallet.register(MERCHANT_ADD, payload)
80
+ ```
81
+
82
+ #### Update
83
+ ```ruby
84
+ HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
85
+ MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
86
+
87
+ payload = {
88
+ VWUserLgn: @user.email,
89
+ VWUserPsw: @user.token,
90
+ Phone: @user.phone
91
+ }
28
92
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
93
+ wallet = Payture::User.new(HOST)
94
+ result = wallet.update(MERCHANT_ADD, payload)
95
+ ```
96
+
97
+ #### Check
98
+ ```ruby
99
+ HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
100
+ MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
30
101
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
102
+ payload = {
103
+ VWUserLgn: @user.email,
104
+ VWUserPsw: @user.token
105
+ }
106
+
107
+ wallet = Payture::User.new(HOST)
108
+ result = wallet.check(MERCHANT_ADD, payload)
109
+ ```
110
+
111
+ #### Delete
112
+ ```ruby
113
+ HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
114
+ MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
115
+ PASSWORD = ENV['PAYTURE_PASSWORD']
116
+
117
+ payload = {
118
+ VWUserLgn: @user.email,
119
+ password: PASSWORD
120
+ }
121
+
122
+ wallet = Payture::User.new(HOST)
123
+ result = wallet.delete(MERCHANT_ADD, payload)
124
+ ```
32
125
 
33
126
  ## Contributing
34
127
 
@@ -38,4 +131,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
38
131
  ## License
39
132
 
40
133
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -0,0 +1,9 @@
1
+ class Payture::Card < Payture::Wallet
2
+
3
+ # PATH_ADD = '/vwapi/Add'
4
+ #
5
+ # def add(vwid, data)
6
+ # self.request(PATH_ADD, vwid, data)
7
+ # end
8
+
9
+ end
@@ -0,0 +1,14 @@
1
+ class Payture::Parser
2
+
3
+ # klass = nil
4
+ # def init(className)
5
+ # klass = Object.const_get className
6
+ # end
7
+
8
+ def parse(data)
9
+ data.each do |k,v|
10
+ puts "#{k}: #{v}"
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,24 @@
1
+ class Payture::User < Payture::Wallet
2
+
3
+ PATH_REGISTER = '/vwapi/Register'
4
+ PATH_UPDATE = '/vwapi/Update'
5
+ PATH_DELETE = '/vwapi/Delete'
6
+ PATH_CHECK = '/vwapi/Check'
7
+
8
+ def register(vwid, data)
9
+ self.request(PATH_REGISTER, vwid, data)
10
+ end
11
+
12
+ def update(vwid, data)
13
+ self.request(PATH_UPDATE, vwid, data)
14
+ end
15
+
16
+ def delete(vwid, data)
17
+ self.request(PATH_DELETE, vwid, data)
18
+ end
19
+
20
+ def check(vwid, data)
21
+ self.request(PATH_CHECK, vwid, data)
22
+ end
23
+
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Payture
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -1,9 +1,19 @@
1
1
  class Payture::Wallet < Payture::API
2
2
 
3
- PATH_INIT = '/vwapi/Init'
3
+ PATH_INIT = '/vwapi/Init'
4
+ PATH_PAY = '/vwapi/Pay'
5
+ # PATH_CHARGE = '/vwapi/Charge'
4
6
 
5
7
  def init(vwid, data)
6
8
  self.request(PATH_INIT, vwid, data)
7
9
  end
8
10
 
11
+ def pay(vwid, data)
12
+ self.request(PATH_PAY, vwid, data)
13
+ end
14
+
15
+ # def charge(vwid, data)
16
+ # self.request(PATH_CHARGE, vwid, data)
17
+ # end
18
+
9
19
  end
data/lib/payture.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  require "payture/version"
2
2
  require "payture/api"
3
3
  require "payture/wallet"
4
+ require "payture/parser"
5
+ require "payture/user"
6
+ require "payture/card"
4
7
 
5
8
  module Payture
6
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payture_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-26 00:00:00.000000000 Z
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,7 +87,10 @@ files:
87
87
  - bin/setup
88
88
  - lib/payture.rb
89
89
  - lib/payture/api.rb
90
+ - lib/payture/card.rb
90
91
  - lib/payture/hash.rb
92
+ - lib/payture/parser.rb
93
+ - lib/payture/user.rb
91
94
  - lib/payture/version.rb
92
95
  - lib/payture/wallet.rb
93
96
  - payture_ruby.gemspec
@@ -111,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
114
  version: '0'
112
115
  requirements: []
113
116
  rubyforge_project:
114
- rubygems_version: 2.5.1
117
+ rubygems_version: 2.6.11
115
118
  signing_key:
116
119
  specification_version: 4
117
120
  summary: Payture.com API for Ruby