Class: Perka::ClientApi
- Inherits:
-
Flatpack::Client::BaseApi
- Object
- Flatpack::Client::BaseApi
- Perka::ClientApi
- Includes:
- Flatpack::Core::MapInitialize
- Defined in:
- lib/perka/client_api.rb
Direct Known Subclasses
Defined Under Namespace
Classes: CustomerRewardGet, CustomerVisitGet, CustomerVisitValidateGet, DescribeTokenGet, DescribeTypeUuidGet
Instance Method Summary collapse
-
#annotation_put(entity) ⇒ Object
Add or replace an annotation applied to a persistent entity.
-
#annotation_type_uuid_get(type, uuid) ⇒ Object
Find an annotation applied to a persistent entity.
-
#asset_manifest_perks_get ⇒ Object
Returns the manifest of perk icon names.
-
#customer_points_get ⇒ Object
Returns the current customer’s PointsActivity status across all merchants with a points-based loyalty system.
-
#customer_reward_get ⇒ Object
Allows a <entityReference payloadName=‘customer’> Customer’s</entityReference> reward status to be retrieved.
-
#customer_reward_put(entity) ⇒ Object
Reward a Customer.
-
#customer_visit_amend_put(entity) ⇒ Object
Rewrites the history of a customer’s latest validated visit to a merchant.
-
#customer_visit_get ⇒ Object
Returns a sparse list of visits at the current merchant location that are un-validated, or that occurred after the time of the most recent validated visit given.
-
#customer_visit_post(entity) ⇒ Object
Creates a new outstanding visit for the current customer at the given location.
-
#customer_visit_put(entity) ⇒ Object
Validates a visit.
-
#customer_visit_validate_get ⇒ Object
Checks for the validation of an outstanding visit and returns a sparse payload of <entityReference payloadName=‘visit’> Visit</entityReference> and related items.
-
#describe_get ⇒ Object
Returns a description of the methods and entity types used by the API server.
-
#describe_token_get ⇒ Object
A diagnostic endpoint to extract the information from an OAuth2 authorization code, login token, session token, or refresh token.
-
#describe_type_get(type) ⇒ Object
Provides a machine-readable description of an entity type per the logged-in role.
-
#describe_type_uuid_get(type, uuid) ⇒ Object
Performs a deep serialization of an entity.
-
#integrator_customer_post(entity) ⇒ Object
Creates a new customer associated with the current <entityReference payloadName=‘integratorUser’> IntegratorUser</entityReference>, or returns an existing customer if a matching customer already exists.
-
#integrator_customer_put(entity) ⇒ Object
Updates an existing <entityReference payloadName=‘customer’> Customer</entityReference> manageed by the current <entityReference payloadName=‘integratorUser’> IntegratorUser</entityReference>.
-
#integrator_destroy_delete ⇒ Object
Completely destroys all customer data associated with the current integrator user.
-
#integrator_managed_merchants_get ⇒ Object
Returns a list of all merchants managed by the current integrator user.
-
#integrator_managed_users_get ⇒ Object
Returns a list of all users the integrator may act as.
- #integrator_merchant_post(entity) ⇒ Object
-
#merchant_locations_get ⇒ Object
Returns a sparse payload of all live <entityReference payloadName=‘merchantLocation’> locations</entityReference> and their associated <entityReference payloadName=‘merchant’> merchants</entityReference>.
Instance Method Details
#annotation_put(entity) ⇒ Object
Add or replace an annotation applied to a persistent entity. If the value of <entityReference payloadName=‘entityAnnotation’> EntityAnnotation</entityReference> is missing or null
, the annotation will be removed. This method will return the previously-stored annotation, if any.
59 60 61 62 63 |
# File 'lib/perka/client_api.rb', line 59 def annotation_put(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/annotation") to_return.entity = entity to_return end |
#annotation_type_uuid_get(type, uuid) ⇒ Object
Find an annotation applied to a persistent entity.
50 51 52 53 |
# File 'lib/perka/client_api.rb', line 50 def annotation_type_uuid_get(type, uuid) to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/annotation/{type}/{uuid}", type, uuid) to_return end |
#asset_manifest_perks_get ⇒ Object
Returns the manifest of perk icon names.
9 10 11 12 |
# File 'lib/perka/client_api.rb', line 9 def asset_manifest_perks_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/asset/manifest/perks") to_return end |
#customer_points_get ⇒ Object
Returns the current customer’s PointsActivity status across all merchants with a points-based loyalty system.
16 17 18 19 |
# File 'lib/perka/client_api.rb', line 16 def customer_points_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/customer/points") to_return end |
#customer_reward_get ⇒ Object
Allows a <entityReference payloadName=‘customer’> Customer’s</entityReference> reward status to be retrieved. Customers may be searched for by UUID.
129 130 131 132 |
# File 'lib/perka/client_api.rb', line 129 def customer_reward_get to_return = CustomerRewardGet.new(self) to_return end |
#customer_reward_put(entity) ⇒ Object
Reward a Customer. This method will implicitly create a <entityReference payloadName=‘visit’> Visit</entityReference> which will be returned.
136 137 138 139 140 |
# File 'lib/perka/client_api.rb', line 136 def customer_reward_put(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/customer/reward") to_return.entity = entity to_return end |
#customer_visit_amend_put(entity) ⇒ Object
Rewrites the history of a customer’s latest validated visit to a merchant. The <entityReference payloadName=‘abstractRewardConfirmation’> AbstractRewardConfirmation</entityReference> instances associated with the <entityReference payloadName=‘visitConfirmation’> VisitConfirmation</entityReference> should reflect the desired state of the Visit. <p> This method will return the updated Visit.
147 148 149 150 151 |
# File 'lib/perka/client_api.rb', line 147 def customer_visit_amend_put(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/customer/visit/amend") to_return.entity = entity to_return end |
#customer_visit_get ⇒ Object
Returns a sparse list of visits at the current merchant location that are un-validated, or that occurred after the time of the most recent validated visit given. This request must be made with a anonymous clerk role that corresponds to exactly one MerchantLocation.
167 168 169 170 |
# File 'lib/perka/client_api.rb', line 167 def customer_visit_get to_return = CustomerVisitGet.new(self) to_return end |
#customer_visit_post(entity) ⇒ Object
Creates a new outstanding visit for the current customer at the given location. If the customer has no active Rewards at the associated merchant, a new Reward will be created for each of the merchant’s programs. Information about the visit, and all active rewards for the associated merchant will be returned.
157 158 159 160 161 |
# File 'lib/perka/client_api.rb', line 157 def customer_visit_post(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "POST", "/api/2/customer/visit") to_return.entity = entity to_return end |
#customer_visit_put(entity) ⇒ Object
Validates a visit
181 182 183 184 185 |
# File 'lib/perka/client_api.rb', line 181 def customer_visit_put(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/customer/visit") to_return.entity = entity to_return end |
#customer_visit_validate_get ⇒ Object
Checks for the validation of an outstanding visit and returns a sparse payload of <entityReference payloadName=‘visit’> Visit</entityReference> and related items.
175 176 177 178 |
# File 'lib/perka/client_api.rb', line 175 def customer_visit_validate_get to_return = CustomerVisitValidateGet.new(self) to_return end |
#describe_get ⇒ Object
Returns a description of the methods and entity types used by the API server.
37 38 39 40 |
# File 'lib/perka/client_api.rb', line 37 def describe_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/describe") to_return end |
#describe_token_get ⇒ Object
A diagnostic endpoint to extract the information from an OAuth2 authorization code, login token, session token, or refresh token.
44 45 46 47 |
# File 'lib/perka/client_api.rb', line 44 def describe_token_get to_return = DescribeTokenGet.new(self) to_return end |
#describe_type_get(type) ⇒ Object
Provides a machine-readable description of an entity type per the logged-in role.
31 32 33 34 |
# File 'lib/perka/client_api.rb', line 31 def describe_type_get(type) to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/describe/{type}", type) to_return end |
#describe_type_uuid_get(type, uuid) ⇒ Object
Performs a deep serialization of an entity. This endpoint is intended to provide supplementary one-to-many relationship data that is not normally serialized to keep payload sizes manageable.
24 25 26 27 |
# File 'lib/perka/client_api.rb', line 24 def describe_type_uuid_get(type, uuid) to_return = DescribeTypeUuidGet.new(self, type, uuid) to_return end |
#integrator_customer_post(entity) ⇒ Object
Creates a new customer associated with the current <entityReference payloadName=‘integratorUser’> IntegratorUser</entityReference>, or returns an existing customer if a matching customer already exists. The given <entityReference payloadName=‘userCredentials’> UserCredentials</entityReference> must include an email, phone, or both. The following rules will be used to determine if a new customer should be created <ul> <li>If a customer exists with a matching confirmed email address or confirmed phone number, that customer will be returned.</li> <li>If a customer exists that is associated with the current <entityReference payloadName=‘integratorUser’> IntegratorUser</entityReference>, and has a matching unconfirmed email address or unconfirmed phone number, that customer will be returned. The email check will happen first, and will short-circuit the phone check if a match is found.</li> <li>Otherwise, a new customer will be created and associated with your <entityReference payloadName=‘integratorUser’> IntegratorUser</entityReference>. The given phone number and email address will be stored as unconfirmed values. </ul>
80 81 82 83 84 |
# File 'lib/perka/client_api.rb', line 80 def integrator_customer_post(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "POST", "/api/2/integrator/customer") to_return.entity = entity to_return end |
#integrator_customer_put(entity) ⇒ Object
Updates an existing <entityReference payloadName=‘customer’> Customer</entityReference> manageed by the current <entityReference payloadName=‘integratorUser’> IntegratorUser</entityReference>.
113 114 115 116 117 |
# File 'lib/perka/client_api.rb', line 113 def integrator_customer_put(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/integrator/customer") to_return.entity = entity to_return end |
#integrator_destroy_delete ⇒ Object
Completely destroys all customer data associated with the current integrator user. This endpoint is only available in the sandbox environment.
94 95 96 97 |
# File 'lib/perka/client_api.rb', line 94 def integrator_destroy_delete to_return = Flatpack::Client::FlatpackRequest.new(self, "DELETE", "/api/2/integrator/destroy") to_return end |
#integrator_managed_merchants_get ⇒ Object
Returns a list of all merchants managed by the current integrator user
100 101 102 103 |
# File 'lib/perka/client_api.rb', line 100 def integrator_managed_merchants_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/integrator/managed/merchants") to_return end |
#integrator_managed_users_get ⇒ Object
Returns a list of all users the integrator may act as.
106 107 108 109 |
# File 'lib/perka/client_api.rb', line 106 def integrator_managed_users_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/integrator/managed/users") to_return end |
#integrator_merchant_post(entity) ⇒ Object
86 87 88 89 90 |
# File 'lib/perka/client_api.rb', line 86 def integrator_merchant_post(entity) to_return = Flatpack::Client::FlatpackRequest.new(self, "POST", "/api/2/integrator/merchant") to_return.entity = entity to_return end |
#merchant_locations_get ⇒ Object
Returns a sparse payload of all live <entityReference payloadName=‘merchantLocation’> locations</entityReference> and their associated <entityReference payloadName=‘merchant’> merchants</entityReference>.
122 123 124 125 |
# File 'lib/perka/client_api.rb', line 122 def merchant_locations_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/merchant/locations") to_return end |