switchboard-contract 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,38 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol ProviderOffer {
4
+ import protocol "../compiled/package.avpr";
5
+
6
+ /** The main class for this protocol */
7
+ record ProviderOffer {
8
+ /** The primary key */
9
+ int id;
10
+ int state_id;
11
+ int lawyer_id;
12
+ int provider_id;
13
+ int offer_id;
14
+ int consumer_fee_in_cents;
15
+ boolean available;
16
+ Package package;
17
+ }
18
+
19
+ record ProviderOfferFetchOption {
20
+ /** Which page of records to fetch */
21
+ int page = 1;
22
+
23
+ /** How many records per page */
24
+ int per_page = 10;
25
+
26
+ int provider_id;
27
+ int offer_id;
28
+ int state_id;
29
+ int specialty_id;
30
+ boolean available;
31
+ }
32
+
33
+ /** Returns a list of ProviderOffers */
34
+ array<ProviderOffer> index(ProviderOfferFetchOption options);
35
+
36
+ /** Return a single ProviderOffer */
37
+ array<ProviderOffer> show(int id);
38
+ }
@@ -0,0 +1,33 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol Specialty {
4
+
5
+ record SpecialtyCompact{
6
+ /** The primary key */
7
+ int id;
8
+
9
+ /** Name of the specialty */
10
+ string name;
11
+ }
12
+
13
+ /** The main class for this protocol */
14
+ record Specialty {
15
+ /** The primary key */
16
+ int id;
17
+
18
+ /** Name of the specialty */
19
+ string name;
20
+
21
+ /** Url to the icon representing this specialty */
22
+ string image_url;
23
+
24
+ array<SpecialtyCompact> ancestors;
25
+ }
26
+
27
+ /** Look up many specialties in bulk */
28
+ array<Specialty> index();
29
+
30
+ /** Look up a specialty by id */
31
+ array<Specialty> show(int id);
32
+
33
+ }
@@ -0,0 +1,12 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol User {
4
+
5
+ import idl "common.inc";
6
+
7
+ /** Look up many Users in bulk */
8
+ array<User> index();
9
+
10
+ /** Look up a single User by id */
11
+ array<User> show(int id);
12
+ }
@@ -0,0 +1,57 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol UserAuthentication {
4
+
5
+ /** The main User class */
6
+ record UserAuthenticationUser {
7
+ /** The primary key */
8
+ int id;
9
+
10
+ /** Their name */
11
+ string name;
12
+
13
+ /** The email address of the user */
14
+ string email_address;
15
+
16
+ /** An array of the names of all permissions the user has */
17
+ array<string> permissions;
18
+
19
+ /** The id of the lawyer this user has claimed, if any */
20
+ union {null, int} lawyer_id;
21
+ }
22
+
23
+ record UserAuthentication {
24
+ /** The authorized user */
25
+ UserAuthenticationUser user;
26
+
27
+ /** An OAuth2 access token the client can use on this user's behalf */
28
+ string access_token;
29
+ }
30
+
31
+ /** When registering a user, provide these options */
32
+ record UserRegistrationParams {
33
+ /** User's email address */
34
+ string email_address;
35
+
36
+ /** User's new password */
37
+ string password;
38
+
39
+ /** User's display name name */
40
+ union{string, null} name;
41
+ }
42
+
43
+ /** All the allowed different social networks that we can auth via */
44
+ enum SocialNetwork {
45
+ FACEBOOK, GOOGLE, TWITTER, LINKEDIN
46
+ }
47
+
48
+ /** POST: Register a user by email_address and password */
49
+ array<UserAuthentication> register(UserRegistrationParams user);
50
+
51
+ /** POST: Authenticate a user via email_address and password */
52
+ array<UserAuthentication> authenticate(string email_address, string password);
53
+
54
+ /** POST: Login or register via a social network */
55
+ array<UserAuthentication> find_or_create_via_social(SocialNetwork social_network, string access_token, union{null, string} secret);
56
+
57
+ }
@@ -0,0 +1,127 @@
1
+ {
2
+ "protocol" : "Lawyer",
3
+ "namespace" : "Switchboard",
4
+ "types" : [ {
5
+ "type" : "record",
6
+ "name" : "LawyerSpecialty",
7
+ "fields" : [ {
8
+ "name" : "name",
9
+ "type" : "string"
10
+ }, {
11
+ "name" : "percent",
12
+ "type" : "int"
13
+ } ]
14
+ }, {
15
+ "type" : "record",
16
+ "name" : "BrowseLink",
17
+ "fields" : [ {
18
+ "name" : "type",
19
+ "type" : "string",
20
+ "doc" : "type of url: profile, contact *"
21
+ }, {
22
+ "name" : "url",
23
+ "type" : "string",
24
+ "doc" : "actual url *"
25
+ } ]
26
+ }, {
27
+ "type" : "record",
28
+ "name" : "Lawyer",
29
+ "doc" : "The main class for this protocol",
30
+ "fields" : [ {
31
+ "name" : "id",
32
+ "type" : "int",
33
+ "doc" : "The primary key"
34
+ }, {
35
+ "name" : "firstname",
36
+ "type" : "string",
37
+ "doc" : "name"
38
+ }, {
39
+ "name" : "middlename",
40
+ "type" : "string"
41
+ }, {
42
+ "name" : "lastname",
43
+ "type" : "string"
44
+ }, {
45
+ "name" : "suffix",
46
+ "type" : "string"
47
+ }, {
48
+ "name" : "aliases",
49
+ "type" : {
50
+ "type" : "array",
51
+ "items" : "string"
52
+ },
53
+ "doc" : "Lawyer's alternative names *"
54
+ }, {
55
+ "name" : "avvo_pro",
56
+ "type" : "boolean",
57
+ "doc" : "whether the lawyer is Avvo Pro *"
58
+ }, {
59
+ "name" : "avvo_rating",
60
+ "type" : "float",
61
+ "doc" : "Avvo Rating (Scale of 1-10)"
62
+ }, {
63
+ "name" : "client_review_count",
64
+ "type" : "int",
65
+ "doc" : "Number of reviews the average is based upon"
66
+ }, {
67
+ "name" : "client_review_score",
68
+ "type" : "float",
69
+ "doc" : "Average client review score (Scale of 1-5)"
70
+ }, {
71
+ "name" : "headshot_url",
72
+ "type" : "string",
73
+ "doc" : "Url to their full-size headshot photo"
74
+ }, {
75
+ "name" : "licensed_since",
76
+ "type" : "int",
77
+ "doc" : "year licensed since *"
78
+ }, {
79
+ "name" : "browse_links",
80
+ "type" : {
81
+ "type" : "array",
82
+ "items" : "BrowseLink"
83
+ },
84
+ "doc" : "Avvo browsing links *"
85
+ }, {
86
+ "name" : "bio",
87
+ "type" : "string",
88
+ "doc" : "Lawyer's bio *"
89
+ }, {
90
+ "name" : "lawyer_specialties",
91
+ "type" : {
92
+ "type" : "array",
93
+ "items" : "LawyerSpecialty"
94
+ },
95
+ "doc" : "List of specialties this lawyer practices"
96
+ } ]
97
+ } ],
98
+ "messages" : {
99
+ "index" : {
100
+ "doc" : "Look up many lawyers in bulk",
101
+ "request" : [ ],
102
+ "response" : {
103
+ "type" : "array",
104
+ "items" : "Lawyer"
105
+ }
106
+ },
107
+ "show" : {
108
+ "doc" : "Look up a single lawyer by id",
109
+ "request" : [ {
110
+ "name" : "id",
111
+ "type" : "int"
112
+ } ],
113
+ "response" : {
114
+ "type" : "array",
115
+ "items" : "Lawyer"
116
+ }
117
+ },
118
+ "search" : {
119
+ "doc" : "Look up many lawyers in bulk",
120
+ "request" : [ ],
121
+ "response" : {
122
+ "type" : "array",
123
+ "items" : "Lawyer"
124
+ }
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "protocol" : "LawyerAddress",
3
+ "namespace" : "Switchboard",
4
+ "types" : [ {
5
+ "type" : "record",
6
+ "name" : "LawyerAddress",
7
+ "doc" : "The main class for this protocol",
8
+ "fields" : [ {
9
+ "name" : "id",
10
+ "type" : "int",
11
+ "doc" : "The LawyerAddress's id"
12
+ }, {
13
+ "name" : "lawyer_id",
14
+ "type" : "int",
15
+ "doc" : "The lawyer's id"
16
+ }, {
17
+ "name" : "line1",
18
+ "type" : "string",
19
+ "doc" : "The first line of the address"
20
+ }, {
21
+ "name" : "line2",
22
+ "type" : "string",
23
+ "doc" : "The second line of the address"
24
+ }, {
25
+ "name" : "city",
26
+ "type" : "string",
27
+ "doc" : "The city of the address"
28
+ }, {
29
+ "name" : "state_code",
30
+ "type" : "string",
31
+ "doc" : "The state abbreviation of the address"
32
+ }, {
33
+ "name" : "postal_code",
34
+ "type" : "string",
35
+ "doc" : "The postal code of the address"
36
+ } ]
37
+ } ],
38
+ "messages" : {
39
+ "index" : {
40
+ "doc" : "Look up many adddresses in bulk",
41
+ "request" : [ {
42
+ "name" : "lawyer_id",
43
+ "type" : "int"
44
+ }, {
45
+ "name" : "lawyer_ids",
46
+ "type" : "string"
47
+ } ],
48
+ "response" : {
49
+ "type" : "array",
50
+ "items" : "LawyerAddress"
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "protocol" : "Review",
3
+ "namespace" : "Switchboard",
4
+ "types" : [ {
5
+ "type" : "record",
6
+ "name" : "Review",
7
+ "doc" : "The main class for this protocol",
8
+ "fields" : [ {
9
+ "name" : "id",
10
+ "type" : "int",
11
+ "doc" : "The reviews's id"
12
+ }, {
13
+ "name" : "lawyer_id",
14
+ "type" : "int",
15
+ "doc" : "The lawyer's id"
16
+ }, {
17
+ "name" : "rating",
18
+ "type" : "int",
19
+ "doc" : "Overall rating *"
20
+ }, {
21
+ "name" : "title",
22
+ "type" : "string",
23
+ "doc" : "Title of the Review"
24
+ }, {
25
+ "name" : "body",
26
+ "type" : "string",
27
+ "doc" : "The body text of the review"
28
+ }, {
29
+ "name" : "created_at",
30
+ "type" : "int",
31
+ "doc" : "The integer timestamp of when the review was created"
32
+ } ]
33
+ } ],
34
+ "messages" : {
35
+ "index" : {
36
+ "doc" : "Look up many reviews in bulk",
37
+ "request" : [ ],
38
+ "response" : {
39
+ "type" : "array",
40
+ "items" : "Review"
41
+ }
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,43 @@
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" : "description",
18
+ "type" : "string",
19
+ "doc" : "Url to the icon representing this specialty"
20
+ } ]
21
+ } ],
22
+ "messages" : {
23
+ "index" : {
24
+ "doc" : "Look up many specialties in bulk",
25
+ "request" : [ ],
26
+ "response" : {
27
+ "type" : "array",
28
+ "items" : "Specialty"
29
+ }
30
+ },
31
+ "show" : {
32
+ "doc" : "Look up a specialty by id",
33
+ "request" : [ {
34
+ "name" : "id",
35
+ "type" : "int"
36
+ } ],
37
+ "response" : {
38
+ "type" : "array",
39
+ "items" : "Specialty"
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,69 @@
1
+ @namespace("Switchboard")
2
+
3
+ protocol Lawyer {
4
+
5
+ record LawyerSpecialty {
6
+ string name;
7
+ int percent;
8
+ }
9
+
10
+ record BrowseLink {
11
+ /** type of url: profile, contact **/
12
+ string type;
13
+ /** actual url **/
14
+ string url;
15
+ }
16
+
17
+ /** The main class for this protocol */
18
+ record Lawyer {
19
+ /** The primary key */
20
+ int id;
21
+
22
+ /** name */
23
+ string firstname;
24
+ string middlename;
25
+ string lastname;
26
+ string suffix;
27
+
28
+ /** Lawyer's alternative names **/
29
+ array<string> aliases;
30
+
31
+ /** whether the lawyer is Avvo Pro **/
32
+ boolean avvo_pro;
33
+
34
+ /** Avvo Rating (Scale of 1-10) */
35
+ float avvo_rating;
36
+
37
+ /** Number of reviews the average is based upon */
38
+ int client_review_count;
39
+
40
+ /** Average client review score (Scale of 1-5) */
41
+ float client_review_score;
42
+
43
+ /** Url to their full-size headshot photo */
44
+ string headshot_url;
45
+
46
+ /** year licensed since **/
47
+ int licensed_since;
48
+
49
+ /** Avvo browsing links **/
50
+ array<BrowseLink> browse_links;
51
+
52
+ /** Lawyer's bio **/
53
+ string bio;
54
+
55
+
56
+ /** List of specialties this lawyer practices */
57
+ array<LawyerSpecialty> lawyer_specialties;
58
+
59
+ }
60
+
61
+ /** Look up many lawyers in bulk */
62
+ array<Lawyer> index();
63
+
64
+ /** Look up a single lawyer by id */
65
+ array<Lawyer> show(int id);
66
+
67
+ /** Look up many lawyers in bulk */
68
+ array<Lawyer> search();
69
+ }