replicatedvendor 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/api/apimodule.rb +2 -0
- data/lib/{apiuri.rb → api/apiuri.rb} +2 -6
- data/lib/api/app/app.rb +35 -33
- data/lib/api/apps/apps.rb +15 -19
- data/lib/api/auditlog/auditlog.rb +5 -3
- data/lib/api/auth/auth.rb +29 -0
- data/lib/api/channel/channel.rb +36 -0
- data/lib/api/license/license.rb +136 -0
- data/lib/api/release/release.rb +50 -0
- data/lib/api/releases/releases.rb +15 -0
- data/lib/api/team/team.rb +12 -0
- data/lib/api.rb +9 -13
- data/lib/client/client.rb +12 -18
- data/replicatedvendor.gemspec +1 -1
- metadata +3 -4
- data/lib/util/assert.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dcdb64816845eb9c4221f623e0f70ea6a362612e
|
|
4
|
+
data.tar.gz: 33451e97fdd9e4985da9e2ceaedf5b19f9ea83d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f401e421a07ca78b47d2bc82ec48f4bf87796704270c39066181fb6327bbb8fce0f485138d987e132f972a119fe8395dd08d8be954a01c6d85a65e1828afa138
|
|
7
|
+
data.tar.gz: 53c691bdca6f3f51c4d874c32753f8a321a47dd466eae4720706a255567b35f0d082705f33d24856a8822b43e0996aefddbbf4133d3d16a1076667fb56a79536
|
data/lib/api/apimodule.rb
CHANGED
|
@@ -4,15 +4,11 @@ class ApiUri
|
|
|
4
4
|
VENDOR_HOST = "api.replicated.com"
|
|
5
5
|
VENDOR_BASE_PATH = "/vendor/v1"
|
|
6
6
|
|
|
7
|
-
def self.build_uri(
|
|
7
|
+
def self.build_uri(endpoint, params = nil)
|
|
8
8
|
uri_base = "https://" << VENDOR_HOST
|
|
9
9
|
uri = URI(uri_base)
|
|
10
10
|
|
|
11
|
-
path = VENDOR_BASE_PATH << "/" <<
|
|
12
|
-
if endpoint
|
|
13
|
-
path = path << "/" << endpoint
|
|
14
|
-
end
|
|
15
|
-
uri.path = path
|
|
11
|
+
uri.path = VENDOR_BASE_PATH << "/" << endpoint
|
|
16
12
|
|
|
17
13
|
if params
|
|
18
14
|
uri.query = URI.encode_www_form(params)
|
data/lib/api/app/app.rb
CHANGED
|
@@ -1,52 +1,54 @@
|
|
|
1
1
|
class App < ApiModule
|
|
2
2
|
def initialize(client)
|
|
3
3
|
super(client)
|
|
4
|
-
@ENDPOINT = client.ENDPOINT + "/" + "app"
|
|
5
4
|
end
|
|
6
5
|
|
|
7
|
-
def list_branding(
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
def list_branding(app_id:)
|
|
7
|
+
method = "GET"
|
|
8
|
+
endpoint = "app/" + app_id + "/branding"
|
|
9
|
+
uri = ApiUri::build_uri(endpoint)
|
|
10
|
+
return self.client.request(method, uri)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
def create_branding(
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
def create_branding(app_id:)
|
|
14
|
+
method = "POST"
|
|
15
|
+
endpoint = "app/" + app_id + "/branding"
|
|
16
|
+
uri = ApiUri::build_uri(endpoint)
|
|
17
|
+
return self.client.request(method, uri)
|
|
15
18
|
end
|
|
16
19
|
|
|
17
|
-
def list_license_fields(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
def list_license_fields(app_id:)
|
|
21
|
+
method = "GET"
|
|
22
|
+
endpoint = "app/" + app_id + "/licensefield"
|
|
23
|
+
uri = ApiUri::build_uri(endpoint)
|
|
24
|
+
return self.client.request(method, uri)
|
|
20
25
|
end
|
|
21
26
|
|
|
22
|
-
def create_license_field(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"name": name,
|
|
28
|
-
"required": required,
|
|
29
|
-
"title": title,
|
|
30
|
-
"type": type,
|
|
31
|
-
})
|
|
27
|
+
def create_license_field(app_id:, options:)
|
|
28
|
+
method = "POST"
|
|
29
|
+
endpoint = "app/" + app_id + "/licensefield"
|
|
30
|
+
uri = ApiUri::build_uri(endpoint)
|
|
31
|
+
return self.client.request(method, uri, options)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def edit_license_field(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"title": title,
|
|
40
|
-
})
|
|
34
|
+
def edit_license_field(app_id:, license_field_name:, options:)
|
|
35
|
+
method = "PUT"
|
|
36
|
+
endpoint = "app/" + app_id + "/licensefield/" + license_field_name
|
|
37
|
+
uri = ApiUri::build_uri(endpoint)
|
|
38
|
+
return self.client.request(method, uri, options)
|
|
41
39
|
end
|
|
42
40
|
|
|
43
|
-
def delete_license_field(
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
def delete_license_field(app_id:, license_field_name:)
|
|
42
|
+
method = "DELETE"
|
|
43
|
+
endpoint = "app/" + app_id + "/licensefield/" + license_field_name
|
|
44
|
+
uri = ApiUri::build_uri(endpoint)
|
|
45
|
+
return self.client.request(method, uri)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
def list_license(
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
def list_license(app_id:)
|
|
49
|
+
method = "GET"
|
|
50
|
+
endpoint = "app/" + app_id + "/licenses"
|
|
51
|
+
uri = ApiUri::build_uri(endpoint)
|
|
52
|
+
return self.client.request(method, uri)
|
|
51
53
|
end
|
|
52
54
|
end
|
data/lib/api/apps/apps.rb
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
class Apps < ApiModule
|
|
2
2
|
def initialize(client)
|
|
3
3
|
super(client)
|
|
4
|
-
@ENDPOINT = client.ENDPOINT + "/" + "app"
|
|
5
4
|
end
|
|
6
5
|
|
|
7
6
|
def list()
|
|
8
7
|
method = "GET"
|
|
9
|
-
|
|
8
|
+
endpoint = "app"
|
|
9
|
+
uri = ApiUri::build_uri(endpoint)
|
|
10
|
+
return self.client.request(method, uri)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
def delete(
|
|
13
|
+
def delete(app_id:)
|
|
13
14
|
method = "DELETE"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
endpoint = self.ENDPOINT + "/" + appid
|
|
18
|
-
return self.client.request(method, endpoint)
|
|
15
|
+
endpoint = "app/" + app_id
|
|
16
|
+
uri = ApiUri::build_uri(endpoint)
|
|
17
|
+
return self.client.request(method, uri)
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
def delete_branding(
|
|
20
|
+
def delete_branding(app_id:)
|
|
22
21
|
method = "DELETE"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
endpoint = self.ENDPOINT + "/" + appid + "/branding"
|
|
27
|
-
return self.client.request(method, endpoint)
|
|
22
|
+
endpoint = "app/" + app_id + "/branding"
|
|
23
|
+
uri = ApiUri::build_uri(endpoint)
|
|
24
|
+
return self.client.request(method, uri)
|
|
28
25
|
end
|
|
29
26
|
|
|
30
|
-
def create(
|
|
27
|
+
def create(options:)
|
|
31
28
|
method = "POST"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return self.client.request(method, self.ENDPOINT, {"name" => name})
|
|
29
|
+
endpoint = "app"
|
|
30
|
+
uri = ApiUri::build_uri(endpoint)
|
|
31
|
+
return self.client.request(method, uri, options)
|
|
36
32
|
end
|
|
37
33
|
end
|
|
@@ -3,9 +3,11 @@ class AuditLog < ApiModule
|
|
|
3
3
|
super(client)
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Expects query parameter target_id
|
|
7
|
+
def get_token(options:)
|
|
8
|
+
method = "GET"
|
|
7
9
|
endpoint = "auditlogtoken"
|
|
8
|
-
|
|
9
|
-
return self.client.request(
|
|
10
|
+
uri = ApiUri::build_uri(endpoint, options)
|
|
11
|
+
return self.client.request(method, uri)
|
|
10
12
|
end
|
|
11
13
|
end
|
data/lib/api/auth/auth.rb
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class Auth < ApiModule
|
|
2
|
+
def login(options:)
|
|
3
|
+
method = "POST"
|
|
4
|
+
endpoint = "user/login"
|
|
5
|
+
uri = ApiUri::build_uri(endpoint)
|
|
6
|
+
return self.client.request(method, uri, options)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def login_otp(options:)
|
|
10
|
+
method = "POST"
|
|
11
|
+
endpoint = "user/login/otp"
|
|
12
|
+
uri = ApiUri::build_uri(endpoint)
|
|
13
|
+
return self.client.request(method, uri, options)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def logout()
|
|
17
|
+
method = "POST"
|
|
18
|
+
endpoint = "user/logout"
|
|
19
|
+
uri = ApiUri::build_uri(endpoint)
|
|
20
|
+
return self.client.request(method, uri)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def signup(options:)
|
|
24
|
+
method = "POST"
|
|
25
|
+
endpoint = "user/signup"
|
|
26
|
+
uri = ApiUri::build_uri(endpoint)
|
|
27
|
+
return self.client.request(method, uri, options)
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/api/channel/channel.rb
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class Channel < ApiModule
|
|
2
|
+
def create_channel(app_id:, options:)
|
|
3
|
+
method = "POST"
|
|
4
|
+
endpoint = "app/" + app_id + "/channel"
|
|
5
|
+
uri = ApiUri::build_uri(endpoint)
|
|
6
|
+
return self.client.request(method, uri, options)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def update_channel(app_id:, channel_id:, options:)
|
|
10
|
+
method = "POST"
|
|
11
|
+
endpoint = "app/" + app_id + "/channel/" + channel_id
|
|
12
|
+
uri = ApiUri::build_uri(endpoint)
|
|
13
|
+
return self.client.request(method, uri, options)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def archive_channel(app_id:, channel_id:)
|
|
17
|
+
method = "POST"
|
|
18
|
+
endpoint = "app/" + app_id + "/channel/" + channel_id + "/archive"
|
|
19
|
+
uri = ApiUri::build_uri(endpoint)
|
|
20
|
+
return self.client.request(method, uri)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def update_release(app_id:, channel_id:, sequence:, options:)
|
|
24
|
+
method = "POST"
|
|
25
|
+
endpoint = "app/" + app_id + "/channel/" + channel_id + "/release/" + sequence
|
|
26
|
+
uri = ApiUri::build_uri(endpoint)
|
|
27
|
+
return self.client.request(method, uri, options)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def list_releases(app_id:, channel_id:)
|
|
31
|
+
method = "GET"
|
|
32
|
+
endpoint = "app/" + app_id + "/channel/" + channel_id + "/releases"
|
|
33
|
+
uri = ApiUri::build_uri(endpoint)
|
|
34
|
+
return self.client.request(method, uri)
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/api/license/license.rb
CHANGED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
class License < ApiModule
|
|
2
|
+
def create(options:)
|
|
3
|
+
method = "POST"
|
|
4
|
+
endpoint = "license"
|
|
5
|
+
uri = ApiUri.build_uri(endpoint)
|
|
6
|
+
return self.client.request(method, uri, options)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def get(license_id:)
|
|
10
|
+
method = "GET"
|
|
11
|
+
endpoint = "license/" << license_id
|
|
12
|
+
uri = ApiUri.build_uri(endpoint)
|
|
13
|
+
return self.client.request(method, uri)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def update(license_id:, options:)
|
|
17
|
+
method = "PUT"
|
|
18
|
+
endpoint = "license/" << license_id
|
|
19
|
+
uri = ApiUri.build_uri(endpoint)
|
|
20
|
+
return self.client.request(method, uri, options)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def archive(license_id:)
|
|
24
|
+
method = "DELETE"
|
|
25
|
+
endpoint = "license/" << license_id
|
|
26
|
+
uri = ApiUri.build_uri(endpoint)
|
|
27
|
+
return self.client.request(method, uri)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update_airgap(license_id:)
|
|
31
|
+
method = "POST"
|
|
32
|
+
endpoint = "license/" << license_id << "/airgap/password"
|
|
33
|
+
uri = ApiUri.build_uri(endpoint)
|
|
34
|
+
return self.client.request(method, uri)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def update_billing(license_id:, options:)
|
|
38
|
+
method = "PUT"
|
|
39
|
+
endpoint = "license/" << license_id << "/billing"
|
|
40
|
+
uri = ApiUri.build_uri(endpoint)
|
|
41
|
+
return self.client.request(method, uri)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def create_billing_event(license_id:, options:)
|
|
45
|
+
method = "POST"
|
|
46
|
+
endpoint = "license/" << license_id << "/billling_event"
|
|
47
|
+
uri = ApiUri.build_uri(endpoint)
|
|
48
|
+
return self.client.request(method, uri, options)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def update_billing_event(license_id:, billing_event_id:, options:)
|
|
52
|
+
method = "PUT"
|
|
53
|
+
endpoint = "license/" << license_id << "/billing_event/" <<
|
|
54
|
+
billing_event_id
|
|
55
|
+
uri = ApiUri.build_uri(endpoint)
|
|
56
|
+
return self.client.request(method, uri, options)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def update_channel(license_id:, options:)
|
|
60
|
+
method = "PUT"
|
|
61
|
+
endpoint = "license/" << license_id << "/channel"
|
|
62
|
+
uri = ApiUri.build_uri(endpoint)
|
|
63
|
+
return self.client.request(method, uri, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def update_expiration(license_id:, options:)
|
|
67
|
+
method = "PUT"
|
|
68
|
+
endpoint = "license/" << license_id << "/expire"
|
|
69
|
+
uri = ApiUri.build_uri(endpoint)
|
|
70
|
+
return self.client.request(method, uri, options)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def set_license_field(license_id:, options:)
|
|
74
|
+
method = "PUT"
|
|
75
|
+
endpoint = "license/" << license_id << "/field"
|
|
76
|
+
uri = ApiUri.build_uri(endpoint)
|
|
77
|
+
return self.client.request(method, uri, options)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def get_license_fields(license_id:)
|
|
81
|
+
method = "GET"
|
|
82
|
+
endpoint = "license/" << license_id << "/fields"
|
|
83
|
+
uri = ApiUri.build_uri(endpoint)
|
|
84
|
+
return self.client.request(method, uri)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def update_license_fields(license_id:, options:)
|
|
88
|
+
method = "PUT"
|
|
89
|
+
endpoint = "license/" << license_id << "/field"
|
|
90
|
+
uri = ApiUri.build_uri(endpoint)
|
|
91
|
+
return self.client.request(method, uri, options)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def get_license_instance(license_id:, instance_id:)
|
|
95
|
+
method = "GET"
|
|
96
|
+
endpoint = "license/" << license_id << "/instance/" << instance_id
|
|
97
|
+
uri = ApiUri.build_uri(endpoint)
|
|
98
|
+
return self.client.request(method, uri)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def list_tracked_license_instances(license_id:)
|
|
102
|
+
method = "GET"
|
|
103
|
+
endpoint = "license/" << license_id << "/instances"
|
|
104
|
+
uri = ApiUri.build_uri(endpoint)
|
|
105
|
+
return self.client.request(method, uri)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def list_untracked_license_instances(license_id:)
|
|
109
|
+
method = "GET"
|
|
110
|
+
endpoint = "license/" << license_id << "/instances/untracked"
|
|
111
|
+
uri = ApiUri.build_uri(endpoint)
|
|
112
|
+
return self.client.request(method, uri)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def revoke_license(license_id:)
|
|
116
|
+
method = "PUT"
|
|
117
|
+
endpoint = "license/" << license_id << "/revoke"
|
|
118
|
+
uri = ApiUri.build_uri(endpoint)
|
|
119
|
+
return self.client.request(method, uri)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def unarchive_license(license_id:)
|
|
123
|
+
method = "PUT"
|
|
124
|
+
endpoint = "license/" << license_id << "/unarchive"
|
|
125
|
+
uri = ApiUri.build_uri(endpoint)
|
|
126
|
+
return self.client.request(method, uri)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Warning: this returns an RLI in Base64
|
|
130
|
+
def download_license(license_id:)
|
|
131
|
+
method = "GET"
|
|
132
|
+
endpoint = "licensekey/" << license_id
|
|
133
|
+
uri = ApiUri.build_uri(endpoint)
|
|
134
|
+
return self.client.request(method, uri)
|
|
135
|
+
end
|
|
136
|
+
end
|
data/lib/api/release/release.rb
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
class Release < ApiModule
|
|
2
|
+
def create(appid:, options:)
|
|
3
|
+
method = "POST"
|
|
4
|
+
endpoint = "app/" << appid << "/release"
|
|
5
|
+
uri = ApiUri::build_uri(endpoint)
|
|
6
|
+
return self.client.request(method, uri)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def archive(appid:, squence:)
|
|
10
|
+
method = "POST"
|
|
11
|
+
endpoint = "app/" << appid << "/" << sequence << "/archive"
|
|
12
|
+
uri = ApiUri::build_uri(endpoint)
|
|
13
|
+
return self.client.request(method, uri)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_preflight_checks(appid:, sequence:)
|
|
17
|
+
method = "GET"
|
|
18
|
+
endpoint = "app/" << appid << "/" << sequence << "/preflightchecks"
|
|
19
|
+
uri = ApiUri::build_uri(endpoint)
|
|
20
|
+
return self.client.request(method, uri)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def promote(appid:, sequence:, options:)
|
|
24
|
+
method = "POST"
|
|
25
|
+
endpoint = "app/" << appid << "/" << sequence << "/promote"
|
|
26
|
+
uri = ApiUri::build_uri(endpoint)
|
|
27
|
+
return self.client.request(method, uri, options)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def get_properties(appid:, sequence:)
|
|
31
|
+
method = "GET"
|
|
32
|
+
endpoint = "app/" << appid << "/" << sequence << "/properties"
|
|
33
|
+
uri = ApiUri::build_uri(endpoint)
|
|
34
|
+
return self.client.request(method, uri)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def get_config(appid:, sequence:)
|
|
38
|
+
method = "GET"
|
|
39
|
+
endpoint = "app/" << appid << "/" << sequence << "/raw"
|
|
40
|
+
uri = ApiUri::build_uri(endpoint)
|
|
41
|
+
return self.client.request(method, uri)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update_config(appid:, sequence:)
|
|
45
|
+
method = "PUT"
|
|
46
|
+
endpoint = "app/" << appid << "/" << sequence << "/raw"
|
|
47
|
+
uri = ApiUri::build_uri(endpoint)
|
|
48
|
+
return self.client.request(method, uri)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class Releases < ApiModule
|
|
2
|
+
def list_releases(app_id:)
|
|
3
|
+
method = "GET"
|
|
4
|
+
endpoint = "app/" + app_id + "/releases"
|
|
5
|
+
uri = ApiUri::build_uri(endpoint)
|
|
6
|
+
return self.client.request(method, uri)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def get_releases(app_id:, options:)
|
|
10
|
+
method = "GET"
|
|
11
|
+
endpoint = "app/" + app_id + "/releases/paged"
|
|
12
|
+
uri = ApiUri::build_uri(endpoint, options)
|
|
13
|
+
return self.client.request(method, uri)
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/api/team/team.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class Team < ApiModule
|
|
2
|
+
def initialize(client)
|
|
3
|
+
super(client)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def invite_to_team(appid:, options:)
|
|
7
|
+
method = "POST"
|
|
8
|
+
endpoint = "team/invite/" << appid << "/signup"
|
|
9
|
+
uri = ApiUri::build_uri(endpoint)
|
|
10
|
+
return self.client.request(method, uri, options)
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/api.rb
CHANGED
|
@@ -14,42 +14,38 @@ class VendorApi
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def apps
|
|
17
|
-
|
|
17
|
+
return Apps.new(@client)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def auditlog
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def auditlog
|
|
25
|
-
|
|
21
|
+
return AuditLog.new(@client)
|
|
26
22
|
end
|
|
27
23
|
|
|
28
24
|
def auth
|
|
29
|
-
|
|
25
|
+
return Auth.new(@client)
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
def channel
|
|
33
|
-
|
|
29
|
+
return Channel.new(@client)
|
|
34
30
|
end
|
|
35
31
|
|
|
36
32
|
def license
|
|
37
|
-
|
|
33
|
+
return License.new(@client)
|
|
38
34
|
end
|
|
39
35
|
|
|
40
36
|
def licenes
|
|
41
|
-
|
|
37
|
+
return Licenses.new(@client)
|
|
42
38
|
end
|
|
43
39
|
|
|
44
40
|
def release
|
|
45
|
-
|
|
41
|
+
return Release.new(@client)
|
|
46
42
|
end
|
|
47
43
|
|
|
48
44
|
def releases
|
|
49
|
-
|
|
45
|
+
return Releases.new(@client)
|
|
50
46
|
end
|
|
51
47
|
|
|
52
48
|
def team
|
|
53
|
-
|
|
49
|
+
return Team.new(@client)
|
|
54
50
|
end
|
|
55
51
|
end
|
data/lib/client/client.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "ostruct"
|
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
class ApiClient
|
|
7
|
-
|
|
7
|
+
VENDOR_HOST = "api.replicated.com"
|
|
8
8
|
VERB_MAP = {
|
|
9
9
|
:get => Net::HTTP::Get,
|
|
10
10
|
:post => Net::HTTP::Post,
|
|
@@ -12,17 +12,18 @@ class ApiClient
|
|
|
12
12
|
:delete => Net::HTTP::Delete
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
def initialize
|
|
16
|
-
|
|
17
|
-
@http = Net::HTTP.new(
|
|
15
|
+
def initialize
|
|
16
|
+
# Create persistent HTTP connection
|
|
17
|
+
@http = Net::HTTP.new(VENDOR_HOST, URI::HTTPS::DEFAULT_PORT,
|
|
18
|
+
:use_ssl => uri.scheme == 'https')
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def set_token(api_token)
|
|
21
22
|
@api_token = api_token
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
def request_json(method,
|
|
25
|
-
response = request(method,
|
|
25
|
+
def request_json(method, uri, params = nil)
|
|
26
|
+
response = request(method, uri, params)
|
|
26
27
|
body = JSON.parse(response.body)
|
|
27
28
|
|
|
28
29
|
OpenStruct.new(:code => response.code, :body => body)
|
|
@@ -30,14 +31,12 @@ class ApiClient
|
|
|
30
31
|
response
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
def request(method,
|
|
34
|
+
def request(method, uri, params)
|
|
34
35
|
method_sym = method.downcase.to_sym
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
else
|
|
40
|
-
request = VERB_MAP[method_sym].new(path)
|
|
36
|
+
|
|
37
|
+
request = VERB_MAP[method_sym].new(uri)
|
|
38
|
+
|
|
39
|
+
unless method_sym.is_eql? :get
|
|
41
40
|
request.set_form_data(params)
|
|
42
41
|
end
|
|
43
42
|
|
|
@@ -47,9 +46,4 @@ class ApiClient
|
|
|
47
46
|
|
|
48
47
|
@http.request(request)
|
|
49
48
|
end
|
|
50
|
-
|
|
51
|
-
def encode_path_params(path, params)
|
|
52
|
-
encoded = URI.encode_www_form(params)
|
|
53
|
-
[path, encoded].join("?")
|
|
54
|
-
end
|
|
55
49
|
end
|
data/replicatedvendor.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'replicatedvendor'
|
|
3
|
-
s.version = '0.0.
|
|
3
|
+
s.version = '0.0.2'
|
|
4
4
|
s.licenses = ['MIT']
|
|
5
5
|
s.summary = "A ruby wrapper for the replicated vendor api"
|
|
6
6
|
s.description = "A ruby wrapper for the replicated vendor api: https://replicated-vendor-api.readme.io/v1.0/reference"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: replicatedvendor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Guy Moore
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-10-
|
|
12
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: 'A ruby wrapper for the replicated vendor api: https://replicated-vendor-api.readme.io/v1.0/reference'
|
|
15
15
|
email: guy.moore.normal@mgmail.com
|
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
|
19
19
|
files:
|
|
20
20
|
- lib/api.rb
|
|
21
21
|
- lib/api/apimodule.rb
|
|
22
|
+
- lib/api/apiuri.rb
|
|
22
23
|
- lib/api/app/app.rb
|
|
23
24
|
- lib/api/apps/apps.rb
|
|
24
25
|
- lib/api/auditlog/auditlog.rb
|
|
@@ -29,9 +30,7 @@ files:
|
|
|
29
30
|
- lib/api/release/release.rb
|
|
30
31
|
- lib/api/releases/releases.rb
|
|
31
32
|
- lib/api/team/team.rb
|
|
32
|
-
- lib/apiuri.rb
|
|
33
33
|
- lib/client/client.rb
|
|
34
|
-
- lib/util/assert.rb
|
|
35
34
|
- replicatedvendor.gemspec
|
|
36
35
|
homepage: https://rubygems.org/gems/replicatedvendor
|
|
37
36
|
licenses:
|