applin-rails 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f11a102a56166f3f421fb2c6d0786d5a90da55daa6c615485ae06acecf02b2ed
4
- data.tar.gz: c1298b70fae23013717056445f5a101c159ab649b994118badf08c473d993e66
3
+ metadata.gz: 8867eef768fdce7a5c2bf8c18a83e8adc99ad18854578c82815c1d7016199866
4
+ data.tar.gz: 7c4633294fc36b21e876aa93b9d3d85380eb30ef9db4bbaeacd96c83e84b3032
5
5
  SHA512:
6
- metadata.gz: 2baf2bc186d74f6da057c733f5bede7eeaf04ea1132961bdf3e6a199892a643a265b72b9415ae0b744af4a53cd8c2eed032f9ae6439e6796303c474ddd11c0d2
7
- data.tar.gz: 6b664c8f4d86b48a5c5cee0b57aac4803e8451d4fc55a3b53cfb44890c0930d62f94e5f655de589877c9d76a9b4a3c292f6a3ef960657f382dedf5344d7e8057
6
+ metadata.gz: 79ed3689644ff339a5bbcf9a3728f5903e19de48f7c184035c0f31b21f9536978482fbcad122e8413cfc419c4e5315dd889376ae9c4b32685c4d777f8ed56455
7
+ data.tar.gz: 80c63c298656f77b900a5380692a59e1f9b4166893039a082b8d9577167a2fb58afbf4ec8115b1442e909aa6db2033e764dc184de94ec5deeb57d894e9ec605b
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 3.2
3
+ NewCops: enable
3
4
 
4
5
  Style/StringLiterals:
5
6
  Enabled: true
@@ -11,3 +12,15 @@ Style/StringLiteralsInInterpolation:
11
12
 
12
13
  Layout/LineLength:
13
14
  Max: 120
15
+
16
+ Layout/LeadingCommentSpace:
17
+ Enabled: false
18
+
19
+ Metrics/ModuleLength:
20
+ Max: 250
21
+
22
+ Style/HashSyntax:
23
+ EnforcedShorthandSyntax: never
24
+
25
+ Style/TrailingCommaInHashLiteral:
26
+ EnforcedStyleForMultiline: comma
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Applin::Rails
2
2
 
3
- Applin™ server library for Ruby on Rails
4
- https://www.applin.dev/
3
+ This is the source code for <https://rubygems.org/gems/applin-rails>.
5
4
 
6
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/applin/rails`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ Use this library to make a backend for your mobile app which uses
6
+ the Applin™ Server-Driven UI framework.
7
+ See <https://www.applin.dev/>
7
8
 
8
9
  ## Install
9
10
  To add the gem to your Rails application:
@@ -11,11 +12,20 @@ To add the gem to your Rails application:
11
12
  $ bundle add applin-rails
12
13
 
13
14
  ## Use
14
- TODO
15
+ * Docs: <https://www.applin.dev/docs/backend-libraries.html>
16
+ * Example: <https://github.com/leonhard-llc/applin-rails-demo>
17
+
18
+ ## Changes
19
+ - v0.6.0
20
+ - Support ApplinIos v0.25.0.
21
+ - Add `poll_delay_ms` to checkbox and textfield.
22
+ - Remove checkbox `rpc` field.
15
23
 
16
24
  ## Contributing
17
25
  Bug reports and pull requests are welcome on GitHub at <https://github.com/leonhard-llc/applin-rails>.
18
26
 
27
+ When sending PRs, please email us a signed CLA using [cla-email-template.txt](cla-email-template.txt).
28
+
19
29
  ## Development
20
30
  * Install dependencies: `bin/setup`
21
31
  * `rake test`
@@ -23,6 +33,6 @@ Bug reports and pull requests are welcome on GitHub at <https://github.com/leonh
23
33
 
24
34
  To release a new version:
25
35
  1. Install the gem onto your local machine: `bundle exec rake install`
26
- 2. Test it with <https://github.com/leonhard-llc/applin-rails-example>
36
+ 2. Test it with <https://github.com/leonhard-llc/applin-rails-demo>
27
37
  1. Update the version number in `version.rb`
28
38
  1. Run `bundle exec rake release`. This will create a git tag, make a `.gem` file, and push the file to <https://rubygems.org>.
@@ -0,0 +1,114 @@
1
+ To: michael@leonhardllc.com
2
+ Subject: signing cla
3
+
4
+ Hello Leonhard LLC,
5
+ I agree to the Software Grant and Corporate Contributor License
6
+ Agreement.
7
+
8
+ MY LEGAL NAME
9
+ MY@EMAIL.ADDRESS
10
+
11
+ ---
12
+
13
+ Software Grant and Corporate Contributor License Agreement
14
+
15
+ In order to clarify the intellectual property license granted with
16
+ Contributions from any person or entity, Leonhard LLC must have a
17
+ Contributor License Agreement (CLA) on file that has been signed by
18
+ each Contributor, indicating agreement to the license terms
19
+ below. This license is for your protection as a Contributor as well as
20
+ the protection of Leonhard LLC and its users; it does not change your
21
+ rights to use your own Contributions for any other purpose.
22
+
23
+ This version of the Agreement allows an entity (the "Corporation") to
24
+ submit Contributions to Leonhard LLC, to authorize Contributions
25
+ submitted by its designated employees to Leonhard LLC, and to grant
26
+ copyright and patent licenses thereto.
27
+
28
+ You accept and agree to the following terms and conditions for Your
29
+ present and future Contributions submitted to Leonhard LLC. Except for
30
+ the license granted herein to Leonhard LLC and recipients of software
31
+ distributed by Leonhard LLC, You reserve all right, title, and
32
+ interest in and to Your Contributions.
33
+
34
+ 1. Definitions.
35
+
36
+ "You" (or "Your") shall mean the copyright owner or legal entity
37
+ authorized by the copyright owner that is making this Agreement with
38
+ Leonhard LLC. For legal entities, the entity making a Contribution and
39
+ all other entities that control, are controlled by, or are under
40
+ common control with that entity are considered to be a single
41
+ Contributor. For the purposes of this definition, "control" means (i)
42
+ the power, direct or indirect, to cause the direction or management of
43
+ such entity, whether by contract or otherwise, or (ii) ownership of
44
+ fifty percent (50%) or more of the outstanding shares, or (iii)
45
+ beneficial ownership of such entity.
46
+
47
+ "Contribution" shall mean the code, documentation or any original work
48
+ of authorship, including any modifications or additions to an existing
49
+ work, that is intentionally submitted by You to Leonhard LLC for
50
+ inclusion in, or documentation of, any of the products owned or
51
+ managed by Leonhard LLC (the "Work"). For the purposes of this
52
+ definition, "submitted" means any form of electronic, verbal, or
53
+ written communication sent to Leonhard LLC or its representatives,
54
+ including but not limited to communication on electronic mailing
55
+ lists, source code control systems, and issue tracking systems that
56
+ are managed by, or on behalf of, Leonhard LLC for the purpose of
57
+ discussing and improving the Work, but excluding communication that is
58
+ conspicuously marked or otherwise designated in writing by You as "Not
59
+ a Contribution."
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of
62
+ this Agreement, You hereby grant to Leonhard LLC and to recipients of
63
+ software distributed by Leonhard LLC a perpetual, worldwide,
64
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license
65
+ to reproduce, prepare derivative works of, publicly display, publicly
66
+ perform, sublicense, and distribute Your Contributions and such
67
+ derivative works.
68
+
69
+ 3. Grant of Patent License. Subject to the terms and conditions of
70
+ this Agreement, You hereby grant to Leonhard LLC and to recipients of
71
+ software distributed by Leonhard LLC a perpetual, worldwide,
72
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated
73
+ in this section) patent license to make, have made, use, offer to
74
+ sell, sell, import, and otherwise transfer the Work, where such
75
+ license applies only to those patent claims licensable by You that are
76
+ necessarily infringed by Your Contribution(s) alone or by combination
77
+ of Your Contribution(s) with the Work to which such Contribution(s)
78
+ was submitted. If any entity institutes patent litigation against You
79
+ or any other entity (including a cross-claim or counterclaim in a
80
+ lawsuit) alleging that your Contribution, or the Work to which you
81
+ have contributed, constitutes direct or contributory patent
82
+ infringement, then any patent licenses granted to that entity under
83
+ this Agreement for that Contribution or Work shall terminate as of the
84
+ date such litigation is filed.
85
+
86
+ 4. You represent that You are legally entitled to grant the above
87
+ license. You represent further that each employee of the Corporation
88
+ designated by You is authorized to submit Contributions on behalf of
89
+ the Corporation.
90
+
91
+ 5. You represent that each of Your Contributions is Your original
92
+ creation (see section 7 for submissions on behalf of others).
93
+
94
+ 6. You are not expected to provide support for Your Contributions,
95
+ except to the extent You desire to provide support. You may provide
96
+ support for free, for a fee, or not at all. Unless required by
97
+ applicable law or agreed to in writing, You provide Your Contributions
98
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
99
+ either express or implied, including, without limitation, any
100
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
101
+ or FITNESS FOR A PARTICULAR PURPOSE.
102
+
103
+ 7. Should You wish to submit work that is not Your original creation,
104
+ You may submit it to Leonhard LLC separately from any Contribution,
105
+ identifying the complete details of its source and of any license or
106
+ other restriction (including, but not limited to, related patents,
107
+ trademarks, and license agreements) of which you are personally aware,
108
+ and conspicuously marking the work as "Submitted on behalf of a
109
+ third-party: [named here]".
110
+
111
+ 8. It is your responsibility to notify Leonhard LLC when any change is
112
+ required to the list of designated employees authorized to submit
113
+ Contributions on behalf of the Corporation, or to the Corporation's
114
+ Point of Contact with Leonhard LLC.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Applin
4
4
  module Rails
5
- VERSION = "0.4.0"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end
data/lib/applin/rails.rb CHANGED
@@ -1,206 +1,17 @@
1
1
  # frozen_string_literal: true
2
- require_relative "rails/version"
3
2
 
4
3
  # https://guides.rubyonrails.org/action_controller_overview.html#restful-downloads
5
- Mime::Type.register "application/vnd.applin_response", :applin_response
6
-
7
- ActionController::Renderers.add :applin_response do |obj, options|
8
- body = { page: obj }.to_json
9
- options[:type] = Mime[:applin_response]
10
- send_data body, options
11
- end
4
+ Mime::Type.register "application/vnd.applin_response", :applin
12
5
 
13
6
  module Applin
7
+ # Helper functions for creating Applin responses from controllers.
14
8
  module Rails
15
- ALIGN_CENTER = "center"
16
- ALIGN_END = "end"
17
- ALIGN_START = "start"
18
- ALLOW_ALL = "all"
19
- ALLOW_ASCII = "ascii"
20
- ALLOW_EMAIL = "email"
21
- ALLOW_NUMBERS = "numbers"
22
- ALLOW_TEL = "tel"
23
- AUTO_CAPITALIZE_NAMES = "names"
24
- AUTO_CAPITALIZE_SENTENCES = "sentences"
25
- DISPOSITION_FIT = "fit"
26
- DISPOSITION_STRETCH = "stretch"
27
- DISPOSITION_COVER = "cover"
9
+ module_function
28
10
 
29
11
  def send_page(page, options = {})
30
12
  body = { page: page }.to_json
31
- options[:type] = Mime[:applin_response]
13
+ options[:type] = Mime[:applin]
32
14
  send_data body, options
33
15
  end
34
-
35
- def back_button(actions:)
36
- { typ: :back_button, actions: actions }
37
- end
38
-
39
- def button(text:, actions:)
40
- { typ: :button, text: text, actions: actions }
41
- end
42
-
43
- def checkbox(text:, var_name:, actions: nil, initial_bool: nil, rpc: nil)
44
- {
45
- typ: :checkbox,
46
- actions: actions,
47
- initial_bool: initial_bool,
48
- rpc: rpc,
49
- text: text,
50
- var_name: var_name,
51
- }.reject { |_k, v| v.nil? }
52
- end
53
-
54
- def column(widgets:, align: nil, spacing: nil)
55
- { typ: :column, align: align, spacing: spacing, widgets: widgets }.reject { |_k, v| v.nil? }
56
- end
57
-
58
- def empty
59
- { typ: :empty }
60
- end
61
-
62
- # The client replaces `${INTERACTIVE_ERROR_DETAILS}` with the text of the last error.
63
- def error_text(text)
64
- { typ: :error_text, text: text }
65
- end
66
-
67
- def form(widgets:)
68
- { typ: :form, widgets: widgets }
69
- end
70
-
71
- def form_button(text:, actions:, align: nil)
72
- { typ: :form_button, align: align, text: text, actions: actions }.reject { |_k, v| v.nil? }
73
- end
74
-
75
- def form_section(widgets:, title: nil)
76
- { typ: :form_section, title: title, widgets: widgets }.reject { |_k, v| v.nil? }
77
- end
78
-
79
- # `row_groups` is a an array of arrays of widgets.
80
- def grouped_row_table(row_groups:, spacing: nil)
81
- { typ: :grouped_row_table, spacing: spacing, row_groups: row_groups }.reject { |_k, v| v.nil? }
82
- end
83
-
84
- # Pass one of the DISPOSITION_* values for the `disposition` parameter.
85
- def image(aspect_ratio:, url:, disposition: nil)
86
- { typ: :image, disposition: disposition, aspect_ratio: aspect_ratio, url: url }.reject { |_k, v| v.nil? }
87
- end
88
-
89
- def last_error_text
90
- { typ: :last_error_text }
91
- end
92
-
93
- def nav_button(text:, actions:, badge_text: nil, photo_url: nil, sub_text: nil)
94
- {
95
- typ: :nav_button,
96
- badge_text: badge_text,
97
- photo_url: photo_url,
98
- sub_text: sub_text,
99
- text: text,
100
- actions: actions,
101
- }.reject { |_k, v| v.nil? }
102
- end
103
-
104
- def scroll(&widget_block)
105
- { typ: :scroll, widget: widget_block.yield }
106
- end
107
-
108
- def text(text)
109
- { typ: :text, text: text }
110
- end
111
-
112
- # Pass one of the ALLOW_* values for `allow`.
113
- # Pass one of the AUTO_CAPITALIZE_* values for `auto_capitalize`.
114
- def textfield(
115
- var_name:, allow: nil,
116
- auto_capitalize: nil,
117
- error: nil,
118
- initial_string: nil,
119
- label: nil,
120
- max_chars: nil,
121
- max_lines: nil,
122
- min_chars: nil
123
- )
124
- {
125
- typ: :textfield,
126
- allow: allow,
127
- auto_capitalize: auto_capitalize,
128
- error: error,
129
- initial_string: initial_string,
130
- label: label,
131
- max_chars: max_chars,
132
- max_lines: max_lines,
133
- min_chars: min_chars,
134
- var_name: var_name,
135
- }.reject { |_k, v| v.nil? }
136
- end
137
-
138
- def nav_page(title:, start: nil, end_: nil, ephemeral: nil, stream: nil, poll_seconds: nil, &widget_block)
139
- {
140
- typ: :nav_page,
141
- start: start,
142
- end: end_,
143
- ephemeral: ephemeral,
144
- title: title,
145
- stream: stream,
146
- poll_seconds: poll_seconds,
147
- widget: widget_block.yield
148
- }.reject { |_k, v| v.nil? }
149
- end
150
-
151
- def plain_page(title: nil, ephemeral: nil, stream: nil, poll_seconds: nil, &widget_block)
152
- {
153
- typ: :plain_page,
154
- title: title,
155
- ephemeral: ephemeral,
156
- stream: stream,
157
- poll_seconds: poll_seconds,
158
- widget: widget_block.yield
159
- }.reject { |_k, v| v.nil? }
160
- end
161
-
162
- def choose_photo(upload_url:)
163
- "choose_photo:#{upload_url}"
164
- end
165
-
166
- def copy_to_clipboard(text)
167
- "copy_to_clipboard:#{text}"
168
- end
169
-
170
- def launch_url(url)
171
- "launch_url:#{url}"
172
- end
173
-
174
- def logout
175
- "logout"
176
- end
177
-
178
- def nothing
179
- "nothing"
180
- end
181
-
182
- def poll
183
- "poll"
184
- end
185
-
186
- def pop
187
- "pop"
188
- end
189
-
190
- def push(page_key)
191
- "push:#{page_key}"
192
- end
193
-
194
- def replace_all(page_key)
195
- "replace_all:#{page_key}"
196
- end
197
-
198
- def rpc(url)
199
- "rpc:#{url}"
200
- end
201
-
202
- def take_photo(upload_url:)
203
- "take_photo:#{upload_url}"
204
- end
205
16
  end
206
17
  end
data/lib/applin.rb ADDED
@@ -0,0 +1,220 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
4
+
5
+ # noinspection RubyTooManyMethodsInspection
6
+ module Applin
7
+ ALIGN_CENTER = "center"
8
+ ALIGN_END = "end"
9
+ ALIGN_START = "start"
10
+ ALLOW_ALL = "all"
11
+ ALLOW_ASCII = "ascii"
12
+ ALLOW_EMAIL = "email"
13
+ ALLOW_NUMBERS = "numbers"
14
+ ALLOW_TEL = "tel"
15
+ AUTO_CAPITALIZE_NAMES = "names"
16
+ AUTO_CAPITALIZE_SENTENCES = "sentences"
17
+ DISPOSITION_FIT = "fit"
18
+ DISPOSITION_STRETCH = "stretch"
19
+ DISPOSITION_COVER = "cover"
20
+
21
+ module_function
22
+
23
+ # Actions ###################################################################
24
+
25
+ def choose_photo(upload_url:)
26
+ "choose_photo:#{upload_url}"
27
+ end
28
+
29
+ def copy_to_clipboard(text)
30
+ "copy_to_clipboard:#{text}"
31
+ end
32
+
33
+ def launch_url(url)
34
+ "launch_url:#{url}"
35
+ end
36
+
37
+ def logout
38
+ "logout"
39
+ end
40
+
41
+ def on_user_error_poll
42
+ "on_user_error_poll"
43
+ end
44
+
45
+ def poll
46
+ "poll"
47
+ end
48
+
49
+ def pop
50
+ "pop"
51
+ end
52
+
53
+ def push(page_key)
54
+ "push:#{page_key}"
55
+ end
56
+
57
+ def replace_all(page_key)
58
+ "replace_all:#{page_key}"
59
+ end
60
+
61
+ def rpc(url)
62
+ "rpc:#{url}"
63
+ end
64
+
65
+ def take_photo(upload_url:)
66
+ "take_photo:#{upload_url}"
67
+ end
68
+
69
+ # Pages #####################################################################
70
+
71
+ def nav_page(
72
+ title:,
73
+ start: nil,
74
+ end_: nil,
75
+ ephemeral: nil,
76
+ stream: nil,
77
+ poll_seconds: nil,
78
+ &widget_block
79
+ )
80
+ {
81
+ typ: :nav_page,
82
+ start: start,
83
+ end: end_,
84
+ ephemeral: ephemeral,
85
+ title: title,
86
+ stream: stream,
87
+ poll_seconds: poll_seconds,
88
+ widget: widget_block.yield,
89
+ }.compact
90
+ end
91
+
92
+ def plain_page(title: nil, ephemeral: nil, stream: nil, poll_seconds: nil, &widget_block)
93
+ {
94
+ typ: :plain_page,
95
+ title: title,
96
+ ephemeral: ephemeral,
97
+ stream: stream,
98
+ poll_seconds: poll_seconds,
99
+ widget: widget_block.yield,
100
+ }.compact
101
+ end
102
+
103
+ # Widgets ###################################################################
104
+
105
+ def back_button(actions:)
106
+ { typ: :back_button, actions: actions }
107
+ end
108
+
109
+ def button(text:, actions:)
110
+ { typ: :button, text: text, actions: actions }
111
+ end
112
+
113
+ def checkbox(text:, var_name:, actions: nil, initial_bool: nil, poll_delay_ms: nil)
114
+ {
115
+ typ: :checkbox,
116
+ actions: actions,
117
+ initial_bool: initial_bool,
118
+ poll_delay_ms: poll_delay_ms,
119
+ text: text,
120
+ var_name: var_name,
121
+ }.compact
122
+ end
123
+
124
+ def column(widgets:, align: nil, spacing: nil)
125
+ { typ: :column, align: align, spacing: spacing, widgets: widgets }.compact
126
+ end
127
+
128
+ def empty
129
+ { typ: :empty }
130
+ end
131
+
132
+ # The client replaces `${INTERACTIVE_ERROR_DETAILS}` with the text of the last error.
133
+ def error_text(text)
134
+ { typ: :error_text, text: text }
135
+ end
136
+
137
+ def form(widgets:)
138
+ { typ: :form, widgets: widgets }
139
+ end
140
+
141
+ def form_button(text:, actions:, align: nil)
142
+ { typ: :form_button, align: align, text: text, actions: actions }.compact
143
+ end
144
+
145
+ def form_section(widgets:, title: nil)
146
+ { typ: :form_section, title: title, widgets: widgets }.compact
147
+ end
148
+
149
+ # `row_groups` is a an array of row groups.
150
+ # Each row group is an array of rows.
151
+ # Each row is an array of widgets.
152
+ def grouped_row_table(row_groups:, spacing: nil)
153
+ { typ: :grouped_row_table, spacing: spacing, row_groups: row_groups }.compact
154
+ end
155
+
156
+ # Pass one of the DISPOSITION_* values for the `disposition` parameter.
157
+ def image(aspect_ratio:, url:, disposition: nil)
158
+ { typ: :image, disposition: disposition, aspect_ratio: aspect_ratio, url: url }.compact
159
+ end
160
+
161
+ def last_error_text
162
+ { typ: :last_error_text }
163
+ end
164
+
165
+ def nav_button(text:, actions:, badge_text: nil, photo_url: nil, sub_text: nil)
166
+ {
167
+ typ: :nav_button,
168
+ badge_text: badge_text,
169
+ photo_url: photo_url,
170
+ sub_text: sub_text,
171
+ text: text,
172
+ actions: actions,
173
+ }.compact
174
+ end
175
+
176
+ def scroll(&widget_block)
177
+ { typ: :scroll, widget: widget_block.yield }
178
+ end
179
+
180
+ # `rows` is a an array of rows.
181
+ # Each row is an array of widgets.
182
+ def table(rows:, spacing: nil)
183
+ { typ: :grouped_row_table, spacing: spacing, row_groups: [rows] }.compact
184
+ end
185
+
186
+ def text(text)
187
+ { typ: :text, text: text }
188
+ end
189
+
190
+ # Pass one of the ALLOW_* values for `allow`.
191
+ # Pass one of the AUTO_CAPITALIZE_* values for `auto_capitalize`.
192
+ def textfield(
193
+ var_name:,
194
+ allow: nil,
195
+ auto_capitalize: nil,
196
+ error: nil,
197
+ initial_string: nil,
198
+ label: nil,
199
+ max_chars: nil,
200
+ max_lines: nil,
201
+ min_chars: nil,
202
+ poll_delay_ms: nil
203
+ )
204
+ {
205
+ typ: :textfield,
206
+ allow: allow,
207
+ auto_capitalize: auto_capitalize,
208
+ error: error,
209
+ initial_string: initial_string,
210
+ label: label,
211
+ max_chars: max_chars,
212
+ max_lines: max_lines,
213
+ min_chars: min_chars,
214
+ poll_delay_ms: poll_delay_ms,
215
+ var_name: var_name,
216
+ }.compact
217
+ end
218
+
219
+ # rubocop:enable Metrics/MethodLength, Metrics/ParameterLists
220
+ end
data/sig/applin/rails.rbs CHANGED
@@ -1,6 +1,5 @@
1
1
  module Applin
2
2
  module Rails
3
- VERSION: String
4
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
3
+ def send_page: (page: page, options: untyped) -> nil
5
4
  end
6
5
  end
data/sig/applin.rbs ADDED
@@ -0,0 +1,122 @@
1
+ # https://github.com/ruby/rbs#guides
2
+
3
+ module Applin
4
+ type alignment = String
5
+
6
+ ALIGN_CENTER: alignment
7
+ ALIGN_END: alignment
8
+ ALIGN_START: alignment
9
+
10
+ type allow = String
11
+
12
+ ALLOW_ALL: allow
13
+ ALLOW_ASCII: allow
14
+ ALLOW_EMAIL: allow
15
+ ALLOW_NUMBERS: allow
16
+ ALLOW_TEL: allow
17
+
18
+ type auto_capitalize = String
19
+
20
+ AUTO_CAPITALIZE_NAMES: auto_capitalize
21
+ AUTO_CAPITALIZE_SENTENCES: auto_capitalize
22
+
23
+ type disposition = String
24
+
25
+ DISPOSITION_COVER: disposition
26
+ DISPOSITION_FIT: disposition
27
+ DISPOSITION_STRETCH: disposition
28
+ VERSION: String
29
+
30
+ type action = String
31
+ type page = { title: String }
32
+ type widget = { typ: String }
33
+
34
+ def back_button: (actions: Array[action]) -> widget
35
+
36
+ def button: (text: String, actions: Array[action]) -> widget
37
+
38
+ def checkbox: (
39
+ text: String,
40
+ var_name: String,
41
+ actions: Array[action]?,
42
+ initial_bool: bool?,
43
+ poll_delay_ms: Numeric?,
44
+ ) -> widget
45
+
46
+ def choose_photo: (upload_url: String) -> action
47
+
48
+ def column: (widgets: Array[widget], align: alignment?, spacing: Numeric?) -> widget
49
+
50
+ def copy_to_clipboard: (String) -> action
51
+
52
+ def empty: -> widget
53
+
54
+ def error_text: (String) -> widget
55
+
56
+ def form: (widgets: Array[widget]) -> widget
57
+
58
+ def form_button: (text: String, actions: Array[action], align: alignment?) -> widget
59
+
60
+ def form_section: (widgets: Array[widget], title: String?) -> widget
61
+
62
+ def grouped_row_table: (row_groups: Array[Array[Array[widget]]], spacing: Numeric?) -> widget
63
+
64
+ def image: (aspect_ratio: Numeric, url: String, disposition: disposition?) -> widget
65
+
66
+ def last_error_text: -> widget
67
+
68
+ def launch_url: (String) -> action
69
+
70
+ def logout: -> action
71
+
72
+ def nav_button: (text: String, actions: Array[action], badge_text: String?, photo_url: String?, sub_text: String?) -> widget
73
+
74
+ def nav_page: (
75
+ title: String,
76
+ start: widget?,
77
+ end_: widget?,
78
+ ephemeral: bool?,
79
+ stream: bool?,
80
+ poll_seconds: Numeric?,
81
+ ) { () -> widget } -> page
82
+
83
+ def on_user_error_poll: -> action
84
+
85
+ def plain_page: (
86
+ title: String?,
87
+ ephemeral: bool?,
88
+ stream: bool?,
89
+ poll_seconds: Numeric?,
90
+ ) { () -> widget } -> page
91
+
92
+ def poll: -> action
93
+
94
+ def pop: -> action
95
+
96
+ def push: (String) -> action
97
+
98
+ def replace_all: (String) -> action
99
+
100
+ def rpc: (String) -> action
101
+
102
+ def scroll: () { () -> widget } -> widget
103
+
104
+ def table: (rows: Array[Array[widget]], spacing: Numeric?) -> widget
105
+
106
+ def take_photo: (upload_url: String) -> action
107
+
108
+ def text: (String) -> widget
109
+
110
+ def textfield: (
111
+ var_name: String,
112
+ allow: allow?,
113
+ auto_capitalize: auto_capitalize?,
114
+ error: String?,
115
+ initial_string: String?,
116
+ label: String?,
117
+ max_chars: Numeric?,
118
+ max_lines: Numeric?,
119
+ min_chars: Numeric?,
120
+ poll_delay_ms: Numeric?
121
+ ) -> widget
122
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: applin-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Leonhard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-11 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Create mobile apps using only backend code. Applin™ is a Server-Driven
14
14
  UI (SDUI) system.
@@ -23,8 +23,11 @@ files:
23
23
  - LICENSE.md
24
24
  - README.md
25
25
  - Rakefile
26
+ - cla-email-template.txt
27
+ - lib/applin.rb
26
28
  - lib/applin/rails.rb
27
29
  - lib/applin/rails/version.rb
30
+ - sig/applin.rbs
28
31
  - sig/applin/rails.rbs
29
32
  homepage: https://www.applin.dev/
30
33
  licenses: