switchboard-contract 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +31 -0
  4. data/Rakefile +3 -0
  5. data/contracts/3/compiled/advice_session.avpr +190 -0
  6. data/contracts/3/compiled/advice_session_image.avpr +36 -0
  7. data/contracts/3/compiled/advice_session_review.avpr +90 -0
  8. data/contracts/3/compiled/advisor.avpr +77 -0
  9. data/contracts/3/compiled/advisor_config.avpr +38 -0
  10. data/contracts/3/compiled/lawyer.avpr +83 -0
  11. data/contracts/3/compiled/location.avpr +128 -0
  12. data/contracts/3/compiled/offer.avpr +111 -0
  13. data/contracts/3/compiled/package.avpr +85 -0
  14. data/contracts/3/compiled/package_detail.avpr +100 -0
  15. data/contracts/3/compiled/provider_offer.avpr +144 -0
  16. data/contracts/3/compiled/specialty.avpr +61 -0
  17. data/contracts/3/compiled/user.avpr +50 -0
  18. data/contracts/3/compiled/user_authentication.avpr +111 -0
  19. data/contracts/3/source/advice_session.avdl +72 -0
  20. data/contracts/3/source/advice_session_image.avdl +16 -0
  21. data/contracts/3/source/advice_session_review.avdl +40 -0
  22. data/contracts/3/source/advisor.avdl +30 -0
  23. data/contracts/3/source/advisor_config.avdl +17 -0
  24. data/contracts/3/source/common.inc +20 -0
  25. data/contracts/3/source/lawyer.avdl +45 -0
  26. data/contracts/3/source/location.avdl +76 -0
  27. data/contracts/3/source/offer.avdl +51 -0
  28. data/contracts/3/source/package.avdl +36 -0
  29. data/contracts/3/source/package_detail.avdl +41 -0
  30. data/contracts/3/source/provider_offer.avdl +38 -0
  31. data/contracts/3/source/specialty.avdl +33 -0
  32. data/contracts/3/source/user.avdl +12 -0
  33. data/contracts/3/source/user_authentication.avdl +57 -0
  34. data/contracts/4/compiled/lawyer.avpr +127 -0
  35. data/contracts/4/compiled/lawyer_address.avpr +54 -0
  36. data/contracts/4/compiled/review.avpr +44 -0
  37. data/contracts/4/compiled/specialty.avpr +43 -0
  38. data/contracts/4/source/lawyer.avdl +69 -0
  39. data/contracts/4/source/lawyer_address.avdl +31 -0
  40. data/contracts/4/source/review.avdl +28 -0
  41. data/contracts/4/source/specialty.avdl +23 -0
  42. data/contracts/messaging/compiled/access_token.avpr +41 -0
  43. data/contracts/messaging/compiled/channel.avpr +111 -0
  44. data/contracts/messaging/source/access_token.avdl +21 -0
  45. data/contracts/messaging/source/channel.avdl +59 -0
  46. data/contracts/mobile/compiled/advice_session.avpr +160 -0
  47. data/contracts/mobile/compiled/checkout.avpr +115 -0
  48. data/contracts/mobile/compiled/lawyer.avpr +787 -0
  49. data/contracts/mobile/compiled/offer.avpr +111 -0
  50. data/contracts/mobile/compiled/package.avpr +85 -0
  51. data/contracts/mobile/compiled/package_detail.avpr +100 -0
  52. data/contracts/mobile/compiled/package_slug.avpr +67 -0
  53. data/contracts/mobile/compiled/promotion.avpr +45 -0
  54. data/contracts/mobile/compiled/provider_offer.avpr +144 -0
  55. data/contracts/mobile/compiled/review.avpr +83 -0
  56. data/contracts/mobile/compiled/specialty.avpr +55 -0
  57. data/contracts/mobile/source/advice_session.avdl +61 -0
  58. data/contracts/mobile/source/checkout.avdl +90 -0
  59. data/contracts/mobile/source/lawyer.avdl +321 -0
  60. data/contracts/mobile/source/offer.avdl +51 -0
  61. data/contracts/mobile/source/package.avdl +36 -0
  62. data/contracts/mobile/source/package_detail.avdl +41 -0
  63. data/contracts/mobile/source/package_slug.avdl +30 -0
  64. data/contracts/mobile/source/promotion.avdl +18 -0
  65. data/contracts/mobile/source/provider_offer.avdl +38 -0
  66. data/contracts/mobile/source/review.avdl +43 -0
  67. data/contracts/mobile/source/specialty.avdl +32 -0
  68. data/contracts/sales_force/compiled/account.avpr +94 -0
  69. data/contracts/sales_force/compiled/account_professional.avpr +39 -0
  70. data/contracts/sales_force/source/account.avdl +50 -0
  71. data/contracts/sales_force/source/account_professional.avdl +14 -0
  72. data/contracts/verify/compiled/lawyer.avpr +79 -0
  73. data/contracts/verify/compiled/license.avpr +64 -0
  74. data/contracts/verify/source/lawyer.avdl +41 -0
  75. data/contracts/verify/source/license.avdl +36 -0
  76. data/lib/switchboard/contract.rb +8 -0
  77. data/lib/switchboard/contract/documentation.rb +7 -0
  78. data/lib/switchboard/contract/service.rb +15 -0
  79. data/lib/switchboard/contract/version.rb +5 -0
  80. metadata +164 -0
@@ -0,0 +1,83 @@
1
+ {
2
+ "protocol" : "Review",
3
+ "namespace" : "Switchboard",
4
+ "types" : [ {
5
+ "type" : "record",
6
+ "name" : "ReviewRatings",
7
+ "doc" : "Each individual rating type",
8
+ "fields" : [ {
9
+ "name" : "overall",
10
+ "type" : "int"
11
+ }, {
12
+ "name" : "trustworthy",
13
+ "type" : "int"
14
+ }, {
15
+ "name" : "responsive",
16
+ "type" : "int"
17
+ }, {
18
+ "name" : "knowledgeable",
19
+ "type" : "int"
20
+ }, {
21
+ "name" : "communication",
22
+ "type" : "int"
23
+ } ]
24
+ }, {
25
+ "type" : "record",
26
+ "name" : "Review",
27
+ "doc" : "The main class for this protocol",
28
+ "fields" : [ {
29
+ "name" : "id",
30
+ "type" : "int",
31
+ "doc" : "The primary key"
32
+ }, {
33
+ "name" : "lawyer_id",
34
+ "type" : "int",
35
+ "doc" : "The lawyer's id"
36
+ }, {
37
+ "name" : "title",
38
+ "type" : "string",
39
+ "doc" : "Title of the Review"
40
+ }, {
41
+ "name" : "body",
42
+ "type" : "string",
43
+ "doc" : "The body text of the review"
44
+ }, {
45
+ "name" : "recommended",
46
+ "type" : "boolean"
47
+ }, {
48
+ "name" : "specialty_id",
49
+ "type" : "int"
50
+ }, {
51
+ "name" : "anonymous",
52
+ "type" : "boolean"
53
+ }, {
54
+ "name" : "approval_status",
55
+ "type" : "int"
56
+ }, {
57
+ "name" : "display_name",
58
+ "type" : "string"
59
+ }, {
60
+ "name" : "created_at",
61
+ "type" : "int"
62
+ }, {
63
+ "name" : "updated_at",
64
+ "type" : "int"
65
+ }, {
66
+ "name" : "cache_key",
67
+ "type" : "string"
68
+ }, {
69
+ "name" : "ratings",
70
+ "type" : "ReviewRatings"
71
+ } ]
72
+ } ],
73
+ "messages" : {
74
+ "index" : {
75
+ "doc" : "Look up many reviews in bulk",
76
+ "request" : [ ],
77
+ "response" : {
78
+ "type" : "array",
79
+ "items" : "Review"
80
+ }
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "protocol" : "Specialty",
3
+ "namespace" : "Switchboard",
4
+ "types" : [ {
5
+ "type" : "record",
6
+ "name" : "Specialty",
7
+ "doc" : "The main class for this protocol",
8
+ "fields" : [ {
9
+ "name" : "id",
10
+ "type" : "int",
11
+ "doc" : "The primary key"
12
+ }, {
13
+ "name" : "name",
14
+ "type" : "string",
15
+ "doc" : "Name of the specialty"
16
+ }, {
17
+ "name" : "seo_name",
18
+ "type" : "string",
19
+ "doc" : "Pretty name for SEO"
20
+ }, {
21
+ "name" : "title",
22
+ "type" : "string",
23
+ "doc" : "What you would call an attorny practicing in this area (i.e. Bankruptcy Attorney)"
24
+ }, {
25
+ "name" : "description",
26
+ "type" : "string",
27
+ "doc" : "Blurb about what this specialty is about"
28
+ }, {
29
+ "name" : "slug",
30
+ "type" : "string",
31
+ "doc" : "Pretty slug for use in the URLs"
32
+ } ]
33
+ } ],
34
+ "messages" : {
35
+ "index" : {
36
+ "doc" : "Look up many specialties in bulk",
37
+ "request" : [ ],
38
+ "response" : {
39
+ "type" : "array",
40
+ "items" : "Specialty"
41
+ }
42
+ },
43
+ "show" : {
44
+ "doc" : "Look up a specialty by id",
45
+ "request" : [ {
46
+ "name" : "id",
47
+ "type" : "int"
48
+ } ],
49
+ "response" : {
50
+ "type" : "array",
51
+ "items" : "Specialty"
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,61 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol AdviceSession {
4
+ /** The main class for this protocol */
5
+ record AdviceSession {
6
+ /** The primary key */
7
+ int id;
8
+ int specialty_id;
9
+ int advisor_id;
10
+ int review_id;
11
+ boolean chose_advisor;
12
+
13
+ string state;
14
+ boolean called;
15
+ union {null, string} advice_session_image_token = null;
16
+ array<string> advice_session_image_tokens;
17
+ }
18
+
19
+ /** Options you can send for limiting AdviceSession results */
20
+ record AdviceSessionFetchOption {
21
+ /** Which page of records to fetch */
22
+ int page = 1;
23
+
24
+ /** How many records per page */
25
+ int per_page = 30;
26
+ }
27
+
28
+ /** Params to create a new AdviceSession */
29
+ record AdviceSessionCreateParams {
30
+ int specialty_id;
31
+ int advisor_id;
32
+
33
+ string state;
34
+ string client_name;
35
+ string client_email_address;
36
+ string client_phone_number;
37
+ union {null, string} payment_gateway = null;
38
+ string card_href;
39
+ string name_on_card;
40
+ union {null, string} advice_session_image_token = null;
41
+ array<string> advice_session_image_tokens;
42
+ union {null, string} promo_code = null;
43
+ }
44
+
45
+ record AdviceSessionPromoCode {
46
+ int promo_discount_amount_in_cents;
47
+ int promo_advice_session_price_in_cents;
48
+ }
49
+
50
+ /** Returns a list of AdviceSession */
51
+ array<AdviceSession> index(AdviceSessionFetchOption options);
52
+
53
+ /** Return a single AdviceSession */
54
+ array<AdviceSession> show(int id);
55
+
56
+ /** Create a new AdviceSession */
57
+ array<AdviceSession> create(AdviceSessionCreateParams advice_session);
58
+
59
+ /** Apply an Advice Session Promo Code */
60
+ array<AdviceSessionPromoCode> find_promo_code(string promo_code);
61
+ }
@@ -0,0 +1,90 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol Checkout {
4
+ /** The main class for this protocol */
5
+ record Checkout {
6
+ /* the ID */
7
+ int id;
8
+
9
+ /* The ID of the associated specialty */
10
+ int specialty_id;
11
+
12
+ /* The ID of the associated advisor */
13
+ int advisor_id;
14
+
15
+ /* The ID of the associated review */
16
+ int review_id;
17
+
18
+ /* The state */
19
+ string state;
20
+
21
+ /* Flag showing if the user was called or not */
22
+ boolean called;
23
+
24
+ /* The token used to access the assocaited image */
25
+ union {null, string} advice_session_image_token = null;
26
+
27
+ /* Flag showing if the user chose the attorney or not */
28
+ boolean chose_advisor;
29
+ }
30
+
31
+ /** Params to create AdviceSessionImages when the file is already on S3 */
32
+ record ImageParams {
33
+ /* The token for the image on S3 */
34
+ string token;
35
+
36
+ /* The file name of the image */
37
+ string filename;
38
+ }
39
+
40
+ /** Params to create a new Checkout */
41
+ record CheckoutCreateParams {
42
+ /* The ID of the associated Provider */
43
+ int provider_id;
44
+
45
+ /* The ID of the associated Offer */
46
+ int offer_id;
47
+
48
+ /* The ID of the associated Specialty */
49
+ int specialty_id;
50
+
51
+ /* The ID of the associated State */
52
+ int state_id;
53
+
54
+ /* The gateway service that the payment was processed by */
55
+ union {null, string} payment_gateway = null;
56
+
57
+ /* The ID of the associated credit card */
58
+ string card_id;
59
+
60
+ /* The name of the client */
61
+ string client_name;
62
+
63
+ /* The name of the card */
64
+ string card_name;
65
+
66
+ /* The users email address */
67
+ string email_address;
68
+
69
+ /* The users phone number */
70
+ string phone_number;
71
+
72
+ /* The s3 token for the associated uploaded image */
73
+ union {null, string} uploaded_image_token = null;
74
+
75
+ /* The code for the assocaited Promotion */
76
+ union {null, string} promo_code = null;
77
+
78
+ /* The source of the checkout */
79
+ string source;
80
+
81
+ /* The remote IP of the user */
82
+ string remote_ip;
83
+
84
+ /* The uploaded images */
85
+ array<ImageParams> uploaded_images;
86
+ }
87
+
88
+ /** Create a new Checkout */
89
+ array<Checkout> create(CheckoutCreateParams checkout);
90
+ }
@@ -0,0 +1,321 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol Lawyer {
4
+
5
+ record Phone {
6
+ string area_code;
7
+ string local_number;
8
+ string type;
9
+ }
10
+ record Address {
11
+ int id;
12
+ int lawyer_id;
13
+ string address_line1;
14
+ string address_line2;
15
+ string city;
16
+ string state;
17
+ string postal_code;
18
+ string standardized_address;
19
+ int location_id;
20
+ float latitude;
21
+ float longitude;
22
+ array<Phone> phones;
23
+ string firm_name;
24
+
25
+ }
26
+
27
+ record License {
28
+ int id;
29
+ string state;
30
+ string status;
31
+ string status_type;
32
+ int license_date;
33
+ int licensing_authority_id;
34
+ int last_updated;
35
+
36
+ }
37
+
38
+ record Sanction {
39
+ int id;
40
+ int lawyer_id;
41
+ int license_id;
42
+ string state;
43
+ string name;
44
+ string type;
45
+ int sanction_date;
46
+ int updated_at;
47
+ string description;
48
+ string interpretation;
49
+ string comment;
50
+ }
51
+
52
+ record Fee {
53
+ string name;
54
+ string symbolic_name;
55
+ int min_rate;
56
+ int max_rate;
57
+ }
58
+
59
+ record AdditionalProfileLink {
60
+ int id;
61
+ string url;
62
+ string title;
63
+ string social_network;
64
+ string rss;
65
+ boolean rssable;
66
+ int updated_at;
67
+ }
68
+
69
+ record Media {
70
+ int id;
71
+ string path;
72
+ int mime_type_id;
73
+ string external_url;
74
+ string caption;
75
+ string copyright;
76
+ boolean is_video;
77
+ }
78
+
79
+ record Personal {
80
+ array<string> aliases;
81
+ string bio;
82
+ array<string> languages;
83
+ array<string> payment_types;
84
+ string fixed_acceptance_type;
85
+ string retainer_acceptance_type;
86
+ int probono_contribution;
87
+ int free_consultation;
88
+ string cache_key;
89
+ array<Fee> fees;
90
+ array<Media> media_thumbnails;
91
+ array<AdditionalProfileLink> social_networks;
92
+ }
93
+ record Status {
94
+ boolean deceased;
95
+ boolean judge;
96
+ boolean retired;
97
+ boolean official;
98
+ boolean unverified;
99
+ boolean displayable;
100
+ boolean sanctioned;
101
+ boolean rateable;
102
+ }
103
+ record Rating {
104
+ int overall;
105
+ int trustworthy;
106
+ int responsive;
107
+ int knowledgeable;
108
+ int communication;
109
+
110
+ }
111
+ record Review {
112
+ int id;
113
+ int lawyer_id;
114
+ string title;
115
+ string body;
116
+ boolean recommended;
117
+ int specialty_id;
118
+ boolean anonymous;
119
+ int approval_status;
120
+ string display_name;
121
+ int created_at;
122
+ int updated_at;
123
+ string cache_key;
124
+ Rating ratings;
125
+ }
126
+ record LawyerSpecialty {
127
+ int id;
128
+ string name;
129
+ int specialty_id;
130
+ int percent;
131
+ int start_date;
132
+ string description;
133
+ int cases;
134
+ }
135
+
136
+ /** The main class for this protocol */
137
+ record Lawyer {
138
+ /** The primary key */
139
+ int id;
140
+
141
+ /** Their name */
142
+ string firstname;
143
+ string middlename;
144
+ string lastname;
145
+ string suffix;
146
+ string email_address;
147
+ int licensed_since;
148
+ string website;
149
+ int advisor_id;
150
+ boolean advisor_available;
151
+ array<int> sanction_ids;
152
+ array<License> licenses;
153
+ Status status;
154
+ array<Address> addresses;
155
+ array<Review> reviews;
156
+ array<LawyerSpecialty> lawyer_specialties;
157
+ Personal personal;
158
+ array<Sanction> sanctions;
159
+
160
+ /** id of claiming user **/
161
+ int claimed_by;
162
+
163
+ /** Url to their full-size headshot photo */
164
+ string headshot_url;
165
+
166
+ /** Avvo Rating (Scale of 1-10) */
167
+ float avvo_rating;
168
+ boolean avvo_pro;
169
+
170
+ /** Average client review score (Scale of 1-5) */
171
+ float aggregate_client_review_score;
172
+
173
+ /** Number of reviews the average is based upon */
174
+ int client_review_count;
175
+
176
+ /** List of specialties this lawyer practices */
177
+ array<int> specialty_ids;
178
+ }
179
+
180
+ /** The lawyer result when performing a search */
181
+ record SearchLawyer {
182
+ /** The primary key */
183
+ int id;
184
+
185
+ /** Their name */
186
+ string firstname;
187
+ string middlename;
188
+ string lastname;
189
+ string suffix;
190
+ string email_address;
191
+ int licensed_since;
192
+ int advisor_id;
193
+ boolean advisor_available;
194
+ array<Address> addresses;
195
+
196
+ /** id of claiming user **/
197
+ int claimed_by;
198
+
199
+ /** Url to their full-size headshot photo */
200
+ string headshot_url;
201
+
202
+ /** Avvo Rating (Scale of 1-10) */
203
+ float avvo_rating;
204
+ boolean avvo_pro;
205
+
206
+ /** Average client review score (Scale of 1-5) */
207
+ float aggregate_client_review_score;
208
+
209
+ /** Number of reviews the average is based upon */
210
+ int client_review_count;
211
+
212
+ /** List of specialties this lawyer practices */
213
+ array<int> specialty_ids;
214
+ }
215
+
216
+ record SearchParams{
217
+
218
+ /** location **/
219
+
220
+ /** takes a string that will be then processed through Gnomon **/
221
+ string loc;
222
+
223
+ /** latitude **/
224
+ float lat;
225
+ /** longitude **/
226
+ float Long;
227
+ /** radius **/
228
+ float radius;
229
+
230
+ /** this is the query interface. "divorce" or "Mark Britton" go here **/
231
+ string q;
232
+
233
+ /** this is to force what kind of search you want. The options are "specialty"(this is what we default to), "location", and "name" **/
234
+ string type;
235
+
236
+ /** filters **/
237
+
238
+ /** takes a language string, such as "English". With the new UI, the requirement is to only filter by one language at a time **/
239
+ string language;
240
+ boolean has_reviews;
241
+ boolean has_endorsements;
242
+ boolean free_consultation;
243
+ /** takes an expertise name string **/
244
+ string expertise;
245
+ /** can take a single value, or an array of `[min, max]` where max & min are 0-5 in 0.5 increments. (Test note, the format in the URL for this is client_ratings[] =min&client_ratings[]=max) **/
246
+ array<int> client_ratings;
247
+ /** single year value or an array of `[start, end]`. has to be a year. **/
248
+ array<int> licensed_since;
249
+
250
+ /** ordering **/
251
+
252
+ /** order by avvo rating. takes "asc" or "desc" **/
253
+ string avvo_rating;
254
+ /** order by client review rating. takes "asc" or "desc" **/
255
+ string client_rating;
256
+ /** order by number of client reviews. takes "asc" or "desc" **/
257
+ string number_of_reviews;
258
+
259
+ /** pagination **/
260
+
261
+ /** page of results **/
262
+ int page;
263
+ /** results per page **/
264
+ int per_page;
265
+ }
266
+
267
+ record SearchFilters {
268
+ array<string> language;
269
+ array<boolean> has_reviews;
270
+ array<boolean> has_endorsements;
271
+ array<boolean> free_consultation;
272
+ array<string> expertise;
273
+ array<float> client_reviews;
274
+ }
275
+
276
+ record SearchLocation {
277
+ int location_id;
278
+ float lat;
279
+ float Long;
280
+ string type;
281
+ array<int> surrounding_location_ids;
282
+ }
283
+
284
+ record SearchStats {
285
+ int review_count;
286
+ float average_review_rating;
287
+ }
288
+
289
+ record SearchContext {
290
+ string search;
291
+ int specialty;
292
+ boolean name_suggestion;
293
+ SearchFilters filters;
294
+ SearchLocation location;
295
+ SearchStats stats;
296
+ array<int> pls_lawyer_ids;
297
+ }
298
+
299
+ record SearchMetadata {
300
+ SearchContext context;
301
+ int status;
302
+ int current_page;
303
+ int per_page;
304
+ int total_pages;
305
+ int total_entries;
306
+ }
307
+
308
+ record SearchResult {
309
+ array<SearchLawyer> lawyers;
310
+ SearchMetadata meta;
311
+ }
312
+
313
+ /** Look up many lawyers in bulk */
314
+ array<Lawyer> index();
315
+
316
+ /** Look up a single lawyer by id */
317
+ array<Lawyer> show(int id);
318
+
319
+ /** Look up a single lawyer by id */
320
+ SearchResult search(SearchParams params);
321
+ }