paid 0.0.3 → 0.0.4
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/Gemfile.lock +1 -1
- data/lib/paid/api_operations/create.rb +1 -1
- data/lib/paid/api_operations/delete.rb +1 -1
- data/lib/paid/api_operations/list.rb +1 -1
- data/lib/paid/api_operations/update.rb +1 -1
- data/lib/paid/api_resource.rb +4 -4
- data/lib/paid/customer.rb +1 -1
- data/lib/paid/invoice.rb +12 -1
- data/lib/paid/singleton_api_resource.rb +3 -3
- data/lib/paid/version.rb +1 -1
- data/pkg/paid-0.0.3.gem +0 -0
- data/test/paid/invoice_test.rb +10 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6062c2c505109c0f6ba17a37be0987381587a8bf
|
4
|
+
data.tar.gz: 7aaab841f57542a5340fe66cd62c1073a6c34727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6349aae78e7450501f501f3cb7ec54293fd24e82179cd843c7fbdffb8bc3ee7cce721471051bdfa412462e8892ddb2cfc475a0af31a1b328f2de1be0e90fac18
|
7
|
+
data.tar.gz: 0dd7773d9b5fa24bb025f396196cc2f000454e3edb202395849f0a194b76674006e20a1c7eb9318ec3a61832728ca0e200289f8267f489b7b4134e66ac99dfd3
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@ module Paid
|
|
4
4
|
module ClassMethods
|
5
5
|
def create(params={}, opts={})
|
6
6
|
api_key, headers = Util.parse_opts(opts)
|
7
|
-
response, api_key = Paid.request(:post, self.
|
7
|
+
response, api_key = Paid.request(:post, self.api_url, api_key, params, headers)
|
8
8
|
Util.convert_to_paid_object(response, api_key)
|
9
9
|
end
|
10
10
|
end
|
@@ -3,7 +3,7 @@ module Paid
|
|
3
3
|
module Delete
|
4
4
|
def delete(params = {}, opts={})
|
5
5
|
api_key, headers = Util.parse_opts(opts)
|
6
|
-
response, api_key = Paid.request(:delete,
|
6
|
+
response, api_key = Paid.request(:delete, api_url, api_key || @api_key, params, headers)
|
7
7
|
refresh_from(response, api_key)
|
8
8
|
end
|
9
9
|
end
|
@@ -4,7 +4,7 @@ module Paid
|
|
4
4
|
module ClassMethods
|
5
5
|
def all(filters={}, opts={})
|
6
6
|
api_key, headers = Util.parse_opts(opts)
|
7
|
-
response, api_key = Paid.request(:get,
|
7
|
+
response, api_key = Paid.request(:get, api_url, api_key, filters, headers)
|
8
8
|
Util.convert_to_paid_object(response, api_key)
|
9
9
|
end
|
10
10
|
end
|
data/lib/paid/api_resource.rb
CHANGED
@@ -4,7 +4,7 @@ module Paid
|
|
4
4
|
self.name.split('::')[-1]
|
5
5
|
end
|
6
6
|
|
7
|
-
def self.
|
7
|
+
def self.api_url
|
8
8
|
if self == APIResource
|
9
9
|
raise NotImplementedError.new('APIResource is an abstract class. You should perform actions on its subclasses (Transaction, Customer, etc.)')
|
10
10
|
end
|
@@ -12,15 +12,15 @@ module Paid
|
|
12
12
|
"/v0/#{CGI.escape(class_name.downcase).pluralize}"
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def api_url
|
16
16
|
unless id = self['id']
|
17
17
|
raise InvalidRequestError.new("Could not determine which URL to request: #{self.class} instance has invalid ID: #{id.inspect}", 'id')
|
18
18
|
end
|
19
|
-
"#{self.class.
|
19
|
+
"#{self.class.api_url}/#{CGI.escape(id)}"
|
20
20
|
end
|
21
21
|
|
22
22
|
def refresh
|
23
|
-
response, api_key = Paid.request(:get,
|
23
|
+
response, api_key = Paid.request(:get, api_url, @api_key, @retrieve_options)
|
24
24
|
refresh_from(response, api_key)
|
25
25
|
end
|
26
26
|
|
data/lib/paid/customer.rb
CHANGED
data/lib/paid/invoice.rb
CHANGED
@@ -11,10 +11,21 @@ module Paid
|
|
11
11
|
refresh_from(response, api_key)
|
12
12
|
end
|
13
13
|
|
14
|
+
def mark_as_paid(params={}, opts={})
|
15
|
+
api_key, headers = Util.parse_opts(opts)
|
16
|
+
response, api_key = Paid.request(
|
17
|
+
:post, mark_as_paid_url, api_key || @api_key, params, headers)
|
18
|
+
refresh_from(response, api_key)
|
19
|
+
end
|
20
|
+
|
14
21
|
private
|
15
22
|
|
16
23
|
def issue_url
|
17
|
-
|
24
|
+
api_url + '/issue'
|
25
|
+
end
|
26
|
+
|
27
|
+
def mark_as_paid_url
|
28
|
+
api_url + '/mark_as_paid'
|
18
29
|
end
|
19
30
|
end
|
20
31
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Paid
|
2
2
|
class SingletonAPIResource < APIResource
|
3
|
-
def self.
|
3
|
+
def self.api_url
|
4
4
|
if self == SingletonAPIResource
|
5
5
|
raise NotImplementedError.new('SingletonAPIResource is an abstract class. You should perform actions on its subclasses (Account, etc.)')
|
6
6
|
end
|
7
7
|
"/v0/#{CGI.escape(class_name.downcase)}"
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
self.class.
|
10
|
+
def api_url
|
11
|
+
self.class.api_url
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.retrieve(api_key=nil)
|
data/lib/paid/version.rb
CHANGED
data/pkg/paid-0.0.3.gem
ADDED
Binary file
|
data/test/paid/invoice_test.rb
CHANGED
@@ -16,10 +16,18 @@ module Paid
|
|
16
16
|
|
17
17
|
should "charges should be issuable" do
|
18
18
|
@mock.expects(:get).never
|
19
|
-
@mock.expects(:post).once.returns(test_response({:id => "
|
20
|
-
i = Paid::Invoice.new("
|
19
|
+
@mock.expects(:post).once.returns(test_response({:id => "inv_test_invoice", :issued_at => 123467890}))
|
20
|
+
i = Paid::Invoice.new("test_invoice")
|
21
21
|
i.issue
|
22
22
|
assert !i.issued_at.nil?
|
23
23
|
end
|
24
|
+
|
25
|
+
should "charges should be able to be marked as paid" do
|
26
|
+
@mock.expects(:get).never
|
27
|
+
@mock.expects(:post).once.returns(test_response({:id => "inv_test_invoice", :paid => true}))
|
28
|
+
i = Paid::Invoice.new("test_invoice")
|
29
|
+
i.mark_as_paid
|
30
|
+
assert i.paid
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Jackson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- paid.gemspec
|
156
156
|
- pkg/paid-0.0.1.gem
|
157
157
|
- pkg/paid-0.0.2.gem
|
158
|
+
- pkg/paid-0.0.3.gem
|
158
159
|
- test/paid/account_test.rb
|
159
160
|
- test/paid/alias_test.rb
|
160
161
|
- test/paid/api_resource_test.rb
|