avangate 0.1.7 → 0.1.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
  SHA1:
3
- metadata.gz: 0e282381f94fc175494e5fbc0997f23378a46b1e
4
- data.tar.gz: 68cc8954366a8a7bd33c16eb9ffd857726e900c3
3
+ metadata.gz: 99d44300ab535eca54d6e1e69d58d34c022e7425
4
+ data.tar.gz: 0042118b5a6c03460f2ed5cd303b77cce51731e5
5
5
  SHA512:
6
- metadata.gz: 986b98d3cd38bb140727b4b9f7ddb500a5e0184d2ca5e262d53c6d2ae0a0c5be97137877ff398bbb17b1808350849228b88bd15c4f27337d6879f55d1185d197
7
- data.tar.gz: 222c2a4ba6b48b2a6fbdda0bc98dedb02ee9f8d44f13892f4a8985028c6771e1615502bb73237496b23511fea013c80cecb2c72e8ab3c1906964281c01ad2b30
6
+ metadata.gz: 8937f339c993d4808bc17878f1f5394206c737e327976090bef849f9902fbce7e13381c61cfe25928fa9d16071282a3f3f9d6e0a88d52b99dd38464fdc9fac6a
7
+ data.tar.gz: 96fd57d16ec48dd2f721bcb5477f6eb30110bcb6bb591e549cb84c0bd1faa8df884cdb53c6abdde835d64abb3383e46cc0dbb3ecab0a4b2dac16939923e0fc74
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Avangate
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/avangate`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This gem is a library to interact with Avangate SOAP API
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Current methods implemented:
6
+
7
+ #login
6
8
 
7
9
  ## Installation
8
10
 
@@ -20,14 +22,18 @@ Or install it yourself as:
20
22
 
21
23
  $ gem install avangate
22
24
 
23
- You need to provide your secret key and your merchant code, both you can get when you sign in to avangate website, then you need to create an initializer (avangate.rb) an set up:
25
+ You need to provide your secret key and your merchant code, both you can get when you sign in to avangate website, then you need to create an initializer
26
+
27
+ config/initializers/avangate.rb
28
+
29
+ Inside you can and set up:
24
30
 
25
31
  Avangate::Base.secret_key = "SECRET_KEY"
26
32
  Avangate::Base.merchant_code = "MERCHANT_CODE"
27
33
 
28
34
  ## Usage
29
35
 
30
- TODO: Write usage instructions here
36
+ sessionId = Avangate::SOAP.login
31
37
 
32
38
  ## Development
33
39
 
data/avangate.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["leo.majowka@gmail.com"]
11
11
 
12
12
  spec.summary = "Avangate integration for Ruby on Rails using their SOAP API with Savon"
13
- spec.description = "Avangate integration for Ruby on Rails using their SOAP API with Savon"
13
+ spec.description = "Avangate integration for Ruby on Rails using their SOAP API with Savon. Methods #login"
14
14
  spec.homepage = "https://github.com/lmajowka/avangate"
15
15
  spec.license = "MIT"
16
16
 
data/lib/avangate.rb CHANGED
@@ -17,6 +17,20 @@ module Avangate
17
17
  end
18
18
  end
19
19
 
20
+ def self.addProduct(options={})
21
+ raise MissingSessionId, "missing param session_id" unless options[:session_id].presence
22
+ raise MissingProductId, "missing param product_id" unless options[:product_id].presence
23
+ quantity = options[:quantity].presence ? options[:quantity] : 1
24
+ params = {
25
+ sessionID: options[:session_id],
26
+ ProductId: options[:product_id],
27
+ Quantity: quantity
28
+
29
+ }
30
+ response = client.call :addProduct, message: params
31
+ return response.body.first[1].first[1]
32
+ end
33
+
20
34
  private
21
35
 
22
36
  def self.client
@@ -10,5 +10,6 @@ module Avangate
10
10
 
11
11
  class MissingSecretKey < AvangateError; end
12
12
  class MissingMerchantCode < AvangateError; end
13
-
13
+ class MissingSessionId < AvangateError; end
14
+ class MissingProductId < AvangateError; end
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module Avangate
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avangate
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
  - Leo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: Avangate integration for Ruby on Rails using their SOAP API with Savon
69
+ description: 'Avangate integration for Ruby on Rails using their SOAP API with Savon.
70
+ Methods #login'
70
71
  email:
71
72
  - leo.majowka@gmail.com
72
73
  executables: []
@@ -89,13 +90,6 @@ files:
89
90
  - LICENSE.txt
90
91
  - README.md
91
92
  - Rakefile
92
- - avangate-0.1.0.gem
93
- - avangate-0.1.1.gem
94
- - avangate-0.1.2.gem
95
- - avangate-0.1.3.gem
96
- - avangate-0.1.4.gem
97
- - avangate-0.1.5.gem
98
- - avangate-0.1.6.gem
99
93
  - avangate.gemspec
100
94
  - bin/console
101
95
  - bin/setup
data/avangate-0.1.0.gem DELETED
Binary file
data/avangate-0.1.1.gem DELETED
Binary file
data/avangate-0.1.2.gem DELETED
Binary file
data/avangate-0.1.3.gem DELETED
Binary file
data/avangate-0.1.4.gem DELETED
Binary file
data/avangate-0.1.5.gem DELETED
Binary file
data/avangate-0.1.6.gem DELETED
Binary file