alpha_card 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 +4 -4
- data/README.md +1 -1
- data/alpha_card.gemspec +2 -2
- data/lib/alpha_card.rb +0 -1
- data/lib/alpha_card/account.rb +2 -1
- data/lib/alpha_card/alpha_card_object.rb +1 -1
- data/lib/alpha_card/order.rb +1 -1
- data/lib/alpha_card/sale.rb +2 -2
- data/lib/alpha_card/utils.rb +6 -1
- metadata +2 -3
- data/lib/alpha_card/object.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 706d4fb925ed92b75aeb824e9ac0cb1353b4cd5e
|
4
|
+
data.tar.gz: ddd2530759a1516a3008c10635105acdb19d7782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b50540e1457d8f9774307dcb7443d084c24ede72a009dca98430a265bb5a0dea4162b3fe9f7785a66c62dbdb2094c280a6fb164d08afd6d628515c30bca624
|
7
|
+
data.tar.gz: ee1eb394decc0933f881f4f8e9931ae083cb215b4d1a0d622d15befa0d361cbdbfefb1cdd7d3bdd63e8651317c428c11ed11ec9d733e9bff4e7910f61ecb967a
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[](https://codeclimate.com/github/budev/alpha_card)
|
5
5
|
[](https://coveralls.io/r/budev/alpha_card?branch=master)
|
6
6
|
[](https://travis-ci.org/budev/alpha_card)
|
7
|
+
[](http://inch-ci.org/github/budev/alpha_card)
|
7
8
|
|
8
9
|
This gem can help your Ruby or Ruby on Rails application to integrate with Alpha Card Service, Inc.
|
9
10
|
|
@@ -37,7 +38,6 @@ gem install alpha_card
|
|
37
38
|
Dependencies required:
|
38
39
|
|
39
40
|
* ruby >= 1.9.3;
|
40
|
-
* rack;
|
41
41
|
* rest_client;
|
42
42
|
* virtus (for nice OOP objects of AlphaCard).
|
43
43
|
|
data/alpha_card.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'alpha_card'
|
3
|
-
gem.version = '0.1.
|
4
|
-
gem.date = '2014-
|
3
|
+
gem.version = '0.1.8'
|
4
|
+
gem.date = '2014-07-01'
|
5
5
|
gem.summary = 'Alpha Card Services DirectPost API for Ruby'
|
6
6
|
gem.description = 'Gem for creating sales with Alpha Card Services DirectPost API'
|
7
7
|
gem.authors = ['Nikita Bulaj']
|
data/lib/alpha_card.rb
CHANGED
data/lib/alpha_card/account.rb
CHANGED
data/lib/alpha_card/order.rb
CHANGED
@@ -3,7 +3,7 @@ module AlphaCard
|
|
3
3
|
# Implementation of Alpha Card Services Order object.
|
4
4
|
# Contains all the information about order (id, description, etc).
|
5
5
|
class Order < AlphaCardObject
|
6
|
-
attribute :orderid,
|
6
|
+
attribute :orderid, String
|
7
7
|
attribute :orderdescription, String
|
8
8
|
attribute :ponumber, String
|
9
9
|
attribute :tax, String
|
data/lib/alpha_card/sale.rb
CHANGED
@@ -41,11 +41,11 @@ module AlphaCard
|
|
41
41
|
# #=> true
|
42
42
|
def create(order, account)
|
43
43
|
[:ccexp, :ccnumber, :amount].each do |attr|
|
44
|
-
raise Exception.new("No #{attr} information provided") if self[attr].
|
44
|
+
raise Exception.new("No #{attr} information provided") if self[attr].nil? || self[attr].empty?
|
45
45
|
end
|
46
46
|
|
47
47
|
params = self.filled_attributes || {}
|
48
|
-
[order, order.billing, order.shipping].compact.each { |obj| params.merge!(obj.
|
48
|
+
[order, order.billing, order.shipping].compact.each { |obj| params.merge!(obj ? obj.filled_attributes : {}) }
|
49
49
|
|
50
50
|
AlphaCard.request(params, account).success?
|
51
51
|
end
|
data/lib/alpha_card/utils.rb
CHANGED
@@ -8,7 +8,7 @@ module AlphaCard
|
|
8
8
|
# @see https://github.com/rack/rack rack gem GitHub
|
9
9
|
class << self
|
10
10
|
##
|
11
|
-
# Default separators for query string.
|
11
|
+
# Default separators for the query string.
|
12
12
|
DEFAULT_SEP = /[&;] */n
|
13
13
|
|
14
14
|
# A part of the rack gem.
|
@@ -29,10 +29,15 @@ module AlphaCard
|
|
29
29
|
@params[key] = value
|
30
30
|
end
|
31
31
|
|
32
|
+
##
|
33
|
+
# Returns <code>true</code> if the given key is present
|
34
|
+
# in <i>params</i>.
|
32
35
|
def key?(key)
|
33
36
|
@params.key?(key)
|
34
37
|
end
|
35
38
|
|
39
|
+
##
|
40
|
+
# Converts params to <code>Hash</code> object.
|
36
41
|
def to_params_hash
|
37
42
|
hash = @params
|
38
43
|
hash.keys.each do |key|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alpha_card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Bulaj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -45,7 +45,6 @@ files:
|
|
45
45
|
- lib/alpha_card/alpha_card_response.rb
|
46
46
|
- lib/alpha_card/billing.rb
|
47
47
|
- lib/alpha_card/data/codes.yml
|
48
|
-
- lib/alpha_card/object.rb
|
49
48
|
- lib/alpha_card/order.rb
|
50
49
|
- lib/alpha_card/sale.rb
|
51
50
|
- lib/alpha_card/shipping.rb
|
data/lib/alpha_card/object.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Some stolen methods from the active_support gem.
|
3
|
-
# For the clear dependencies.
|
4
|
-
# @todo Remove this class, rewrite library code
|
5
|
-
class Object
|
6
|
-
# An object is blank if it's false, empty, or a whitespace string.
|
7
|
-
# For example, '', ' ', +nil+, [], and {} are all blank.
|
8
|
-
#
|
9
|
-
# This simplifies
|
10
|
-
#
|
11
|
-
# address.nil? || address.empty?
|
12
|
-
#
|
13
|
-
# to
|
14
|
-
#
|
15
|
-
# address.blank?
|
16
|
-
#
|
17
|
-
# @return [true, false]
|
18
|
-
def blank?
|
19
|
-
respond_to?(:empty?) ? !!empty? : !self
|
20
|
-
end
|
21
|
-
|
22
|
-
# An object is present if it's not blank.
|
23
|
-
#
|
24
|
-
# @return [true, false]
|
25
|
-
def present?
|
26
|
-
!blank?
|
27
|
-
end
|
28
|
-
|
29
|
-
# Invokes the public method whose name goes as first argument just like
|
30
|
-
# +public_send+ does, except that if the receiver does not respond to it the
|
31
|
-
# call returns +nil+ rather than raising an exception.
|
32
|
-
#
|
33
|
-
# This method is defined to be able to write
|
34
|
-
#
|
35
|
-
# @person.try(:name)
|
36
|
-
#
|
37
|
-
# instead of
|
38
|
-
#
|
39
|
-
# @person ? @person.name : nil
|
40
|
-
#
|
41
|
-
# +try+ returns +nil+ when called on +nil+ regardless of whether it responds
|
42
|
-
# to the method:
|
43
|
-
#
|
44
|
-
# nil.try(:to_i) # => nil, rather than 0
|
45
|
-
def try(*a, &b)
|
46
|
-
if a.empty? && block_given?
|
47
|
-
yield self
|
48
|
-
else
|
49
|
-
public_send(*a, &b) if respond_to?(a.first)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|