Class: Frame::Customer
- Inherits:
-
APIResource
- Object
- FrameObject
- APIResource
- Frame::Customer
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Delete, APIOperations::Save
- Defined in:
- lib/frame/resources/customer.rb
Constant Summary collapse
- OBJECT_NAME =
"customer"- DEPRECATED_METHODS =
Customers are deprecated in favor of Accounts (M2 demotion). Only methods with a clear cross-resource target are demoted; create/retrieve/list/ search/save stay non-deprecated pending an unambiguous mapping.
%i[delete block unblock payment_methods].freeze
Instance Attribute Summary
Attributes inherited from FrameObject
Class Method Summary collapse
-
.block(id, params = {}, opts = {}) ⇒ Object
deprecated
Deprecated.
Account.block pending a monolith route; no re-route yet. Removed at v2.
- .create(params = {}, opts = {}) ⇒ Object
-
.delete(id, params = {}, opts = {}) ⇒ Object
deprecated
Deprecated.
Use
Account.disableinstead. Removed at v2. - .list(params = {}, opts = {}) ⇒ Object
- .object_name ⇒ Object
-
.payment_methods(id, opts = {}) ⇒ Object
deprecated
Deprecated.
Use
PaymentMethod.list(account_id:)instead (FRA-4461). Removed at v2. - .retrieve(id, opts = {}) ⇒ Object
- .search(params = {}, opts = {}) ⇒ Object
-
.unblock(id, params = {}, opts = {}) ⇒ Object
deprecated
Deprecated.
Account.unblock pending a monolith route; no re-route yet. Removed at v2.
Instance Method Summary collapse
-
#block(params = {}, opts = {}) ⇒ Object
deprecated
Deprecated.
Account.block pending a monolith route; no re-route yet. Removed at v2.
-
#delete(params = {}, opts = {}) ⇒ Object
deprecated
Deprecated.
Use
Account.disableinstead. Removed at v2. - #save(params = {}, opts = {}) ⇒ Object
-
#unblock(params = {}, opts = {}) ⇒ Object
deprecated
Deprecated.
Account.unblock pending a monolith route; no re-route yet. Removed at v2.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, #refresh, resource_url, #resource_url
Methods included from APIOperations::Request
Methods inherited from FrameObject
#[], #[]=, construct_from, #each, #initialize, #initialize_from, #inspect, #keys, #serialize_params, #to_hash, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Frame::FrameObject
Class Method Details
.block(id, params = {}, opts = {}) ⇒ Object
Account.block pending a monolith route; no re-route yet. Removed at v2.
79 80 81 82 83 84 85 86 |
# File 'lib/frame/resources/customer.rb', line 79 def self.block(id, params = {}, opts = {}) request_object( :post, "/v1/customers/#{CGI.escape(id)}/block", params, opts ) end |
.create(params = {}, opts = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/frame/resources/customer.rb', line 21 def self.create(params = {}, opts = {}) request_object( :post, "/v1/customers", params, opts ) end |
.delete(id, params = {}, opts = {}) ⇒ Object
Use Account.disable instead. Removed at v2.
59 60 61 62 63 64 65 66 |
# File 'lib/frame/resources/customer.rb', line 59 def self.delete(id, params = {}, opts = {}) request_object( :delete, "/v1/customers/#{CGI.escape(id)}", params, opts ) end |
.list(params = {}, opts = {}) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/frame/resources/customer.rb', line 30 def self.list(params = {}, opts = {}) request_object( :get, "/v1/customers", params, opts ) end |
.object_name ⇒ Object
12 13 14 |
# File 'lib/frame/resources/customer.rb', line 12 def self.object_name OBJECT_NAME end |
.payment_methods(id, opts = {}) ⇒ Object
Use PaymentMethod.list(account_id:) instead (FRA-4461). Removed at v2.
109 110 111 112 113 114 115 116 |
# File 'lib/frame/resources/customer.rb', line 109 def self.payment_methods(id, opts = {}) request_object( :get, "/v1/customers/#{CGI.escape(id)}/payment_methods", {}, opts ) end |
.retrieve(id, opts = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/frame/resources/customer.rb', line 39 def self.retrieve(id, opts = {}) id = Util.normalize_id(id) request_object( :get, "/v1/customers/#{CGI.escape(id)}", {}, opts ) end |
.search(params = {}, opts = {}) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/frame/resources/customer.rb', line 49 def self.search(params = {}, opts = {}) request_object( :get, "/v1/customers/search", params, opts ) end |
.unblock(id, params = {}, opts = {}) ⇒ Object
Account.unblock pending a monolith route; no re-route yet. Removed at v2.
99 100 101 102 103 104 105 106 |
# File 'lib/frame/resources/customer.rb', line 99 def self.unblock(id, params = {}, opts = {}) request_object( :post, "/v1/customers/#{CGI.escape(id)}/unblock", params, opts ) end |
Instance Method Details
#block(params = {}, opts = {}) ⇒ Object
Account.block pending a monolith route; no re-route yet. Removed at v2.
69 70 71 72 73 74 75 76 |
# File 'lib/frame/resources/customer.rb', line 69 def block(params = {}, opts = {}) request_object( :post, "/v1/customers/#{CGI.escape(self["id"])}/block", params, opts ) end |
#delete(params = {}, opts = {}) ⇒ Object
Use Account.disable instead. Removed at v2.
137 138 139 140 141 142 143 144 |
# File 'lib/frame/resources/customer.rb', line 137 def delete(params = {}, opts = {}) request_object( :delete, "/v1/customers/#{CGI.escape(self["id"])}", params, opts ) end |
#save(params = {}, opts = {}) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/frame/resources/customer.rb', line 118 def save(params = {}, opts = {}) values = serialize_params(self).merge(params) if values.empty? return self end updated = request_object( :patch, "/v1/customers/#{CGI.escape(self["id"])}", values, opts ) initialize_from(updated) self end |
#unblock(params = {}, opts = {}) ⇒ Object
Account.unblock pending a monolith route; no re-route yet. Removed at v2.
89 90 91 92 93 94 95 96 |
# File 'lib/frame/resources/customer.rb', line 89 def unblock(params = {}, opts = {}) request_object( :post, "/v1/customers/#{CGI.escape(self["id"])}/unblock", params, opts ) end |