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: 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_put(entity) ⇒ Object
Rewards a Customer.
-
#customer_uuid_get(uuid) ⇒ Object
Retrieves the customer associated with the given uuid.
-
#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.
67 68 69 70 71 |
# File 'lib/perka/client_api.rb', line 67 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.
58 59 60 61 |
# File 'lib/perka/client_api.rb', line 58 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.
24 25 26 27 |
# File 'lib/perka/client_api.rb', line 24 def customer_points_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/customer/points") to_return end |
#customer_reward_put(entity) ⇒ Object
Rewards a Customer. This method will implicitly create a <entityReference payloadName=‘visit’> Visit</entityReference> which will be returned. The response will also include any s manipulated by this visit, as well as the customer’s most recent @TierTraversal at the associated @Merchant
139 140 141 142 143 |
# File 'lib/perka/client_api.rb', line 139 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_uuid_get(uuid) ⇒ Object
Retrieves the customer associated with the given uuid. The response will include reward and tierTraversal information for the merchant associated with the logged in clerk or merchantUser.
17 18 19 20 |
# File 'lib/perka/client_api.rb', line 17 def customer_uuid_get(uuid) to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/customer/{uuid}", uuid) 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.
150 151 152 153 154 |
# File 'lib/perka/client_api.rb', line 150 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.
170 171 172 173 |
# File 'lib/perka/client_api.rb', line 170 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.
160 161 162 163 164 |
# File 'lib/perka/client_api.rb', line 160 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
184 185 186 187 188 |
# File 'lib/perka/client_api.rb', line 184 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.
178 179 180 181 |
# File 'lib/perka/client_api.rb', line 178 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.
45 46 47 48 |
# File 'lib/perka/client_api.rb', line 45 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.
52 53 54 55 |
# File 'lib/perka/client_api.rb', line 52 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.
39 40 41 42 |
# File 'lib/perka/client_api.rb', line 39 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.
32 33 34 35 |
# File 'lib/perka/client_api.rb', line 32 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>
88 89 90 91 92 |
# File 'lib/perka/client_api.rb', line 88 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>.
121 122 123 124 125 |
# File 'lib/perka/client_api.rb', line 121 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.
102 103 104 105 |
# File 'lib/perka/client_api.rb', line 102 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
108 109 110 111 |
# File 'lib/perka/client_api.rb', line 108 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.
114 115 116 117 |
# File 'lib/perka/client_api.rb', line 114 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
94 95 96 97 98 |
# File 'lib/perka/client_api.rb', line 94 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>.
130 131 132 133 |
# File 'lib/perka/client_api.rb', line 130 def merchant_locations_get to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/merchant/locations") to_return end |