perka 1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +12 -0
  3. data/LICENSE.txt +201 -0
  4. data/README.md +17 -0
  5. data/Rakefile +70 -0
  6. data/lib/perka/client_api.rb +260 -0
  7. data/lib/perka/model/abstract_reward_confirmation.rb +15 -0
  8. data/lib/perka/model/abstract_user.rb +37 -0
  9. data/lib/perka/model/api_description.rb +22 -0
  10. data/lib/perka/model/base_entity_global.rb +27 -0
  11. data/lib/perka/model/bounce_back_target.rb +33 -0
  12. data/lib/perka/model/canned_email_outbound_message.rb +14 -0
  13. data/lib/perka/model/clerk.rb +41 -0
  14. data/lib/perka/model/composite_target.rb +22 -0
  15. data/lib/perka/model/console_message.rb +16 -0
  16. data/lib/perka/model/coupon.rb +52 -0
  17. data/lib/perka/model/coupon_campaign.rb +26 -0
  18. data/lib/perka/model/coupon_redemption.rb +26 -0
  19. data/lib/perka/model/coupon_target.rb +30 -0
  20. data/lib/perka/model/coupon_visibility.rb +29 -0
  21. data/lib/perka/model/customer.rb +41 -0
  22. data/lib/perka/model/customer_device.rb +23 -0
  23. data/lib/perka/model/endpoint_description.rb +49 -0
  24. data/lib/perka/model/entity_annotation.rb +33 -0
  25. data/lib/perka/model/entity_description.rb +31 -0
  26. data/lib/perka/model/everybody_target.rb +15 -0
  27. data/lib/perka/model/feedback_item.rb +28 -0
  28. data/lib/perka/model/first_visit_target.rb +16 -0
  29. data/lib/perka/model/idle_customer_target.rb +20 -0
  30. data/lib/perka/model/integrator_user.rb +16 -0
  31. data/lib/perka/model/internal_user.rb +15 -0
  32. data/lib/perka/model/like_to_unlock_target.rb +14 -0
  33. data/lib/perka/model/list_target.rb +17 -0
  34. data/lib/perka/model/merchant.rb +42 -0
  35. data/lib/perka/model/merchant_capability.rb +16 -0
  36. data/lib/perka/model/merchant_device.rb +29 -0
  37. data/lib/perka/model/merchant_location.rb +46 -0
  38. data/lib/perka/model/merchant_user.rb +29 -0
  39. data/lib/perka/model/nobody_target.rb +15 -0
  40. data/lib/perka/model/outbound_message.rb +14 -0
  41. data/lib/perka/model/parameter_description.rb +29 -0
  42. data/lib/perka/model/participation_target.rb +34 -0
  43. data/lib/perka/model/physical_redemption_target.rb +17 -0
  44. data/lib/perka/model/points_activity.rb +34 -0
  45. data/lib/perka/model/points_activity_confirmation.rb +24 -0
  46. data/lib/perka/model/points_catalog_item.rb +41 -0
  47. data/lib/perka/model/program.rb +35 -0
  48. data/lib/perka/model/program_tier.rb +30 -0
  49. data/lib/perka/model/program_type.rb +27 -0
  50. data/lib/perka/model/property.rb +65 -0
  51. data/lib/perka/model/punch_reward_confirmation.rb +43 -0
  52. data/lib/perka/model/push_message.rb +17 -0
  53. data/lib/perka/model/redemption_coupon_confirmation.rb +26 -0
  54. data/lib/perka/model/redemption_reward_confirmation.rb +26 -0
  55. data/lib/perka/model/reward.rb +38 -0
  56. data/lib/perka/model/reward_advancement.rb +30 -0
  57. data/lib/perka/model/reward_grant.rb +37 -0
  58. data/lib/perka/model/sms_message.rb +15 -0
  59. data/lib/perka/model/sms_outbound_message.rb +14 -0
  60. data/lib/perka/model/social_list_target.rb +14 -0
  61. data/lib/perka/model/social_service_subscription.rb +26 -0
  62. data/lib/perka/model/street_address.rb +27 -0
  63. data/lib/perka/model/tier_target.rb +24 -0
  64. data/lib/perka/model/tier_traversal.rb +30 -0
  65. data/lib/perka/model/tier_traversal_confirmation.rb +28 -0
  66. data/lib/perka/model/type.rb +33 -0
  67. data/lib/perka/model/user_credentials.rb +28 -0
  68. data/lib/perka/model/visit.rb +59 -0
  69. data/lib/perka/model/visit_confirmation.rb +47 -0
  70. data/lib/perka/model/weather_target.rb +27 -0
  71. data/lib/perka/model/yield_management_target.rb +23 -0
  72. data/lib/perka/perka_api.rb +89 -0
  73. data/lib/perka/version.rb +3 -0
  74. data/lib/perka.rb +6 -0
  75. data/lib/perka_fast.rb +68 -0
  76. data/perka.gemspec +20 -0
  77. data/spec/api_integrator_spec.rb +210 -0
  78. data/spec/model_spec.rb +24 -0
  79. metadata +178 -0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ target/generated
2
+ target/*.jar
3
+ .DS_Store
4
+ .classpath
5
+ .project
6
+ .settings
7
+ .buildpath
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in foo.gemspec
4
+ gemspec
5
+
6
+ #TODO figure out how to have this locally (maven snapshot style)
7
+ #gem "flatpack_client", :path => '/home/amit/projects/themelt/perka_fork/flatpack-client', :group => :development
8
+ #gem "flatpack_client", :git => 'git@github.com:amitrawal/flatpack-client.git'
9
+ #gem "flatpack_core", :git => 'git@github.com:amitrawal/flatpack-core.git', :group => :development
10
+
11
+
12
+
data/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Perka
2
+
3
+ Perka client library for Ruby
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'perka'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install perka
data/Rakefile ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env rake
2
+ require 'rake/testtask'
3
+
4
+ API_SRC = "https://getperka.com/api/2/describe"
5
+ SRC_DIR = "#{File.dirname(__FILE__)}/src"
6
+ OUTPUT_DIR = "#{File.dirname(__FILE__)}/target"
7
+ FLATPACK_OUTPUT_DIR = "#{OUTPUT_DIR}/generated"
8
+ GEM_OUTPUT_DIR = "#{OUTPUT_DIR}/gem"
9
+
10
+ # Defalt to the most recently released version. Use LATEST for bleeding-edge.
11
+ FAST_VERSION = 'RELEASE'
12
+ FAST_JAR = "#{OUTPUT_DIR}/fast.jar"
13
+
14
+ task :clean do
15
+ puts 'cleaning...'
16
+ `rm -rf #{OUTPUT_DIR}`
17
+ end
18
+
19
+ desc "Generates the flatpack lib"
20
+ task :gen do
21
+
22
+ # download the fast executable jar if we haven't already
23
+ unless(File.exist?("#{FAST_JAR}"))
24
+ puts 'fetching fast.jar...'
25
+
26
+ `mvn -f ../flatpack-java/fast/pom.xml install`
27
+
28
+ `mvn -U org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
29
+ -Drepo=https://oss.sonatype.org/content/groups/public/ \
30
+ -Dartifact=com.getperka.flatpack:flatpack-fast:#{FAST_VERSION}:jar:shaded \
31
+ -Ddest=#{FAST_JAR}`
32
+ end
33
+
34
+ puts 'running fast code generation...'
35
+ puts `java -jar #{FAST_JAR} \
36
+ --RbDialect.gemName perka \
37
+ --RbDialect.moduleName Perka \
38
+ --RbDialect.modelModuleName Model \
39
+ generate --in #{API_SRC} --dialect rb --out #{OUTPUT_DIR} $@`
40
+ end
41
+
42
+ desc "Combines the generated flatpack code with our local code in the gem output dir"
43
+ task :combine => :gen do
44
+ # clean up
45
+ `rm -rf #{GEM_OUTPUT_DIR}`
46
+ `mkdir -p #{GEM_OUTPUT_DIR}`
47
+
48
+ # combine our code in the gem output dir
49
+ `cp -r #{SRC_DIR}/* #{GEM_OUTPUT_DIR}`
50
+ `cp -r #{FLATPACK_OUTPUT_DIR}/* #{GEM_OUTPUT_DIR}/lib`
51
+ end
52
+
53
+ # Build and install the local core / client gems
54
+ desc "Build dependent gems"
55
+ task :build_deps do
56
+ puts 'building dependent gems...'
57
+ Dir.chdir("#{SRC_DIR}/../../flatpack-rb/core") { `bundle install` }
58
+ Dir.chdir("#{SRC_DIR}/../../flatpack-rb/client") { `bundle install` }
59
+ end
60
+
61
+ desc "Run tests"
62
+ task :test => [:combine, :build_deps] do
63
+ puts 'running rspec tests...'
64
+ Dir.chdir(GEM_OUTPUT_DIR) { puts `bundle exec rspec spec` }
65
+ end
66
+
67
+ desc "Install Gem"
68
+ task :install => :test do
69
+ Dir.chdir(GEM_OUTPUT_DIR) { puts `bundle install` }
70
+ end
@@ -0,0 +1,260 @@
1
+ # Generated File - DO NOT EDIT
2
+ require 'flatpack_client'
3
+
4
+ module Perka
5
+ class ClientApi < Flatpack::Client::BaseApi
6
+ include Flatpack::Core::MapInitialize
7
+
8
+ # Returns the manifest of perk icon names.
9
+ def asset_manifest_perks_get
10
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/asset/manifest/perks")
11
+ to_return
12
+ end
13
+
14
+ # Returns the current customer's PointsActivity status across all merchants
15
+ # with a points-based loyalty system.
16
+ def customer_points_get
17
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/customer/points")
18
+ to_return
19
+ end
20
+
21
+ # Performs a deep serialization of an entity. This endpoint is intended to provide
22
+ # supplementary one-to-many relationship data that is not normally serialized
23
+ # to keep payload sizes manageable.
24
+ def describe_type_uuid_get(type, uuid)
25
+ to_return = DescribeTypeUuidGet.new(self, type, uuid)
26
+ to_return
27
+ end
28
+
29
+ # Provides a machine-readable description of an entity type per the logged-in
30
+ # role.
31
+ def describe_type_get(type)
32
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/describe/{type}", type)
33
+ to_return
34
+ end
35
+
36
+ # Returns a description of the methods and entity types used by the API server.
37
+ def describe_get
38
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/describe")
39
+ to_return
40
+ end
41
+
42
+ # A diagnostic endpoint to extract the information from an OAuth2 authorization
43
+ # code, login token, session token, or refresh token.
44
+ def describe_token_get
45
+ to_return = DescribeTokenGet.new(self)
46
+ to_return
47
+ end
48
+
49
+ # Find an annotation applied to a persistent entity.
50
+ def annotation_type_uuid_get(type, uuid)
51
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/annotation/{type}/{uuid}", type, uuid)
52
+ to_return
53
+ end
54
+
55
+ # Add or replace an annotation applied to a persistent entity. If the value
56
+ # of <entityReference payloadName='entityAnnotation'> EntityAnnotation</entityReference>
57
+ # is missing or <code>null</code>, the annotation will be removed. This method
58
+ # will return the previously-stored annotation, if any.
59
+ def annotation_put(entity)
60
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/annotation")
61
+ to_return.entity = entity
62
+ to_return
63
+ end
64
+
65
+ # Creates a new customer associated with the current <entityReference payloadName='integratorUser'>
66
+ # IntegratorUser</entityReference>, or returns an existing customer if a matching
67
+ # customer already exists. The given <entityReference payloadName='userCredentials'>
68
+ # UserCredentials</entityReference> must include an email, phone, or both. The
69
+ # following rules will be used to determine if a new customer should be created
70
+ # <ul> <li>If a customer exists with a matching <b>confirmed</b> email address
71
+ # or <b>confirmed</b> phone number, that customer will be returned.</li> <li>If
72
+ # a customer exists that is associated with the current <entityReference payloadName='integratorUser'>
73
+ # IntegratorUser</entityReference>, and has a matching <b>unconfirmed</b> email
74
+ # address or <b>unconfirmed</b> phone number, that customer will be returned.
75
+ # The email check will happen first, and will short-circuit the phone check
76
+ # if a match is found.</li> <li>Otherwise, a new customer will be created and
77
+ # associated with your <entityReference payloadName='integratorUser'> IntegratorUser</entityReference>.
78
+ # The given phone number and email address will be stored as unconfirmed values.
79
+ # </ul>
80
+ def integrator_customer_post(entity)
81
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "POST", "/api/2/integrator/customer")
82
+ to_return.entity = entity
83
+ to_return
84
+ end
85
+
86
+ def integrator_merchant_post(entity)
87
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "POST", "/api/2/integrator/merchant")
88
+ to_return.entity = entity
89
+ to_return
90
+ end
91
+
92
+ # Completely destroys all customer data associated with the current integrator
93
+ # user. This endpoint is only available in the sandbox environment.
94
+ def integrator_destroy_delete
95
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "DELETE", "/api/2/integrator/destroy")
96
+ to_return
97
+ end
98
+
99
+ # Returns a list of all merchants managed by the current integrator user
100
+ def integrator_managed_merchants_get
101
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/integrator/managed/merchants")
102
+ to_return
103
+ end
104
+
105
+ # Returns a list of all users the integrator may act as.
106
+ def integrator_managed_users_get
107
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/integrator/managed/users")
108
+ to_return
109
+ end
110
+
111
+ # Updates an existing <entityReference payloadName='customer'> Customer</entityReference>
112
+ # manageed by the current <entityReference payloadName='integratorUser'> IntegratorUser</entityReference>.
113
+ def integrator_customer_put(entity)
114
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/integrator/customer")
115
+ to_return.entity = entity
116
+ to_return
117
+ end
118
+
119
+ # Returns a sparse payload of all live <entityReference payloadName='merchantLocation'>
120
+ # locations</entityReference> and their associated <entityReference payloadName='merchant'>
121
+ # merchants</entityReference>.
122
+ def merchant_locations_get
123
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "GET", "/api/2/merchant/locations")
124
+ to_return
125
+ end
126
+
127
+ # Allows a <entityReference payloadName='customer'> Customer's</entityReference>
128
+ # reward status to be retrieved. Customers may be searched for by UUID.
129
+ def customer_reward_get
130
+ to_return = CustomerRewardGet.new(self)
131
+ to_return
132
+ end
133
+
134
+ # Reward a Customer. This method will implicitly create a <entityReference payloadName='visit'>
135
+ # Visit</entityReference> which will be returned.
136
+ def customer_reward_put(entity)
137
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/customer/reward")
138
+ to_return.entity = entity
139
+ to_return
140
+ end
141
+
142
+ # Rewrites the history of a customer's latest validated visit to a merchant.
143
+ # The <entityReference payloadName='abstractRewardConfirmation'> AbstractRewardConfirmation</entityReference>
144
+ # instances associated with the <entityReference payloadName='visitConfirmation'>
145
+ # VisitConfirmation</entityReference> should reflect the desired state of the
146
+ # Visit. <p> This method will return the updated Visit.
147
+ def customer_visit_amend_put(entity)
148
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/customer/visit/amend")
149
+ to_return.entity = entity
150
+ to_return
151
+ end
152
+
153
+ # Creates a new outstanding visit for the current customer at the given location.
154
+ # If the customer has no active Rewards at the associated merchant, a new Reward
155
+ # will be created for each of the merchant's programs. Information about the
156
+ # visit, and all active rewards for the associated merchant will be returned.
157
+ def customer_visit_post(entity)
158
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "POST", "/api/2/customer/visit")
159
+ to_return.entity = entity
160
+ to_return
161
+ end
162
+
163
+ # Returns a sparse list of visits at the current merchant location that are
164
+ # un-validated, or that occurred after the time of the most recent validated
165
+ # visit given. This request must be made with a anonymous clerk role that corresponds
166
+ # to exactly one MerchantLocation.
167
+ def customer_visit_get
168
+ to_return = CustomerVisitGet.new(self)
169
+ to_return
170
+ end
171
+
172
+ # Checks for the validation of an outstanding visit and returns a sparse payload
173
+ # of <entityReference payloadName='visit'> Visit</entityReference> and related
174
+ # items.
175
+ def customer_visit_validate_get
176
+ to_return = CustomerVisitValidateGet.new(self)
177
+ to_return
178
+ end
179
+
180
+ # Validates a visit
181
+ def customer_visit_put(entity)
182
+ to_return = Flatpack::Client::FlatpackRequest.new(self, "PUT", "/api/2/customer/visit")
183
+ to_return.entity = entity
184
+ to_return
185
+ end
186
+
187
+ private
188
+
189
+ class DescribeTypeUuidGet < Flatpack::Client::FlatpackRequest
190
+
191
+ def initialize(api, *args)
192
+ super(api, "GET", "/api/2/describe/{type}/{uuid}", *args)
193
+ end
194
+
195
+ # An ISO8601-formatted datetime that will be used to filter the entities in
196
+ # the payload's data section to those that were created or updated after the
197
+ # specified time
198
+ def with_last_modified(last_modified)
199
+ query_parameter('lastModified', last_modified);
200
+ end
201
+
202
+ end
203
+
204
+ class DescribeTokenGet < Flatpack::Client::FlatpackRequest
205
+
206
+ def initialize(api, *args)
207
+ super(api, "GET", "/api/2/describe/token", *args)
208
+ end
209
+
210
+ def with_token(token)
211
+ query_parameter('token', token);
212
+ end
213
+
214
+ end
215
+
216
+ class CustomerRewardGet < Flatpack::Client::FlatpackRequest
217
+
218
+ def initialize(api, *args)
219
+ super(api, "GET", "/api/2/customer/reward", *args)
220
+ end
221
+
222
+ # A UUID allocated by the server
223
+ def with_customer_uuid(customer_uuid)
224
+ query_parameter('customerUuid', customer_uuid);
225
+ end
226
+
227
+ end
228
+
229
+ class CustomerVisitGet < Flatpack::Client::FlatpackRequest
230
+
231
+ def initialize(api, *args)
232
+ super(api, "GET", "/api/2/customer/visit", *args)
233
+ end
234
+
235
+ # By default, requests to this endpoint will hang for a period of time before
236
+ # returning in order to wait for a visit associated with the location to be
237
+ # created or updated. Setting this query parameter to <code>true</code> will
238
+ # disable the hanging get behavior, which is appropriate for requests used
239
+ # for first-time UI initialization.
240
+ def with_fast_poll(fast_poll)
241
+ query_parameter('fastPoll', fast_poll);
242
+ end
243
+
244
+ end
245
+
246
+ class CustomerVisitValidateGet < Flatpack::Client::FlatpackRequest
247
+
248
+ def initialize(api, *args)
249
+ super(api, "GET", "/api/2/customer/visit/validate", *args)
250
+ end
251
+
252
+ def with_most_recent_validated_uuid(most_recent_validated_uuid)
253
+ query_parameter('mostRecentValidatedUuid', most_recent_validated_uuid);
254
+ end
255
+
256
+ end
257
+
258
+
259
+ end
260
+ end
@@ -0,0 +1,15 @@
1
+ # Generated File - DO NOT EDIT
2
+
3
+ require 'flatpack_core'
4
+
5
+ module Perka
6
+ module Model
7
+
8
+ # A base data type that represents an award of program status.
9
+ class AbstractRewardConfirmation < Flatpack::Core::BaseHasUuid
10
+
11
+
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,37 @@
1
+ # Generated File - DO NOT EDIT
2
+
3
+ require 'perka/model/base_entity_global'
4
+
5
+ module Perka
6
+ module Model
7
+
8
+ # A supertype for all objects representing an identity. Each subtype of AbstractUser
9
+ # has an associated role which is used to controll access to API endpoints and
10
+ # model properties.
11
+ class AbstractUser < BaseEntityGlobal
12
+
13
+ PROPERTY_NAMES = [
14
+
15
+ # A user's role is used to control access to API endpoints and model properties.
16
+ :role,
17
+ :email,
18
+ :first_name,
19
+ :last_name,
20
+ :new_password,
21
+ :new_password_confirmation,
22
+ :phone,
23
+
24
+ # Users whose email addresses have not been confirmed via a click-to-confirm
25
+ # email will have this field populated. Multiple user entities may share
26
+ # the same unconfirmed email address. When the address is confirmed, these
27
+ # entities will be merged.
28
+ :unconfirmed_email,
29
+ :unconfirmed_phone,
30
+ :password_set
31
+ ]
32
+ attr_accessor *PROPERTY_NAMES
33
+
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,22 @@
1
+ # Generated File - DO NOT EDIT
2
+
3
+ require 'flatpack_core'
4
+
5
+ module Perka
6
+ module Model
7
+
8
+ # A description of the entities contained within an API.
9
+ class ApiDescription < Flatpack::Core::BaseHasUuid
10
+
11
+ PROPERTY_NAMES = [
12
+ :api_name,
13
+ :api_version,
14
+ :endpoints,
15
+ :entities
16
+ ]
17
+ attr_accessor *PROPERTY_NAMES
18
+
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,27 @@
1
+ # Generated File - DO NOT EDIT
2
+
3
+ require 'flatpack_core'
4
+
5
+ module Perka
6
+ module Model
7
+
8
+ # Provides random uuid generation
9
+ class BaseEntityGlobal < Flatpack::Core::BaseHasUuid
10
+
11
+ PROPERTY_NAMES = [
12
+
13
+ # Returns the time at which the entity was first persisted to the Perka
14
+ # database.
15
+ :created_at,
16
+
17
+ # Returns the last time at which an update to the entity was persisted to
18
+ # the database. This property will be null for entities that have never
19
+ # been mutated since originally being persisted.
20
+ :updated_at
21
+ ]
22
+ attr_accessor *PROPERTY_NAMES
23
+
24
+
25
+ end
26
+ end
27
+ end