paid 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/paid/api_class.rb +5 -3
- data/lib/paid/customer.rb +1 -3
- data/lib/paid/transaction.rb +7 -8
- data/test/paid/customer_test.rb +0 -12
- data/test/paid/transaction_test.rb +0 -4
- data/test/test_data.rb +0 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bda48a84419fc70d7200704ab421c9b4980e49a
|
4
|
+
data.tar.gz: 4ac182f0c95b23739c0ee2346b3b3b73874b999f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae4a45c77debf4fe5cccff176525159bcf74d72e0e2700028321c63d21b906df022ad33dfe306c7d1cf91bba5329de65b7062b023afb10e2797b579725c84e40
|
7
|
+
data.tar.gz: 3fe73b9564435a8824ad55f99954c85e5e303c4ae8a915440ad37c27cc197e319381ec0ece68e916ce5b912d0556b4a421368f4bd0d52b3c842fa64ff909c378
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/paid/api_class.rb
CHANGED
@@ -35,7 +35,7 @@ module Paid
|
|
35
35
|
attributes
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def non_nil_attributes
|
39
39
|
attributes.select{|k, v| !v.nil? }
|
40
40
|
end
|
41
41
|
|
@@ -136,11 +136,11 @@ module Paid
|
|
136
136
|
|
137
137
|
def inspect
|
138
138
|
id_string = (self.respond_to?(:id) && !self.id.nil?) ? " id=#{self.id}" : ""
|
139
|
-
"#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(
|
139
|
+
"#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(attributes)
|
140
140
|
end
|
141
141
|
|
142
142
|
def to_json(*a)
|
143
|
-
JSON.generate(
|
143
|
+
JSON.generate(attributes)
|
144
144
|
end
|
145
145
|
|
146
146
|
|
@@ -204,6 +204,8 @@ module Paid
|
|
204
204
|
resp = Paid.request(method, composed_path, arguments[:params], arguments[:opts])
|
205
205
|
|
206
206
|
|
207
|
+
puts "Making a call to #{composed_path}"
|
208
|
+
|
207
209
|
if constructor.is_a?(Class)
|
208
210
|
constructor.construct(resp)
|
209
211
|
elsif constructor.is_a?(Proc)
|
data/lib/paid/customer.rb
CHANGED
@@ -5,7 +5,6 @@ module Paid
|
|
5
5
|
attribute :email
|
6
6
|
attribute :description
|
7
7
|
attribute :external_id
|
8
|
-
attribute :aliases, APIList
|
9
8
|
attribute :phone
|
10
9
|
attribute :address_line1
|
11
10
|
attribute :address_line2
|
@@ -24,8 +23,7 @@ module Paid
|
|
24
23
|
api_class_method :all, :get, :constructor => APIList.constructor(Customer)
|
25
24
|
api_class_method :retrieve, :get, ":path/:id", :arguments => [:id]
|
26
25
|
api_class_method :create, :post
|
27
|
-
api_class_method :
|
28
|
-
api_class_method :by_external_id, :get, ":path/by_external_id/:external_id", :arguments => [:external_id]
|
26
|
+
api_class_method :by_external_id, :get, ":path/by_external_id", :arguments => [:external_id]
|
29
27
|
|
30
28
|
api_instance_method :save, :put, :default_params => :changed_attributes
|
31
29
|
api_instance_method :generate_invoice, :post, ":path/generate_invoice", :constructor => Invoice
|
data/lib/paid/transaction.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
module Paid
|
2
2
|
class Transaction < APIResource
|
3
3
|
# attributes :id and :object inherited from APIResource
|
4
|
-
attribute :amount
|
5
|
-
attribute :description
|
6
|
-
attribute :customer
|
7
|
-
attribute :
|
8
|
-
attribute :
|
9
|
-
attribute :
|
10
|
-
attribute :
|
11
|
-
attribute :invoice # invalid for create
|
4
|
+
attribute :amount
|
5
|
+
attribute :description
|
6
|
+
attribute :customer
|
7
|
+
attribute :paid
|
8
|
+
attribute :paid_on
|
9
|
+
attribute :properties
|
10
|
+
attribute :invoice
|
12
11
|
|
13
12
|
api_class_method :create, :post
|
14
13
|
api_class_method :retrieve, :get, ":path/:id", :arguments => [:id]
|
data/test/paid/customer_test.rb
CHANGED
@@ -14,13 +14,6 @@ module Paid
|
|
14
14
|
assert(customer.is_a?(Paid::Customer))
|
15
15
|
end
|
16
16
|
|
17
|
-
should 'be retrieveable by alias' do
|
18
|
-
al = "alias_for_cust"
|
19
|
-
@mock.expects(:get).once.with("#{Paid.api_base}/v0/aliases/#{al}", anything, anything).returns(test_response(test_customer))
|
20
|
-
customer = Paid::Customer.by_alias(al)
|
21
|
-
assert(customer.is_a?(Paid::Customer))
|
22
|
-
end
|
23
|
-
|
24
17
|
should 'be retrieveable by external_id' do
|
25
18
|
external_id = "external_id_for_cust"
|
26
19
|
@mock.expects(:get).once.with("#{@customer_url}/by_external_id/#{external_id}", anything, anything).returns(test_response(test_customer))
|
@@ -188,11 +181,6 @@ module Paid
|
|
188
181
|
assert_equal(test_customer[:external_id], @customer.external_id)
|
189
182
|
end
|
190
183
|
|
191
|
-
should 'have & convert the aliases attribute' do
|
192
|
-
assert(@customer.aliases.is_a?(Paid::APIList))
|
193
|
-
assert_equal(test_customer[:aliases][:data], @customer.aliases.data)
|
194
|
-
end
|
195
|
-
|
196
184
|
end
|
197
185
|
|
198
186
|
should 'be registered' do
|
@@ -96,10 +96,6 @@ module Paid
|
|
96
96
|
assert_equal(test_transaction[:customer], @transaction.customer)
|
97
97
|
end
|
98
98
|
|
99
|
-
should 'have the alias attribute' do
|
100
|
-
assert_equal(test_transaction[:alias], @transaction.alias)
|
101
|
-
end
|
102
|
-
|
103
99
|
should 'have the paid attribute' do
|
104
100
|
assert_equal(test_transaction[:paid], @transaction.paid)
|
105
101
|
end
|
data/test/test_data.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Calhoun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
197
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.2.2
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: Ruby bindings for Paid API
|