mollie-api-ruby 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,39 +1,51 @@
1
1
  module Mollie
2
- module API
3
- module Object
4
- class Payment < Base
5
- STATUS_OPEN = "open"
6
- STATUS_CANCELLED = "cancelled"
7
- STATUS_EXPIRED = "expired"
8
- STATUS_PAID = "paid"
9
- STATUS_PAIDOUT = "paidout"
2
+ module API
3
+ module Object
4
+ class Payment < Base
5
+ STATUS_OPEN = "open"
6
+ STATUS_CANCELLED = "cancelled"
7
+ STATUS_EXPIRED = "expired"
8
+ STATUS_PAID = "paid"
9
+ STATUS_PAIDOUT = "paidout"
10
10
 
11
- attr_accessor :id,
12
- :status,
13
- :mode,
14
- :amount,
15
- :description,
16
- :method,
17
- :createdDatetime,
18
- :paidDatetime,
19
- :expiredDatetime,
20
- :cancelledDatetime,
21
- :metadata,
22
- :details,
23
- :links
11
+ attr_accessor :id,
12
+ :status,
13
+ :mode,
14
+ :amount,
15
+ :description,
16
+ :method,
17
+ :createdDatetime,
18
+ :paidDatetime,
19
+ :expiredDatetime,
20
+ :cancelledDatetime,
21
+ :metadata,
22
+ :details,
23
+ :links
24
24
 
25
- def open? ()
26
- @status == STATUS_OPEN
27
- end
25
+ def open?
26
+ @status == STATUS_OPEN
27
+ end
28
28
 
29
- def paid? ()
30
- !@paidDatetime.nil?
31
- end
29
+ def cancelled?
30
+ @status == STATUS_CANCELLED
31
+ end
32
+
33
+ def expired?
34
+ @status == STATUS_EXPIRED
35
+ end
32
36
 
33
- def getPaymentUrl ()
34
- @links && @links.paymentUrl
35
- end
36
- end
37
- end
38
- end
37
+ def paid?
38
+ !@paidDatetime.nil?
39
+ end
40
+
41
+ def paidout?
42
+ @status == STATUS_PAIDOUT
43
+ end
44
+
45
+ def getPaymentUrl
46
+ @links && @links.paymentUrl
47
+ end
48
+ end
49
+ end
50
+ end
39
51
  end
@@ -1,15 +1,15 @@
1
1
  module Mollie
2
- module API
3
- module Object
4
- class Payment
5
- class Refund < Base
6
- attr_accessor :id,
7
- :amountRefunded,
8
- :amountRemaining,
9
- :payment,
10
- :refundedDatetime
11
- end
12
- end
13
- end
14
- end
15
- end
2
+ module API
3
+ module Object
4
+ class Payment
5
+ class Refund < Base
6
+ attr_accessor :id,
7
+ :amountRefunded,
8
+ :amountRemaining,
9
+ :payment,
10
+ :refundedDatetime
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,53 +1,53 @@
1
1
  module Mollie
2
- module API
3
- module Resource
4
- class Base
5
- def initialize (client)
6
- @client = client
7
- end
8
-
9
- def getResourceName ()
10
- self.class.name.downcase.split("::").slice(3..-1).join "/"
11
- end
12
-
13
- def create (data = {})
14
- request("POST", nil, data) { |response|
15
- newResourceObject response
16
- }
17
- end
18
-
19
- def get (id)
20
- request("GET", id, {}) { |response|
21
- newResourceObject response
22
- }
23
- end
24
-
25
- def update (id, data = {})
26
- request("POST", id, data) { |response|
27
- newResourceObject response
28
- }
29
- end
30
-
31
- def delete (id)
32
- request "DELETE", id, {}
33
- end
34
-
35
- def all ()
36
- request("GET", nil, {}) { |response|
37
- Mollie::API::Object::List.new response, getResourceObject
38
- }
39
- end
40
-
41
- def newResourceObject (response)
42
- getResourceObject.new response
43
- end
44
-
45
- def request (method, id = 0, data = {})
46
- response = @client.performHttpCall method, getResourceName, id, data
47
-
48
- yield(response) if block_given?
49
- end
50
- end
51
- end
52
- end
2
+ module API
3
+ module Resource
4
+ class Base
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def getResourceName
10
+ self.class.name.downcase.split("::").slice(3..-1).join "/"
11
+ end
12
+
13
+ def create(data = {})
14
+ request("POST", nil, data) { |response|
15
+ newResourceObject response
16
+ }
17
+ end
18
+
19
+ def get(id)
20
+ request("GET", id, {}) { |response|
21
+ newResourceObject response
22
+ }
23
+ end
24
+
25
+ def update(id, data = {})
26
+ request("POST", id, data) { |response|
27
+ newResourceObject response
28
+ }
29
+ end
30
+
31
+ def delete(id)
32
+ request "DELETE", id, {}
33
+ end
34
+
35
+ def all
36
+ request("GET", nil, {}) { |response|
37
+ Mollie::API::Object::List.new response, getResourceObject
38
+ }
39
+ end
40
+
41
+ def newResourceObject(response)
42
+ getResourceObject.new response
43
+ end
44
+
45
+ def request(method, id = 0, data = {})
46
+ response = @client.performHttpCall method, getResourceName, id, data
47
+
48
+ yield(response) if block_given?
49
+ end
50
+ end
51
+ end
52
+ end
53
53
  end
@@ -1,11 +1,11 @@
1
1
  module Mollie
2
- module API
3
- module Resource
4
- class Issuers < Base
5
- def getResourceObject ()
6
- Mollie::API::Object::Issuer
7
- end
8
- end
9
- end
10
- end
2
+ module API
3
+ module Resource
4
+ class Issuers < Base
5
+ def getResourceObject
6
+ Mollie::API::Object::Issuer
7
+ end
8
+ end
9
+ end
10
+ end
11
11
  end
@@ -1,11 +1,11 @@
1
1
  module Mollie
2
- module API
3
- module Resource
4
- class Methods < Base
5
- def getResourceObject ()
6
- Mollie::API::Object::Method
7
- end
8
- end
9
- end
10
- end
2
+ module API
3
+ module Resource
4
+ class Methods < Base
5
+ def getResourceObject
6
+ Mollie::API::Object::Method
7
+ end
8
+ end
9
+ end
10
+ end
11
11
  end
@@ -1,11 +1,11 @@
1
1
  module Mollie
2
- module API
3
- module Resource
4
- class Payments < Base
5
- def getResourceObject ()
6
- Mollie::API::Object::Payment
7
- end
8
- end
9
- end
10
- end
2
+ module API
3
+ module Resource
4
+ class Payments < Base
5
+ def getResourceObject
6
+ Mollie::API::Object::Payment
7
+ end
8
+ end
9
+ end
10
+ end
11
11
  end
@@ -1,27 +1,27 @@
1
1
  require 'open-uri'
2
2
 
3
3
  module Mollie
4
- module API
5
- module Resource
6
- class Payments
7
- class Refunds < Base
8
- @payment_id = nil
4
+ module API
5
+ module Resource
6
+ class Payments
7
+ class Refunds < Base
8
+ @payment_id = nil
9
9
 
10
- def getResourceObject ()
11
- Mollie::API::Object::Payment::Refund
12
- end
10
+ def getResourceObject
11
+ Mollie::API::Object::Payment::Refund
12
+ end
13
13
 
14
- def getResourceName ()
15
- payment_id = URI::encode(@payment_id)
16
- "payments/#{payment_id}/refunds"
17
- end
14
+ def getResourceName
15
+ payment_id = URI::encode(@payment_id)
16
+ "payments/#{payment_id}/refunds"
17
+ end
18
18
 
19
- def with (payment)
20
- @payment_id = payment.id
21
- self
22
- end
23
- end
24
- end
25
- end
26
- end
19
+ def with(payment)
20
+ @payment_id = payment.id
21
+ self
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
27
  end
@@ -20,4 +20,4 @@ spec = Gem::Specification.new do |s|
20
20
  s.test_files = `git ls-files -- test/*`.split("\n")
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  s.require_paths = ['lib']
23
- end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Wong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2014-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.2.2
97
+ rubygems_version: 2.4.5
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Official Mollie API Client for Ruby