fidor_api 1.0.0 → 2.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -49
  3. data/Rakefile +6 -3
  4. data/lib/fidor_api/client/authentication.rb +63 -0
  5. data/lib/fidor_api/client/configuration.rb +32 -0
  6. data/lib/fidor_api/client/connection.rb +56 -0
  7. data/lib/fidor_api/client/dsl/confirmable_actions.rb +19 -0
  8. data/lib/fidor_api/client/dsl/core_data.rb +19 -0
  9. data/lib/fidor_api/client/dsl/messages.rb +31 -0
  10. data/lib/fidor_api/client/dsl/transactions.rb +15 -0
  11. data/lib/fidor_api/client/dsl/transfers/classic.rb +29 -0
  12. data/lib/fidor_api/client/dsl/transfers/generic.rb +34 -0
  13. data/lib/fidor_api/client/dsl/transfers.rb +22 -0
  14. data/lib/fidor_api/client/dsl.rb +59 -0
  15. data/lib/fidor_api/client.rb +17 -21
  16. data/lib/fidor_api/collection/kaminari_support.rb +17 -0
  17. data/lib/fidor_api/collection.rb +18 -34
  18. data/lib/fidor_api/environment/base.rb +21 -0
  19. data/lib/fidor_api/environment/fidor_de/production.rb +23 -0
  20. data/lib/fidor_api/environment/fidor_de/sandbox.rb +23 -0
  21. data/lib/fidor_api/environment/fidor_de.rb +8 -0
  22. data/lib/fidor_api/environment/future.rb +21 -0
  23. data/lib/fidor_api/environment.rb +7 -0
  24. data/lib/fidor_api/errors.rb +3 -26
  25. data/lib/fidor_api/model/account.rb +25 -0
  26. data/lib/fidor_api/model/base.rb +44 -0
  27. data/lib/fidor_api/model/confirmable_action.rb +9 -0
  28. data/lib/fidor_api/model/customer.rb +36 -0
  29. data/lib/fidor_api/model/helpers/action_view_support.rb +21 -0
  30. data/lib/fidor_api/model/helpers/attribute_decimal_methods.rb +32 -0
  31. data/lib/fidor_api/model/helpers.rb +8 -0
  32. data/lib/fidor_api/model/message.rb +23 -0
  33. data/lib/fidor_api/model/transaction.rb +21 -0
  34. data/lib/fidor_api/model/transfer/classic/base.rb +15 -0
  35. data/lib/fidor_api/model/transfer/classic/internal.rb +20 -0
  36. data/lib/fidor_api/model/transfer/classic/sepa.rb +11 -0
  37. data/lib/fidor_api/model/transfer/classic.rb +11 -0
  38. data/lib/fidor_api/model/transfer/generic.rb +71 -0
  39. data/lib/fidor_api/model/transfer.rb +8 -0
  40. data/lib/fidor_api/model/user.rb +10 -0
  41. data/lib/fidor_api/model.rb +13 -0
  42. data/lib/fidor_api/token.rb +13 -18
  43. data/lib/fidor_api/version.rb +1 -1
  44. data/lib/fidor_api.rb +14 -58
  45. metadata +152 -89
  46. data/.gitignore +0 -11
  47. data/.rspec +0 -2
  48. data/.ruby-gemset +0 -1
  49. data/.ruby-version +0 -1
  50. data/.travis.yml +0 -20
  51. data/CHANGELOG.md +0 -129
  52. data/Gemfile +0 -15
  53. data/LICENSE.txt +0 -21
  54. data/bin/console +0 -14
  55. data/bin/setup +0 -7
  56. data/fidor_api.gemspec +0 -24
  57. data/lib/fidor_api/account.rb +0 -45
  58. data/lib/fidor_api/amount_attributes.rb +0 -30
  59. data/lib/fidor_api/approval_required.rb +0 -9
  60. data/lib/fidor_api/auth.rb +0 -45
  61. data/lib/fidor_api/beneficiary/ach.rb +0 -39
  62. data/lib/fidor_api/beneficiary/base.rb +0 -118
  63. data/lib/fidor_api/beneficiary/generic.rb +0 -24
  64. data/lib/fidor_api/beneficiary/p2p_account_number.rb +0 -14
  65. data/lib/fidor_api/beneficiary/p2p_phone.rb +0 -14
  66. data/lib/fidor_api/beneficiary/p2p_username.rb +0 -14
  67. data/lib/fidor_api/beneficiary/swift.rb +0 -35
  68. data/lib/fidor_api/beneficiary/unknown.rb +0 -16
  69. data/lib/fidor_api/beneficiary/utility.rb +0 -35
  70. data/lib/fidor_api/beneficiary.rb +0 -27
  71. data/lib/fidor_api/card.rb +0 -77
  72. data/lib/fidor_api/card_limit_attribute.rb +0 -52
  73. data/lib/fidor_api/card_limits.rb +0 -14
  74. data/lib/fidor_api/confirmable_action.rb +0 -45
  75. data/lib/fidor_api/connectivity/connection.rb +0 -113
  76. data/lib/fidor_api/connectivity/endpoint.rb +0 -82
  77. data/lib/fidor_api/connectivity/resource.rb +0 -76
  78. data/lib/fidor_api/connectivity.rb +0 -17
  79. data/lib/fidor_api/constants.rb +0 -3
  80. data/lib/fidor_api/customer.rb +0 -140
  81. data/lib/fidor_api/customers/confirmations.rb +0 -19
  82. data/lib/fidor_api/message.rb +0 -52
  83. data/lib/fidor_api/msisdn.rb +0 -45
  84. data/lib/fidor_api/password.rb +0 -29
  85. data/lib/fidor_api/preauth.rb +0 -33
  86. data/lib/fidor_api/preauth_details.rb +0 -97
  87. data/lib/fidor_api/session_token.rb +0 -20
  88. data/lib/fidor_api/transaction.rb +0 -37
  89. data/lib/fidor_api/transaction_details.rb +0 -119
  90. data/lib/fidor_api/transfer/ach.rb +0 -46
  91. data/lib/fidor_api/transfer/bank_internal.rb +0 -37
  92. data/lib/fidor_api/transfer/base.rb +0 -36
  93. data/lib/fidor_api/transfer/fps.rb +0 -56
  94. data/lib/fidor_api/transfer/generic.rb +0 -134
  95. data/lib/fidor_api/transfer/internal.rb +0 -53
  96. data/lib/fidor_api/transfer/p2p_account_number.rb +0 -45
  97. data/lib/fidor_api/transfer/p2p_phone.rb +0 -45
  98. data/lib/fidor_api/transfer/p2p_username.rb +0 -45
  99. data/lib/fidor_api/transfer/sepa.rb +0 -56
  100. data/lib/fidor_api/transfer/swift.rb +0 -49
  101. data/lib/fidor_api/transfer/utility.rb +0 -50
  102. data/lib/fidor_api/transfer.rb +0 -17
  103. data/lib/fidor_api/user.rb +0 -24
@@ -1,45 +0,0 @@
1
- module FidorApi
2
-
3
- module Auth
4
- extend self
5
-
6
- def authorize_url(callback_url: nil)
7
- fidor_authorize_url(callback_url: callback_url)
8
- end
9
-
10
- def fetch_token(code, callback_url: nil)
11
- response = connection.post "/oauth/token", {
12
- client_id: FidorApi.configuration.client_id,
13
- redirect_uri: callback_url || FidorApi.configuration.callback_url,
14
- code: code,
15
- grant_type: "authorization_code"
16
- }
17
- Token.new JSON.parse(response.body)
18
- end
19
-
20
- def refresh_token(token)
21
- response = connection.post "/oauth/token", {
22
- grant_type: "refresh_token",
23
- refresh_token: token.refresh_token
24
- }
25
- Token.new JSON.parse(response.body)
26
- end
27
-
28
- private
29
-
30
- def connection
31
- Faraday.new(url: FidorApi.configuration.oauth_url, ssl: { verify: FidorApi.configuration.verify_ssl }) do |config|
32
- config.use Faraday::Request::BasicAuthentication, FidorApi.configuration.client_id, FidorApi.configuration.client_secret
33
- config.request :url_encoded
34
- config.response :logger if FidorApi.configuration.logging
35
- config.response :raise_error
36
- config.adapter Faraday.default_adapter
37
- end
38
- end
39
-
40
- def fidor_authorize_url(state: "empty", callback_url:)
41
- "#{FidorApi.configuration.oauth_url}/oauth/authorize?client_id=#{FidorApi.configuration.client_id}&redirect_uri=#{CGI::escape(callback_url || FidorApi.configuration.callback_url)}&state=#{state}&response_type=code"
42
- end
43
- end
44
-
45
- end
@@ -1,39 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class ACH < Base
4
- include Generic
5
-
6
- attribute :account_number, :string
7
- attribute :routing_code, :string
8
-
9
- validates :contact_name, presence: true
10
- validates :account_number, presence: true
11
- validates :routing_code, presence: true
12
-
13
- def set_attributes(attrs = {})
14
- self.account_number = attrs.fetch("routing_info", {})["account_number"]
15
- self.routing_code = attrs.fetch("routing_info", {})["routing_code"]
16
- super(attrs.except("routing_type", "routing_info"))
17
- end
18
-
19
- def as_json_routing_type
20
- "ACH"
21
- end
22
-
23
- def as_json_routing_info
24
- {
25
- account_number: account_number,
26
- routing_code: routing_code
27
- }
28
- end
29
-
30
- private
31
-
32
- module ClientSupport
33
- def build_ach_beneficiary(attributes = {})
34
- Beneficiary::ACH.new(attributes)
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,118 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class Base < Connectivity::Resource
4
- ROUTING_INFO_ERROR_PREFIX = "routing_info.".freeze
5
-
6
- self.endpoint = Connectivity::Endpoint.new('/beneficiaries', :collection)
7
-
8
- attr_accessor :confirmable_action
9
-
10
- class << self
11
- def new(hash={})
12
- if self == Base
13
- class_for_response_hash(hash).new hash
14
- else
15
- super
16
- end
17
- end
18
-
19
- def delete(id)
20
- endpoint.for(new(id: id)).delete
21
- true
22
- end
23
-
24
- private
25
-
26
- def class_for_response_hash(hash)
27
- {
28
- "FOS_P2P_ACCOUNT_NUMBER" => FidorApi::Beneficiary::P2pAccountNumber,
29
- "FOS_P2P_PHONE" => FidorApi::Beneficiary::P2pPhone,
30
- "FOS_P2P_USERNAME" => FidorApi::Beneficiary::P2pUsername,
31
- "SWIFT" => FidorApi::Beneficiary::Swift,
32
- "UTILITY" => FidorApi::Beneficiary::Utility
33
- }.fetch(hash["routing_type"], FidorApi::Beneficiary::Unknown)
34
- end
35
- end
36
-
37
- def set_attributes(attrs = {})
38
- self.contact_name = attrs.fetch("contact", {})["name"]
39
- self.contact_address_line_1 = attrs.fetch("contact", {})["address_line_1"]
40
- self.contact_address_line_2 = attrs.fetch("contact", {})["address_line_2"]
41
- self.contact_city = attrs.fetch("contact", {})["city"]
42
- self.contact_country = attrs.fetch("contact", {})["country"]
43
-
44
- self.bank_name = attrs.fetch("bank", {})["name"]
45
- self.bank_address_line_1 = attrs.fetch("bank", {})["address_line_1"]
46
- self.bank_address_line_2 = attrs.fetch("bank", {})["address_line_2"]
47
- self.bank_city = attrs.fetch("bank", {})["city"]
48
- self.bank_country = attrs.fetch("bank", {})["country"]
49
-
50
- super(attrs.except("contact", "bank", "routing_type", "routing_info"))
51
- end
52
-
53
- def save
54
- fail InvalidRecordError unless valid?
55
- super
56
- end
57
-
58
- def as_json
59
- {
60
- account_id: account_id,
61
- unique_name: unique_name,
62
- contact: {
63
- name: contact_name,
64
- address_line_1: contact_address_line_1,
65
- address_line_2: contact_address_line_2,
66
- city: contact_city,
67
- country: contact_country
68
- }.compact,
69
- bank: {
70
- name: bank_name,
71
- address_line_1: bank_address_line_1,
72
- address_line_2: bank_address_line_2,
73
- city: bank_city,
74
- country: bank_country
75
- }.compact,
76
- routing_type: as_json_routing_type,
77
- routing_info: as_json_routing_info
78
- }.compact
79
- end
80
-
81
- private
82
-
83
- def remote_create
84
- response = super
85
- if path = response.headers["X-Fidor-Confirmation-Path"]
86
- self.confirmable_action = ConfirmableAction.new(id: path.split("/").last)
87
- end
88
- response
89
- end
90
-
91
- def remote_update(*attributes)
92
- response = super
93
- if path = response.headers["X-Fidor-Confirmation-Path"]
94
- self.confirmable_action = ConfirmableAction.new(id: path.split("/").last)
95
- end
96
- response
97
- end
98
-
99
- def map_errors(fields)
100
- fields.each do |hash|
101
- field = hash["field"].to_sym
102
- key = hash["key"].try :to_sym
103
-
104
- if field == :base || respond_to?(field)
105
- if key
106
- errors.add(field, key, message: hash["message"])
107
- else
108
- errors.add(field, hash["message"])
109
- end
110
- elsif hash["field"].start_with?(ROUTING_INFO_ERROR_PREFIX)
111
- invalid_field = hash["field"][ROUTING_INFO_ERROR_PREFIX.size..-1]
112
- errors.add(invalid_field, hash["key"].to_sym, message: hash["message"])
113
- end
114
- end
115
- end
116
- end
117
- end
118
- end
@@ -1,24 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- module Generic
4
- def self.included(base)
5
- base.extend ModelAttribute
6
-
7
- base.attribute :id, :string
8
- base.attribute :account_id, :string
9
- base.attribute :unique_name, :string
10
- base.attribute :contact_name, :string
11
- base.attribute :contact_address_line_1, :string
12
- base.attribute :contact_address_line_2, :string
13
- base.attribute :contact_city, :string
14
- base.attribute :contact_country, :string
15
- base.attribute :bank_name, :string
16
- base.attribute :bank_address_line_1, :string
17
- base.attribute :bank_address_line_2, :string
18
- base.attribute :bank_city, :string
19
- base.attribute :bank_country, :string
20
- base.attribute :verified, :boolean
21
- end
22
- end
23
- end
24
- end
@@ -1,14 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class P2pAccountNumber < Base
4
- include Generic
5
-
6
- attribute :account_number, :string
7
-
8
- def set_attributes(attrs = {})
9
- self.account_number = attrs.fetch("routing_info", {})["account_number"]
10
- super(attrs.except("routing_type", "routing_info"))
11
- end
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class P2pPhone < Base
4
- include Generic
5
-
6
- attribute :mobile_phone_number, :string
7
-
8
- def set_attributes(attrs = {})
9
- self.mobile_phone_number = attrs.fetch("routing_info", {})["mobile_phone_number"]
10
- super(attrs.except("routing_type", "routing_info"))
11
- end
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class P2pUsername < Base
4
- include Generic
5
-
6
- attribute :username, :string
7
-
8
- def set_attributes(attrs = {})
9
- self.username = attrs.fetch("routing_info", {})["username"]
10
- super(attrs.except("routing_type", "routing_info"))
11
- end
12
- end
13
- end
14
- end
@@ -1,35 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class Swift < Base
4
- include Generic
5
-
6
- attribute :account_number, :string
7
- attribute :swift_code, :string
8
- attribute :account_currency, :string
9
-
10
- validates :account_number, presence: true
11
- validates :swift_code, presence: true
12
- validates :contact_name, presence: true
13
- validates :account_currency, presence: true
14
-
15
- def set_attributes(attrs = {})
16
- self.account_number = attrs.fetch("routing_info", {})["account_number"]
17
- self.swift_code = attrs.fetch("routing_info", {})["swift_code"]
18
- self.account_currency = attrs.fetch("routing_info", {})["account_currency"]
19
- super(attrs.except("routing_type", "routing_info"))
20
- end
21
-
22
- def as_json_routing_type
23
- "SWIFT"
24
- end
25
-
26
- def as_json_routing_info
27
- {
28
- account_number: account_number,
29
- swift_code: swift_code,
30
- account_currency: account_currency
31
- }
32
- end
33
- end
34
- end
35
- end
@@ -1,16 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class Unknown < Base
4
- include Generic
5
-
6
- attribute :routing_type, :string
7
- attribute :routing_info, :json
8
-
9
- def set_attributes(attrs = {})
10
- self.routing_type = attrs["routing_type"]
11
- self.routing_info = attrs["routing_info"]
12
- super(attrs.except("routing_type", "routing_info"))
13
- end
14
- end
15
- end
16
- end
@@ -1,35 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- class Utility < Base
4
- include Generic
5
-
6
- attribute :utility_provider, :string
7
- attribute :utility_service, :string
8
- attribute :utility_service_number, :string
9
-
10
- validates :utility_provider, presence: true
11
- validates :utility_service, presence: true
12
- validates :utility_service_number, presence: true
13
- validates :unique_name, presence: true
14
-
15
- def set_attributes(attrs = {})
16
- self.utility_provider = attrs.fetch("routing_info", {})["utility_provider"]
17
- self.utility_service = attrs.fetch("routing_info", {})["utility_service"]
18
- self.utility_service_number = attrs.fetch("routing_info", {})["utility_service_number"]
19
- super(attrs.except("routing_type", "routing_info"))
20
- end
21
-
22
- def as_json_routing_type
23
- "UTILITY"
24
- end
25
-
26
- def as_json_routing_info
27
- {
28
- utility_provider: utility_provider,
29
- utility_service: utility_service,
30
- utility_service_number: utility_service_number
31
- }
32
- end
33
- end
34
- end
35
- end
@@ -1,27 +0,0 @@
1
- module FidorApi
2
- module Beneficiary
3
- autoload :Base, 'fidor_api/beneficiary/base'
4
- autoload :Generic, 'fidor_api/beneficiary/generic'
5
- autoload :ACH, 'fidor_api/beneficiary/ach'
6
- autoload :P2pAccountNumber, 'fidor_api/beneficiary/p2p_account_number'
7
- autoload :P2pPhone, 'fidor_api/beneficiary/p2p_phone'
8
- autoload :P2pUsername, 'fidor_api/beneficiary/p2p_username'
9
- autoload :Swift, 'fidor_api/beneficiary/swift'
10
- autoload :Unknown, 'fidor_api/beneficiary/unknown'
11
- autoload :Utility, 'fidor_api/beneficiary/utility'
12
-
13
- module ClientSupport
14
- def beneficiaries(options = {})
15
- Beneficiary::Base.all(options)
16
- end
17
-
18
- def beneficiary(id)
19
- Beneficiary::Base.find(id)
20
- end
21
-
22
- def delete_beneficiary(id)
23
- Beneficiary::Base.delete(id)
24
- end
25
- end
26
- end
27
- end
@@ -1,77 +0,0 @@
1
- module FidorApi
2
- class Card < Connectivity::Resource
3
- extend ModelAttribute
4
- extend AmountAttributes
5
- include CardLimitAttribute
6
-
7
- self.endpoint = Connectivity::Endpoint.new('/cards', :collection)
8
-
9
- attribute :id, :integer
10
- attribute :account_id, :string
11
- attribute :inscription, :string
12
- attribute :pin, :string
13
- attribute :type, :string
14
- attribute :design, :string
15
- attribute :currency, :string
16
- attribute :physical, :boolean
17
- attribute :email_notification, :boolean
18
- attribute :sms_notification, :boolean
19
- attribute :payed, :boolean
20
- attribute :state, :string
21
- attribute :valid_until, :time
22
- attribute :lock_reason, :string
23
- attribute :disabled, :boolean
24
- attribute :address, :json
25
- attribute :created_at, :time
26
- attribute :updated_at, :time
27
-
28
- amount_attribute :balance
29
-
30
- def self.required_attributes
31
- %i(account_id type)
32
- end
33
-
34
- def self.writeable_attributes
35
- required_attributes + %i(pin address)
36
- end
37
-
38
- validates(*required_attributes, presence: true)
39
-
40
- def activate
41
- endpoint.for(self).put(action: 'activate')
42
- true
43
- end
44
-
45
- def lock
46
- endpoint.for(self).put(action: 'lock')
47
- true
48
- end
49
-
50
- def unlock
51
- endpoint.for(self).put(action: 'unlock')
52
- true
53
- end
54
-
55
- def cancel(reason: 'lost')
56
- case reason
57
- when 'lost'
58
- endpoint.for(self).put(action: 'cancel')
59
- when 'stolen'
60
- endpoint.for(self).put(action: 'block')
61
- else
62
- fail ArgumentError, "Unknown reason: #{reason.inspect}"
63
- end
64
- true
65
- end
66
-
67
- def as_json
68
- attributes.slice(*self.class.writeable_attributes)
69
- end
70
-
71
- # comfort shorthands for easier validations
72
- %w(name line_1 line_2 city postal_code country).each do |field|
73
- define_method("address_#{field}") { address.try :[], field }
74
- define_method("address_#{field}=") { |val| self.address ||= {}; address[field] = val }
75
- end
76
- end
77
- end
@@ -1,52 +0,0 @@
1
- module FidorApi
2
- module CardLimitAttribute
3
- def self.included(base)
4
- base.attribute :limits, :json
5
- base.validate :validate_limits
6
- end
7
-
8
- def method_missing(symbol, *args)
9
- if m = symbol.to_s.match(/(.*)_limit$/)
10
- limits[m[1]]
11
- elsif m = symbol.to_s.match(/(.*)_limit=$/)
12
- write_limit(m[1], args[0])
13
- else
14
- super
15
- end
16
- end
17
-
18
- def respond_to_missing?(symbol, include_all = false)
19
- if symbol.to_s =~ /.*_limit=?$/
20
- return true
21
- else
22
- super
23
- end
24
- end
25
-
26
- private
27
-
28
- def write_limit(key, value)
29
- self.limits ||= {}
30
- # If the client is using BigDecimal, we will cast it to cents for him
31
- if value.instance_of?(BigDecimal)
32
- self.limits[key] = (value * 100.00).to_i
33
- else
34
- self.limits[key] = value
35
- end
36
- end
37
-
38
- def validate_limits
39
- limits.each do |key, value|
40
- if value.instance_of?(BigDecimal)
41
- limits[key] = (value * 100.00).to_i
42
- elsif !(value.class.name.in?(INTEGER_CLASSES) || value.instance_of?(NilClass))
43
- errors.add(:"#{key}_limit", :not_an_integer)
44
- next
45
- end
46
- if limits[key] < 0
47
- errors.add(:"#{key}_limit", :greater_than_or_equal_to, count: 0)
48
- end
49
- end if limits
50
- end
51
- end
52
- end
@@ -1,14 +0,0 @@
1
- module FidorApi
2
- class CardLimits < Connectivity::Resource
3
- extend ModelAttribute
4
- include CardLimitAttribute
5
-
6
- self.endpoint = Connectivity::Endpoint.new('/cards/:id/limits', :resource)
7
-
8
- attribute :id, :integer
9
-
10
- def as_json
11
- attributes.slice(:limits)
12
- end
13
- end
14
- end
@@ -1,45 +0,0 @@
1
- module FidorApi
2
- class ConfirmableAction < Connectivity::Resource
3
- extend ModelAttribute
4
-
5
- self.endpoint = Connectivity::Endpoint.new('/confirmable/actions', :collection)
6
-
7
- attribute :id, :string
8
- attribute :type, :string
9
- attribute :message, :string
10
- attribute :steps_left, :json
11
- attribute :steps_completed, :json
12
- attribute :resource, :json
13
- attribute :succeeded_at, :time
14
- attribute :failed_at, :time
15
- attribute :errored_at, :time
16
- attribute :created_at, :time
17
- attribute :updated_at, :time
18
-
19
- attribute :otp, :string
20
- attribute :approval, :string
21
-
22
- def refresh
23
- endpoint.for(self).put(action: "refresh")
24
- true
25
- end
26
-
27
- module ClientSupport
28
- def confirmable_actions(options = {})
29
- ConfirmableAction.all
30
- end
31
-
32
- def confirmable_action(id)
33
- ConfirmableAction.find(id)
34
- end
35
-
36
- def update_confirmable_action(id, attributes)
37
- ConfirmableAction.new(attributes.merge(id: id)).save
38
- end
39
-
40
- def refresh_confirmable_action(id)
41
- ConfirmableAction.new(id: id).refresh
42
- end
43
- end
44
- end
45
- end