moip2 0.1.4 → 1.0.0

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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +644 -0
  3. data/.travis.yml +14 -3
  4. data/CONTRIBUTING.md +42 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +25 -6
  7. data/Guardfile +1 -2
  8. data/README.md +373 -74
  9. data/Rakefile +2 -2
  10. data/changelog.md +36 -0
  11. data/lib/moip2/accounts_api.rb +27 -0
  12. data/lib/moip2/api.rb +25 -2
  13. data/lib/moip2/auth/basic.rb +2 -5
  14. data/lib/moip2/auth/oauth.rb +0 -3
  15. data/lib/moip2/client.rb +45 -31
  16. data/lib/moip2/connect_api.rb +41 -0
  17. data/lib/moip2/customer_api.rb +16 -2
  18. data/lib/moip2/exceptions/invalid_enviroment_error.rb +0 -2
  19. data/lib/moip2/invoice_api.rb +8 -3
  20. data/lib/moip2/keys_api.rb +14 -14
  21. data/lib/moip2/multi_order_api.rb +1 -3
  22. data/lib/moip2/multi_payment_api.rb +1 -1
  23. data/lib/moip2/notifications_api.rb +33 -0
  24. data/lib/moip2/order_api.rb +18 -3
  25. data/lib/moip2/payment_api.rb +11 -1
  26. data/lib/moip2/refund_api.rb +5 -4
  27. data/lib/moip2/resource/account.rb +12 -0
  28. data/lib/moip2/resource/connect.rb +9 -0
  29. data/lib/moip2/resource/credit_card.rb +12 -0
  30. data/lib/moip2/resource/customer.rb +0 -4
  31. data/lib/moip2/resource/invoice.rb +0 -2
  32. data/lib/moip2/resource/keys.rb +1 -3
  33. data/lib/moip2/resource/multi_order.rb +2 -6
  34. data/lib/moip2/resource/multi_payment.rb +1 -3
  35. data/lib/moip2/resource/notification.rb +12 -0
  36. data/lib/moip2/resource/order.rb +0 -4
  37. data/lib/moip2/resource/payment.rb +0 -4
  38. data/lib/moip2/resource/refund.rb +1 -2
  39. data/lib/moip2/resource/webhooks.rb +11 -13
  40. data/lib/moip2/response.rb +7 -7
  41. data/lib/moip2/util/filters_encoder.rb +28 -0
  42. data/lib/moip2/version.rb +1 -1
  43. data/lib/moip2/webhooks_api.rb +16 -16
  44. data/lib/moip2.rb +10 -5
  45. data/moip2.gemspec +21 -7
  46. data/spec/moip2/accounts_api_spec.rb +189 -0
  47. data/spec/moip2/api_spec.rb +22 -4
  48. data/spec/moip2/auth/basic_spec.rb +8 -4
  49. data/spec/moip2/auth/oauth_spec.rb +4 -4
  50. data/spec/moip2/client_spec.rb +20 -27
  51. data/spec/moip2/connect_api_spec.rb +68 -0
  52. data/spec/moip2/customer_api_spec.rb +147 -72
  53. data/spec/moip2/invoice_spec.rb +51 -32
  54. data/spec/moip2/keys_spec.rb +16 -18
  55. data/spec/moip2/multi_order_api_spec.rb +99 -108
  56. data/spec/moip2/multi_payment_api_spec.rb +8 -11
  57. data/spec/moip2/notifications_api_spec.rb +104 -0
  58. data/spec/moip2/order_api_spec.rb +100 -20
  59. data/spec/moip2/payment_api_spec.rb +77 -17
  60. data/spec/moip2/refund_api_spec.rb +2 -4
  61. data/spec/moip2/resource/order_spec.rb +24 -28
  62. data/spec/moip2/response_spec.rb +0 -8
  63. data/spec/moip2/webhooks_spec.rb +18 -21
  64. data/spec/moip2_spec.rb +6 -13
  65. data/spec/spec_helper.rb +24 -10
  66. data/vcr_cassettes/_create_invoice.yml +42 -0
  67. data/vcr_cassettes/_get_invoice.yml +41 -0
  68. data/vcr_cassettes/account_doesnt_exist.yml +44 -0
  69. data/vcr_cassettes/account_exists.yml +46 -0
  70. data/vcr_cassettes/accounts_show_existent.yml +50 -0
  71. data/vcr_cassettes/accounts_show_nonexistent.yml +42 -0
  72. data/vcr_cassettes/cancel_payment.yml +43 -0
  73. data/vcr_cassettes/capture_payment.yml +42 -0
  74. data/vcr_cassettes/create_account_success_company.yml +87 -0
  75. data/vcr_cassettes/create_account_success_standalone.yml +74 -0
  76. data/vcr_cassettes/create_credit_card_customer.yml +41 -0
  77. data/vcr_cassettes/create_invoice.yml +10 -16
  78. data/vcr_cassettes/create_notification.yml +38 -0
  79. data/vcr_cassettes/create_notification_app.yml +38 -0
  80. data/vcr_cassettes/delete_credit_card_customer.yml +40 -0
  81. data/vcr_cassettes/delete_nonexistent_credit_card_customer.yml +40 -0
  82. data/vcr_cassettes/delete_nonexistent_notification.yml +40 -0
  83. data/vcr_cassettes/delete_notification.yml +36 -0
  84. data/vcr_cassettes/find_all_orders_filters.yml +56 -0
  85. data/vcr_cassettes/find_all_orders_limit.yml +48 -0
  86. data/vcr_cassettes/find_all_orders_multi_filters.yml +57 -0
  87. data/vcr_cassettes/find_all_orders_no_filter.yml +56 -0
  88. data/vcr_cassettes/generate_oauth_token.yml +42 -0
  89. data/vcr_cassettes/get_invoice.yml +10 -15
  90. data/vcr_cassettes/get_keys.yml +1 -1
  91. data/vcr_cassettes/get_notification.yml +38 -0
  92. data/vcr_cassettes/get_notifications_list.yml +38 -0
  93. data/vcr_cassettes/get_payment.yml +42 -0
  94. data/vcr_cassettes/get_payment_not_found.yml +40 -0
  95. data/vcr_cassettes/get_webhooks.yml +1 -1
  96. data/vcr_cassettes/list_invoices.yml +2 -2
  97. data/vcr_cassettes/refresh_oauth_token.yml +40 -0
  98. data/vcr_cassettes/update_invoice.yml +1 -1
  99. metadata +69 -7
data/changelog.md ADDED
@@ -0,0 +1,36 @@
1
+ <a name="1.0.0"></a>
2
+ ## 1.0.0 (2017-09-26)
3
+
4
+
5
+ #### Features
6
+
7
+ * Create method to generate OAuth token ((cc5dcad7))
8
+ * **Accounts**
9
+ * added `create` method and Account resource ((a8ec5469))
10
+ * added `create` method and Account resource ((399b49b9))
11
+ * added #show ((1da02bee))
12
+ * added #exists? ((e97fbd2d))
13
+ * added #show ((cebf937a))
14
+ * added #exists? ((d75ad84c))
15
+ * **Connect** Create method to generate authorize url ((8fcbd67d))
16
+ * **Customer**
17
+ * Overload method to delete credit card ((1b920029))
18
+ * Create method to delete a credit card from customer ((71e1b6a9))
19
+ * Create method to add credit card to customer ((edc5c67e))
20
+ * **Notifications**
21
+ * Add method to delete a notification preference ((79354cb0))
22
+ * Add parameter to create notification to apps ((98735f0a))
23
+ * Add method to find all notification preferences ((c97383f0))
24
+ * Add method to get a notification ((7e853d6c))
25
+ * Add method to create notification preference ((80c09bbb))
26
+ * **Payment** Add show, void and capture methods to Payment ((4f266390))
27
+ * **Api**
28
+ * Added .accounts ((4ed3d625))
29
+ * **Order**
30
+ * added `filters` support to `find_all` ((55d3cb8b))
31
+ * added `find_all` ((7e66c07d))
32
+ * **Response**
33
+ * added ability to handle non-json response payloads ((526e53d6))
34
+
35
+
36
+
@@ -0,0 +1,27 @@
1
+ module Moip2
2
+ class AccountsApi
3
+ attr_reader :client
4
+
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def base_path
10
+ "/v2/accounts"
11
+ end
12
+
13
+ def create(account)
14
+ Resource::Account.new client, client.post(base_path, account)
15
+ end
16
+
17
+ def exists?(tax_document)
18
+ response = client.get("#{base_path}/exists?tax_document=#{tax_document}")
19
+
20
+ response.success?
21
+ end
22
+
23
+ def show(id)
24
+ Resource::Account.new client, client.get("#{base_path}/#{id}")
25
+ end
26
+ end
27
+ end
data/lib/moip2/api.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module Moip2
2
-
3
2
  class Api
4
3
  attr_reader :client
5
4
 
@@ -27,6 +26,30 @@ module Moip2
27
26
  Moip2::KeysApi.new(client)
28
27
  end
29
28
 
30
- end
29
+ def customer
30
+ Moip2::CustomerApi.new(client)
31
+ end
32
+
33
+ def multi_order
34
+ Moip2::MultiOrderApi.new(client)
35
+ end
36
+
37
+ def multi_payment
38
+ Moip2::MultiPaymentApi.new(client)
39
+ end
31
40
 
41
+ def accounts
42
+ Moip2::AccountsApi.new(client)
43
+ end
44
+
45
+ def connect
46
+ host = Moip2::ConnectApi.host(client.env)
47
+ connect_client = Client.new(client.env, client.auth, host, client.opts)
48
+ Moip2::ConnectApi.new(connect_client)
49
+ end
50
+
51
+ def notifications
52
+ Moip2::NotificationsApi.new(client)
53
+ end
54
+ end
32
55
  end
@@ -2,18 +2,15 @@ require "base64"
2
2
 
3
3
  module Moip2
4
4
  module Auth
5
-
6
5
  class Basic
7
-
8
6
  def initialize(token, secret)
9
- @token, @secret = token, secret
7
+ @token = token
8
+ @secret = secret
10
9
  end
11
10
 
12
11
  def header
13
12
  %(Basic #{Base64.strict_encode64("#{@token}:#{@secret}")})
14
13
  end
15
-
16
14
  end
17
-
18
15
  end
19
16
  end
@@ -1,6 +1,5 @@
1
1
  module Moip2
2
2
  module Auth
3
-
4
3
  class OAuth
5
4
  def initialize(oauth)
6
5
  @oauth = oauth
@@ -11,8 +10,6 @@ module Moip2
11
10
 
12
11
  %(OAuth #{@oauth})
13
12
  end
14
-
15
13
  end
16
-
17
14
  end
18
15
  end
data/lib/moip2/client.rb CHANGED
@@ -1,14 +1,15 @@
1
1
  module Moip2
2
-
3
2
  class Client
4
3
  include HTTParty
5
4
 
6
5
  attr_reader :env, :auth, :uri
7
6
 
8
- def initialize(env = :sandbox, auth = nil, opts = {})
9
- @env, @auth, @opts = env.to_sym, auth, opts
7
+ def initialize(env = :sandbox, auth = nil, host = get_base_uri(env), opts = {})
8
+ @env = env.to_sym
9
+ @auth = auth
10
+ @opts = opts
10
11
 
11
- @uri = get_base_uri
12
+ @uri = host
12
13
  self.class.base_uri @uri
13
14
  end
14
15
 
@@ -25,45 +26,54 @@ module Moip2
25
26
  opts[:headers] ||= {}
26
27
 
27
28
  opts[:headers].merge!(
28
- {
29
- "Content-Type" => "application/json",
30
- "Authorization" => auth.header
31
- }
29
+ "Content-Type" => "application/json",
30
+ "Authorization" => auth.header,
31
+ "User-Agent" => "MoipRubySDK/#{Moip2::VERSION} (+https://github.com/moip/moip-sdk-ruby)",
32
32
  )
33
33
 
34
34
  opts
35
35
  end
36
36
 
37
- def post(path, resource)
38
- options = opts().merge(body: convert_hash_keys_to(:camel_case, resource).to_json)
37
+ def post(path, resource, content_type = "application/json")
38
+ new_opts = opts
39
+ new_opts[:headers]["Content-Type"] = content_type
40
+ options = new_opts.merge(body: encode_resource(content_type, resource))
41
+
39
42
  resp = self.class.post path, options
40
43
  create_response resp
41
44
  end
42
45
 
43
46
  def put(path, resource)
44
- options = opts().merge(body: convert_hash_keys_to(:camel_case, resource).to_json)
47
+ options = opts.merge(body: convert_hash_keys_to(:camel_case, resource).to_json)
45
48
  resp = self.class.put path, options
46
49
 
47
50
  create_response resp
48
51
  end
49
52
 
53
+ def delete(path)
54
+ resp = self.class.delete path, opts
55
+
56
+ create_response resp
57
+ end
58
+
50
59
  def get(path)
51
- resp = self.class.get path, opts()
60
+ resp = self.class.get path, opts
52
61
 
53
62
  create_response resp
54
63
  end
55
64
 
56
65
  private
57
66
 
58
- def get_base_uri
67
+ def get_base_uri(env)
59
68
  return ENV["base_uri"] if ENV["base_uri"]
60
69
 
70
+ @env = env.to_sym
71
+
61
72
  if production?
62
73
  "https://api.moip.com.br"
63
74
  else
64
75
  "https://sandbox.moip.com.br"
65
76
  end
66
-
67
77
  end
68
78
 
69
79
  def create_response(resp)
@@ -73,34 +83,38 @@ module Moip2
73
83
  end
74
84
 
75
85
  def basic_auth
76
- { username: @auth[:token], password: @auth[:secret]}
86
+ { username: @auth[:token], password: @auth[:secret] }
77
87
  end
78
88
 
79
89
  def convert_hash_keys_to(conversion, value)
80
90
  case value
81
- when Array
82
- value.map { |v| convert_hash_keys_to(conversion, v) }
83
- when Hash
84
- Hash[value.map { |k, v| [send(conversion, k).to_sym, convert_hash_keys_to(conversion, v)] }]
85
- else
86
- value
87
- end
91
+ when Array
92
+ value.map { |v| convert_hash_keys_to(conversion, v) }
93
+ when Hash
94
+ Hash[value.map { |k, v| [send(conversion, k).to_sym, convert_hash_keys_to(conversion, v)] }]
95
+ else
96
+ value
97
+ end
98
+ end
99
+
100
+ def encode_resource(content_type, resource)
101
+ return URI.encode_www_form(resource) if content_type == "application/x-www-form-urlencoded"
102
+
103
+ convert_hash_keys_to(:camel_case, resource).to_json
88
104
  end
89
105
 
90
106
  def camel_case(str)
91
107
  return str.to_s if str.to_s !~ /_/ && str.to_s =~ /[A-Z]+.*/
92
- words = str.to_s.split('_')
93
- (words[0..0] << words[1..-1].map{|e| e.capitalize}).join
108
+ words = str.to_s.split("_")
109
+ (words[0..0] << words[1..-1].map(&:capitalize)).join
94
110
  end
95
111
 
96
112
  def snake_case(str)
97
- str.gsub(/::/, '/').
98
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
99
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
100
- tr("-", "_").
101
- downcase
113
+ str.gsub(/::/, "/").
114
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
115
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
116
+ tr("-", "_").
117
+ downcase
102
118
  end
103
-
104
119
  end
105
-
106
120
  end
@@ -0,0 +1,41 @@
1
+ module Moip2
2
+ class ConnectApi
3
+ attr_reader :client
4
+
5
+ CONNECT_SANDBOX = "connect-sandbox.moip.com.br".freeze
6
+ CONNECT_PRODUCTION = "connect.moip.com.br".freeze
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def self.connect_uri(production = false)
13
+ production ? CONNECT_PRODUCTION : CONNECT_SANDBOX
14
+ end
15
+
16
+ def self.host(env = :sandbox)
17
+ "https://#{connect_uri(env == :production)}"
18
+ end
19
+
20
+ def authorize_url(client_id, redirect_uri, scope)
21
+ URI::HTTPS.build(
22
+ host: self.class.connect_uri(client.production?),
23
+ path: "/oauth/authorize",
24
+ query: URI.encode_www_form(
25
+ response_type: "code",
26
+ client_id: client_id,
27
+ redirect_uri: redirect_uri,
28
+ scope: scope,
29
+ ),
30
+ ).to_s
31
+ end
32
+
33
+ def authorize(connect)
34
+ Resource::Connect.new client.post(
35
+ "/oauth/token",
36
+ connect,
37
+ "application/x-www-form-urlencoded",
38
+ )
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,4 @@
1
1
  module Moip2
2
-
3
2
  class CustomerApi
4
3
  attr_reader :client
5
4
 
@@ -11,6 +10,10 @@ module Moip2
11
10
  "/v2/customers"
12
11
  end
13
12
 
13
+ def base_path_credit_card
14
+ "/v2/fundinginstruments"
15
+ end
16
+
14
17
  def show(customer_external_id)
15
18
  Resource::Customer.new client, client.get("#{base_path}/#{customer_external_id}")
16
19
  end
@@ -19,6 +22,17 @@ module Moip2
19
22
  Resource::Customer.new client, client.post(base_path, customer)
20
23
  end
21
24
 
22
- end
25
+ def add_credit_card(customer_external_id, credit_card)
26
+ Resource::CreditCard.new client, client.post(
27
+ "#{base_path}/#{customer_external_id}/fundinginstruments",
28
+ credit_card,
29
+ )
30
+ end
31
+
32
+ def delete_credit_card!(credit_card_id)
33
+ resp = client.delete("#{base_path_credit_card}/#{credit_card_id}")
23
34
 
35
+ resp.success?
36
+ end
37
+ end
24
38
  end
@@ -1,6 +1,4 @@
1
1
  module Moip2
2
-
3
2
  class InvalidEnviromentError < RuntimeError
4
3
  end
5
-
6
4
  end
@@ -1,5 +1,4 @@
1
1
  module Moip2
2
-
3
2
  class InvoiceApi
4
3
  attr_reader :client
5
4
 
@@ -24,9 +23,15 @@ module Moip2
24
23
  end
25
24
 
26
25
  def list(begin_date, end_date)
27
- Resource::Invoice.new client, client.get("#{base_path}?begin=#{begin_date}&end=#{end_date}")
26
+ find_all(begin_date: begin_date, end_date: end_date)
28
27
  end
29
28
 
29
+ def find_all(email: nil, begin_date: nil, end_date: nil, limit: 20, offset: 0)
30
+ Resource::Invoice.new(
31
+ client,
32
+ client.get("#{base_path}?email=#{email}&begin=#{begin_date}"\
33
+ "&end=#{end_date}&limit=#{limit}&offset=#{offset}"),
34
+ )
35
+ end
30
36
  end
31
-
32
37
  end
@@ -1,17 +1,17 @@
1
1
  module Moip2
2
- class KeysApi
3
- attr_reader :client
4
-
5
- def initialize(client)
6
- @client = client
7
- end
2
+ class KeysApi
3
+ attr_reader :client
8
4
 
9
- def base_path
10
- "/v2/keys"
11
- end
12
-
13
- def show
14
- Resource::Keys.new(client, client.get("#{base_path}"))
15
- end
16
- end
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def base_path
10
+ "/v2/keys"
11
+ end
12
+
13
+ def show
14
+ Resource::Keys.new(client, client.get(base_path.to_s))
15
+ end
16
+ end
17
17
  end
@@ -1,6 +1,5 @@
1
1
  module Moip2
2
2
  class MultiOrderApi
3
-
4
3
  attr_reader :client
5
4
 
6
5
  def initialize(client)
@@ -18,6 +17,5 @@ module Moip2
18
17
  def show(multi_order_id)
19
18
  Resource::MultiOrder.new client, client.get("#{base_path}/#{multi_order_id}")
20
19
  end
21
-
22
20
  end
23
- end
21
+ end
@@ -18,4 +18,4 @@ module Moip2
18
18
  Resource::MultiPayment.new client.get("/v2/multipayments/#{multi_payment_id}")
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -0,0 +1,33 @@
1
+ module Moip2
2
+ class NotificationsApi
3
+ attr_reader :client
4
+
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def base_path(app_id: nil, notification_id: nil)
10
+ ["", "v2", "preferences", app_id, "notifications", notification_id].compact.join("/")
11
+ end
12
+
13
+ def create(notification, app_id = nil)
14
+ Resource::Notification.new client, client.post(base_path(app_id: app_id), notification)
15
+ end
16
+
17
+ def show(notification_id)
18
+ Resource::Notification.new client, client.get(base_path(notification_id: notification_id))
19
+ end
20
+
21
+ def find_all
22
+ Resource::Notification.new client, client.get(base_path)
23
+ end
24
+
25
+ def delete(notification_id)
26
+ resp = Resource::Notification.new client, client.delete(
27
+ base_path(notification_id: notification_id),
28
+ )
29
+
30
+ resp.success?
31
+ end
32
+ end
33
+ end
@@ -1,7 +1,5 @@
1
1
  module Moip2
2
-
3
2
  class OrderApi
4
-
5
3
  attr_reader :client
6
4
 
7
5
  def initialize(client)
@@ -20,6 +18,23 @@ module Moip2
20
18
  Resource::Order.new client, client.get("#{base_path}/#{id}")
21
19
  end
22
20
 
23
- end
21
+ def find_all(limit: nil, offset: nil, filters: nil)
22
+ encoded_filters = Moip2::Util::FiltersEncoder.encode(filters)
23
+
24
+ # `URI.encode...` will accept nil params, but they will pollute the URI
25
+ params = {
26
+ limit: limit,
27
+ offset: offset,
28
+ filters: encoded_filters,
29
+ }.reject { |_, value| value.nil? }
24
30
 
31
+ query_string = URI.encode_www_form(params)
32
+ path = "#{base_path}?#{query_string}"
33
+ response = client.get(path)
34
+
35
+ # We need to transform raw JSON in Order objects
36
+ response.orders.collect! { |order| Resource::Order.new client, order }
37
+ Resource::Order.new client, response
38
+ end
39
+ end
25
40
  end
@@ -1,6 +1,5 @@
1
1
  module Moip2
2
2
  class PaymentApi
3
-
4
3
  attr_reader :client
5
4
 
6
5
  def initialize(client)
@@ -11,5 +10,16 @@ module Moip2
11
10
  Resource::Payment.new client.post("/v2/orders/#{order_id}/payments", payment)
12
11
  end
13
12
 
13
+ def show(payment_id)
14
+ Resource::Payment.new client.get("/v2/payments/#{payment_id}")
15
+ end
16
+
17
+ def capture(payment_id)
18
+ Resource::Payment.new client.post("/v2/payments/#{payment_id}/capture", nil)
19
+ end
20
+
21
+ def void(payment_id)
22
+ Resource::Payment.new client.post("/v2/payments/#{payment_id}/void", nil)
23
+ end
14
24
  end
15
25
  end
@@ -19,8 +19,9 @@ module Moip2
19
19
  end
20
20
 
21
21
  private
22
- def base_resource(id)
23
- id.start_with?("PAY") ? "payments" : "orders"
24
- end
22
+
23
+ def base_resource(id)
24
+ id.start_with?("PAY") ? "payments" : "orders"
25
+ end
25
26
  end
26
- end
27
+ end
@@ -0,0 +1,12 @@
1
+ module Moip2
2
+ module Resource
3
+ class Account < SimpleDelegator
4
+ attr_reader :client
5
+
6
+ def initialize(client, response)
7
+ super(response)
8
+ @client = client
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module Moip2
2
+ module Resource
3
+ class Connect < SimpleDelegator
4
+ def initialize(response)
5
+ super(response)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module Moip2
2
+ module Resource
3
+ class CreditCard < SimpleDelegator
4
+ attr_reader :client
5
+
6
+ def initialize(client, response)
7
+ super(response)
8
+ @client = client
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,16 +1,12 @@
1
1
  module Moip2
2
2
  module Resource
3
-
4
3
  class Customer < SimpleDelegator
5
-
6
4
  attr_reader :client
7
5
 
8
6
  def initialize(client, response)
9
7
  super(response)
10
8
  @client = client
11
9
  end
12
-
13
10
  end
14
-
15
11
  end
16
12
  end
@@ -1,6 +1,5 @@
1
1
  module Moip2
2
2
  module Resource
3
-
4
3
  class Invoice < SimpleDelegator
5
4
  attr_reader :client
6
5
 
@@ -9,6 +8,5 @@ module Moip2
9
8
  @client = client
10
9
  end
11
10
  end
12
-
13
11
  end
14
12
  end
@@ -1,6 +1,5 @@
1
1
  module Moip2
2
2
  module Resource
3
-
4
3
  class Keys < SimpleDelegator
5
4
  attr_reader :client
6
5
 
@@ -9,6 +8,5 @@ module Moip2
9
8
  @client = client
10
9
  end
11
10
  end
12
-
13
11
  end
14
- end
12
+ end
@@ -1,8 +1,6 @@
1
1
  module Moip2
2
-
3
2
  module Resource
4
3
  class MultiOrder < SimpleDelegator
5
-
6
4
  attr_reader :client, :multi_payment_api, :external_id
7
5
 
8
6
  def initialize(client, response)
@@ -15,11 +13,9 @@ module Moip2
15
13
  end
16
14
  end
17
15
 
18
- def create_multi_payment(payment)
16
+ def create_multi_payment(_payment = nil)
19
17
  multi_payment_api.create
20
18
  end
21
-
22
19
  end
23
20
  end
24
-
25
- end
21
+ end
@@ -1,11 +1,9 @@
1
1
  module Moip2
2
2
  module Resource
3
-
4
3
  class MultiPayment < SimpleDelegator
5
4
  def intialize(response)
6
5
  super(response)
7
6
  end
8
7
  end
9
-
10
8
  end
11
- end
9
+ end
@@ -0,0 +1,12 @@
1
+ module Moip2
2
+ module Resource
3
+ class Notification < SimpleDelegator
4
+ attr_reader :client
5
+
6
+ def initialize(client, response)
7
+ super(response)
8
+ @client = client
9
+ end
10
+ end
11
+ end
12
+ end