phraseapp-ruby 1.2.7 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phraseapp-ruby.rb +495 -12
- data/lib/phraseapp-ruby/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25921bb893225a9ef21c85046e647de542557af1
|
4
|
+
data.tar.gz: d29d544f6d6d34cc9cf8ae81b1a9c283a70279cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23735c1093ad73ff464026f1fbdf144ab722932dd7cce774aebff95c58d2faf6f7342ea5531292d719baa83095eee08e2f3d73b2d5e78cd03a69a16fb6a48f8f
|
7
|
+
data.tar.gz: f96913fc0719528415c33878cbba35bea3c97c4c07074c7a61ff8675a146b6b22f1d3e36396280a6a79e0c7c78859d769b91cddaaa50a13ed2ec9f70177b99e8
|
data/lib/phraseapp-ruby.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
|
2
|
-
# revision_docs:
|
3
|
-
# revision_generator:
|
4
|
-
|
2
|
+
# revision_docs:4fc36062055363b8fc3e56e08ff53a29eed057ad
|
3
|
+
# revision_generator:8509abb5f6ffe365e0c33db40f00f3db0a450671
|
5
4
|
require 'ostruct'
|
6
5
|
require 'net/https'
|
7
6
|
require 'uri'
|
@@ -30,15 +29,7 @@ module PhraseApp
|
|
30
29
|
|
31
30
|
module ResponseObjects
|
32
31
|
class Account < ::OpenStruct
|
33
|
-
#created_at, id, name, updated_at,
|
34
|
-
def initialize(hash)
|
35
|
-
super(hash)
|
36
|
-
PhraseApp.handle_times(self)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class AccountPreview < ::OpenStruct
|
41
|
-
#created_at, id, name, updated_at,
|
32
|
+
#company, created_at, id, name, updated_at,
|
42
33
|
def initialize(hash)
|
43
34
|
super(hash)
|
44
35
|
PhraseApp.handle_times(self)
|
@@ -101,6 +92,14 @@ module ResponseObjects
|
|
101
92
|
end
|
102
93
|
end
|
103
94
|
|
95
|
+
class Invitation < ::OpenStruct
|
96
|
+
#accepted_at, created_at, email, id, locales, projects, role, state, updated_at,
|
97
|
+
def initialize(hash)
|
98
|
+
super(hash)
|
99
|
+
PhraseApp.handle_times(self)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
104
103
|
class KeyPreview < ::OpenStruct
|
105
104
|
#id, name, plural,
|
106
105
|
def initialize(hash)
|
@@ -141,6 +140,14 @@ module ResponseObjects
|
|
141
140
|
end
|
142
141
|
end
|
143
142
|
|
143
|
+
class Member < ::OpenStruct
|
144
|
+
#email, id, projects, role, username,
|
145
|
+
def initialize(hash)
|
146
|
+
super(hash)
|
147
|
+
PhraseApp.handle_times(self)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
144
151
|
class Project < ::OpenStruct
|
145
152
|
#account, created_at, id, main_format, name, updated_at,
|
146
153
|
def initialize(hash)
|
@@ -157,6 +164,22 @@ module ResponseObjects
|
|
157
164
|
end
|
158
165
|
end
|
159
166
|
|
167
|
+
class ProjectShort < ::OpenStruct
|
168
|
+
#created_at, id, main_format, name, updated_at,
|
169
|
+
def initialize(hash)
|
170
|
+
super(hash)
|
171
|
+
PhraseApp.handle_times(self)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
class ProjectLocales < ProjectShort
|
176
|
+
#locales,
|
177
|
+
def initialize(hash)
|
178
|
+
super(hash)
|
179
|
+
PhraseApp.handle_times(self)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
160
183
|
class StatisticsListItem < ::OpenStruct
|
161
184
|
#locale, statistics,
|
162
185
|
def initialize(hash)
|
@@ -530,6 +553,10 @@ module RequestParams
|
|
530
553
|
# Indicates whether locale is a RTL (Right-to-Left) locale.
|
531
554
|
# source_locale_id::
|
532
555
|
# Source locale. Can be the name or public id of the locale. Preferred is the public id.
|
556
|
+
# unverify_new_translations::
|
557
|
+
# Indicates that new translations for this locale should be marked as unverified.
|
558
|
+
# unverify_updated_translations::
|
559
|
+
# Indicates that updated translations for this locale should be marked as unverified.
|
533
560
|
class LocaleParams < ::OpenStruct
|
534
561
|
|
535
562
|
def code=(val)
|
@@ -574,6 +601,26 @@ module RequestParams
|
|
574
601
|
super(val)
|
575
602
|
end
|
576
603
|
|
604
|
+
def unverify_new_translations=(val)
|
605
|
+
if val.is_a?(TrueClass)
|
606
|
+
super(true)
|
607
|
+
elsif val.is_a?(FalseClass)
|
608
|
+
return
|
609
|
+
else
|
610
|
+
PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
def unverify_updated_translations=(val)
|
615
|
+
if val.is_a?(TrueClass)
|
616
|
+
super(true)
|
617
|
+
elsif val.is_a?(FalseClass)
|
618
|
+
return
|
619
|
+
else
|
620
|
+
PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
|
621
|
+
end
|
622
|
+
end
|
623
|
+
|
577
624
|
def validate
|
578
625
|
|
579
626
|
if code == nil || code == ""
|
@@ -1148,6 +1195,83 @@ module PhraseApp
|
|
1148
1195
|
|
1149
1196
|
|
1150
1197
|
|
1198
|
+
module RequestParams
|
1199
|
+
# InvitationCreateParams
|
1200
|
+
# == Parameters:
|
1201
|
+
# email::
|
1202
|
+
# The email of the invited user. The <code>email</code> can not be updated once created. Create a new invitation for each unique email.
|
1203
|
+
# locale_ids::
|
1204
|
+
# List of locale ids the invited user has access to.
|
1205
|
+
# project_ids::
|
1206
|
+
# List of project ids the invited user has access to.
|
1207
|
+
# role::
|
1208
|
+
# Invitiation role, can be any of Manager, Developer, Translator.
|
1209
|
+
class InvitationCreateParams < ::OpenStruct
|
1210
|
+
|
1211
|
+
def email=(val)
|
1212
|
+
super(val)
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
def locale_ids=(val)
|
1216
|
+
super(val)
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
def project_ids=(val)
|
1220
|
+
super(val)
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
def role=(val)
|
1224
|
+
super(val)
|
1225
|
+
end
|
1226
|
+
|
1227
|
+
def validate
|
1228
|
+
|
1229
|
+
if email == nil || email == ""
|
1230
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"email\" of \"invitation_createParams\" not set")
|
1231
|
+
end
|
1232
|
+
if role == nil || role == ""
|
1233
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"role\" of \"invitation_createParams\" not set")
|
1234
|
+
end
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
end
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
|
1241
|
+
module RequestParams
|
1242
|
+
# InvitationUpdateParams
|
1243
|
+
# == Parameters:
|
1244
|
+
# locale_ids::
|
1245
|
+
# List of locale ids the invited user has access to
|
1246
|
+
# project_ids::
|
1247
|
+
# List of project ids the invited user has access to
|
1248
|
+
# role::
|
1249
|
+
# Invitiation role, can be any of Manager, Developer, Translator
|
1250
|
+
class InvitationUpdateParams < ::OpenStruct
|
1251
|
+
|
1252
|
+
def locale_ids=(val)
|
1253
|
+
super(val)
|
1254
|
+
end
|
1255
|
+
|
1256
|
+
def project_ids=(val)
|
1257
|
+
super(val)
|
1258
|
+
end
|
1259
|
+
|
1260
|
+
def role=(val)
|
1261
|
+
super(val)
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
def validate
|
1265
|
+
|
1266
|
+
if role == nil || role == ""
|
1267
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"role\" of \"invitation_updateParams\" not set")
|
1268
|
+
end
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
end
|
1272
|
+
end
|
1273
|
+
|
1274
|
+
|
1151
1275
|
module RequestParams
|
1152
1276
|
# KeysDeleteParams
|
1153
1277
|
# == Parameters:
|
@@ -1409,6 +1533,40 @@ module RequestParams
|
|
1409
1533
|
end
|
1410
1534
|
|
1411
1535
|
|
1536
|
+
module RequestParams
|
1537
|
+
# MemberUpdateParams
|
1538
|
+
# == Parameters:
|
1539
|
+
# locale_ids::
|
1540
|
+
# List of locale ids the user has access to.
|
1541
|
+
# project_ids::
|
1542
|
+
# List of project ids the user has access to.
|
1543
|
+
# role::
|
1544
|
+
# Member role, can be any of of Manager, Developer, Translator
|
1545
|
+
class MemberUpdateParams < ::OpenStruct
|
1546
|
+
|
1547
|
+
def locale_ids=(val)
|
1548
|
+
super(val)
|
1549
|
+
end
|
1550
|
+
|
1551
|
+
def project_ids=(val)
|
1552
|
+
super(val)
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
def role=(val)
|
1556
|
+
super(val)
|
1557
|
+
end
|
1558
|
+
|
1559
|
+
def validate
|
1560
|
+
|
1561
|
+
if role == nil || role == ""
|
1562
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"role\" of \"member_updateParams\" not set")
|
1563
|
+
end
|
1564
|
+
end
|
1565
|
+
|
1566
|
+
end
|
1567
|
+
end
|
1568
|
+
|
1569
|
+
|
1412
1570
|
module RequestParams
|
1413
1571
|
# TranslationUpdateParams
|
1414
1572
|
# == Parameters:
|
@@ -1730,6 +1888,50 @@ end
|
|
1730
1888
|
end
|
1731
1889
|
|
1732
1890
|
|
1891
|
+
# Get details on a single account.
|
1892
|
+
# API Path: /v2/accounts/:id
|
1893
|
+
# == Parameters:
|
1894
|
+
# id::
|
1895
|
+
# id
|
1896
|
+
#
|
1897
|
+
# == Returns:
|
1898
|
+
# PhraseApp::ResponseObjects::Account
|
1899
|
+
# err
|
1900
|
+
def account_show(id)
|
1901
|
+
path = sprintf("/api/v2/accounts/%s", id)
|
1902
|
+
data_hash = {}
|
1903
|
+
post_body = nil
|
1904
|
+
|
1905
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
1906
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
1907
|
+
if err != nil
|
1908
|
+
return nil, err
|
1909
|
+
end
|
1910
|
+
|
1911
|
+
return PhraseApp::ResponseObjects::Account.new(JSON.load(rc.body)), err
|
1912
|
+
end
|
1913
|
+
|
1914
|
+
# List all accounts the current user has access to.
|
1915
|
+
# API Path: /v2/accounts
|
1916
|
+
# == Parameters:
|
1917
|
+
#
|
1918
|
+
# == Returns:
|
1919
|
+
# PhraseApp::ResponseObjects::Account
|
1920
|
+
# err
|
1921
|
+
def accounts_list(page, per_page)
|
1922
|
+
path = sprintf("/api/v2/accounts")
|
1923
|
+
data_hash = {}
|
1924
|
+
post_body = nil
|
1925
|
+
|
1926
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
1927
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1928
|
+
if err != nil
|
1929
|
+
return nil, err
|
1930
|
+
end
|
1931
|
+
|
1932
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Account.new(item) }, err
|
1933
|
+
end
|
1934
|
+
|
1733
1935
|
# Create a new authorization.
|
1734
1936
|
# API Path: /v2/authorizations
|
1735
1937
|
# == Parameters:
|
@@ -2267,6 +2469,177 @@ end
|
|
2267
2469
|
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Format.new(item) }, err
|
2268
2470
|
end
|
2269
2471
|
|
2472
|
+
# Invite a person to an account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them.
|
2473
|
+
# API Path: /v2/accounts/:account_id/invitations
|
2474
|
+
# == Parameters:
|
2475
|
+
# account_id::
|
2476
|
+
# account_id
|
2477
|
+
# params::
|
2478
|
+
# Parameters of type PhraseApp::RequestParams::InvitationCreateParams
|
2479
|
+
#
|
2480
|
+
# == Returns:
|
2481
|
+
# PhraseApp::ResponseObjects::Invitation
|
2482
|
+
# err
|
2483
|
+
def invitation_create(account_id, params)
|
2484
|
+
path = sprintf("/api/v2/accounts/%s/invitations", account_id)
|
2485
|
+
data_hash = {}
|
2486
|
+
post_body = nil
|
2487
|
+
|
2488
|
+
if params.present?
|
2489
|
+
unless params.kind_of?(PhraseApp::RequestParams::InvitationCreateParams)
|
2490
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::InvitationCreateParams")
|
2491
|
+
end
|
2492
|
+
end
|
2493
|
+
|
2494
|
+
data_hash = params.to_h
|
2495
|
+
err = params.validate
|
2496
|
+
if err != nil
|
2497
|
+
return nil, err
|
2498
|
+
end
|
2499
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2500
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
|
2501
|
+
if err != nil
|
2502
|
+
return nil, err
|
2503
|
+
end
|
2504
|
+
|
2505
|
+
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2506
|
+
end
|
2507
|
+
|
2508
|
+
# Delete an existing invitation (must not be accepted yet).
|
2509
|
+
# API Path: /v2/accounts/:account_id/invitations/:id
|
2510
|
+
# == Parameters:
|
2511
|
+
# account_id::
|
2512
|
+
# account_id
|
2513
|
+
# id::
|
2514
|
+
# id
|
2515
|
+
#
|
2516
|
+
# == Returns:
|
2517
|
+
# err
|
2518
|
+
def invitation_delete(account_id, id)
|
2519
|
+
path = sprintf("/api/v2/accounts/%s/invitations/%s", account_id, id)
|
2520
|
+
data_hash = {}
|
2521
|
+
post_body = nil
|
2522
|
+
|
2523
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2524
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
2525
|
+
if err != nil
|
2526
|
+
return nil, err
|
2527
|
+
end
|
2528
|
+
|
2529
|
+
return err
|
2530
|
+
end
|
2531
|
+
|
2532
|
+
# Resend the invitation email (must not be accepted yet).
|
2533
|
+
# API Path: /v2/accounts/:account_id/invitations/:id/resend
|
2534
|
+
# == Parameters:
|
2535
|
+
# account_id::
|
2536
|
+
# account_id
|
2537
|
+
# id::
|
2538
|
+
# id
|
2539
|
+
#
|
2540
|
+
# == Returns:
|
2541
|
+
# PhraseApp::ResponseObjects::Invitation
|
2542
|
+
# err
|
2543
|
+
def invitation_resend(account_id, id)
|
2544
|
+
path = sprintf("/api/v2/accounts/%s/invitations/%s/resend", account_id, id)
|
2545
|
+
data_hash = {}
|
2546
|
+
post_body = nil
|
2547
|
+
|
2548
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2549
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
|
2550
|
+
if err != nil
|
2551
|
+
return nil, err
|
2552
|
+
end
|
2553
|
+
|
2554
|
+
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2555
|
+
end
|
2556
|
+
|
2557
|
+
# Get details on a single invitation.
|
2558
|
+
# API Path: /v2/accounts/:account_id/invitations/:id
|
2559
|
+
# == Parameters:
|
2560
|
+
# account_id::
|
2561
|
+
# account_id
|
2562
|
+
# id::
|
2563
|
+
# id
|
2564
|
+
#
|
2565
|
+
# == Returns:
|
2566
|
+
# PhraseApp::ResponseObjects::Invitation
|
2567
|
+
# err
|
2568
|
+
def invitation_show(account_id, id)
|
2569
|
+
path = sprintf("/api/v2/accounts/%s/invitations/%s", account_id, id)
|
2570
|
+
data_hash = {}
|
2571
|
+
post_body = nil
|
2572
|
+
|
2573
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2574
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
2575
|
+
if err != nil
|
2576
|
+
return nil, err
|
2577
|
+
end
|
2578
|
+
|
2579
|
+
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2580
|
+
end
|
2581
|
+
|
2582
|
+
# Update an existing invitation (must not be accepted yet). The <code>email</code> cannot be updated. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them.
|
2583
|
+
# API Path: /v2/accounts/:account_id/invitations/:id
|
2584
|
+
# == Parameters:
|
2585
|
+
# account_id::
|
2586
|
+
# account_id
|
2587
|
+
# id::
|
2588
|
+
# id
|
2589
|
+
# params::
|
2590
|
+
# Parameters of type PhraseApp::RequestParams::InvitationUpdateParams
|
2591
|
+
#
|
2592
|
+
# == Returns:
|
2593
|
+
# PhraseApp::ResponseObjects::Invitation
|
2594
|
+
# err
|
2595
|
+
def invitation_update(account_id, id, params)
|
2596
|
+
path = sprintf("/api/v2/accounts/%s/invitations/%s", account_id, id)
|
2597
|
+
data_hash = {}
|
2598
|
+
post_body = nil
|
2599
|
+
|
2600
|
+
if params.present?
|
2601
|
+
unless params.kind_of?(PhraseApp::RequestParams::InvitationUpdateParams)
|
2602
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::InvitationUpdateParams")
|
2603
|
+
end
|
2604
|
+
end
|
2605
|
+
|
2606
|
+
data_hash = params.to_h
|
2607
|
+
err = params.validate
|
2608
|
+
if err != nil
|
2609
|
+
return nil, err
|
2610
|
+
end
|
2611
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2612
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2613
|
+
if err != nil
|
2614
|
+
return nil, err
|
2615
|
+
end
|
2616
|
+
|
2617
|
+
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2618
|
+
end
|
2619
|
+
|
2620
|
+
# List invitations for an account. It will also list the accessible resources like projects and locales the invited user has access to. In case nothing is shown the default access from the role is used.
|
2621
|
+
# API Path: /v2/accounts/:account_id/invitations
|
2622
|
+
# == Parameters:
|
2623
|
+
# account_id::
|
2624
|
+
# account_id
|
2625
|
+
#
|
2626
|
+
# == Returns:
|
2627
|
+
# PhraseApp::ResponseObjects::Invitation
|
2628
|
+
# err
|
2629
|
+
def invitations_list(account_id, page, per_page)
|
2630
|
+
path = sprintf("/api/v2/accounts/%s/invitations", account_id)
|
2631
|
+
data_hash = {}
|
2632
|
+
post_body = nil
|
2633
|
+
|
2634
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2635
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2636
|
+
if err != nil
|
2637
|
+
return nil, err
|
2638
|
+
end
|
2639
|
+
|
2640
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Invitation.new(item) }, err
|
2641
|
+
end
|
2642
|
+
|
2270
2643
|
# Create a new key.
|
2271
2644
|
# API Path: /v2/projects/:project_id/keys
|
2272
2645
|
# == Parameters:
|
@@ -2869,6 +3242,116 @@ end
|
|
2869
3242
|
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Locale.new(item) }, err
|
2870
3243
|
end
|
2871
3244
|
|
3245
|
+
# Remove a user from the account. The user will be removed from the account but not deleted from PhraseApp.
|
3246
|
+
# API Path: /v2/accounts/:account_id/members/:id
|
3247
|
+
# == Parameters:
|
3248
|
+
# account_id::
|
3249
|
+
# account_id
|
3250
|
+
# id::
|
3251
|
+
# id
|
3252
|
+
#
|
3253
|
+
# == Returns:
|
3254
|
+
# err
|
3255
|
+
def member_delete(account_id, id)
|
3256
|
+
path = sprintf("/api/v2/accounts/%s/members/%s", account_id, id)
|
3257
|
+
data_hash = {}
|
3258
|
+
post_body = nil
|
3259
|
+
|
3260
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3261
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
3262
|
+
if err != nil
|
3263
|
+
return nil, err
|
3264
|
+
end
|
3265
|
+
|
3266
|
+
return err
|
3267
|
+
end
|
3268
|
+
|
3269
|
+
# Get details on a single user in the account.
|
3270
|
+
# API Path: /v2/accounts/:account_id/members/:id
|
3271
|
+
# == Parameters:
|
3272
|
+
# account_id::
|
3273
|
+
# account_id
|
3274
|
+
# id::
|
3275
|
+
# id
|
3276
|
+
#
|
3277
|
+
# == Returns:
|
3278
|
+
# PhraseApp::ResponseObjects::Member
|
3279
|
+
# err
|
3280
|
+
def member_show(account_id, id)
|
3281
|
+
path = sprintf("/api/v2/accounts/%s/members/%s", account_id, id)
|
3282
|
+
data_hash = {}
|
3283
|
+
post_body = nil
|
3284
|
+
|
3285
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3286
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
3287
|
+
if err != nil
|
3288
|
+
return nil, err
|
3289
|
+
end
|
3290
|
+
|
3291
|
+
return PhraseApp::ResponseObjects::Member.new(JSON.load(rc.body)), err
|
3292
|
+
end
|
3293
|
+
|
3294
|
+
# Update user permissions in the account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them.
|
3295
|
+
# API Path: /v2/accounts/:account_id/members/:id
|
3296
|
+
# == Parameters:
|
3297
|
+
# account_id::
|
3298
|
+
# account_id
|
3299
|
+
# id::
|
3300
|
+
# id
|
3301
|
+
# params::
|
3302
|
+
# Parameters of type PhraseApp::RequestParams::MemberUpdateParams
|
3303
|
+
#
|
3304
|
+
# == Returns:
|
3305
|
+
# PhraseApp::ResponseObjects::Member
|
3306
|
+
# err
|
3307
|
+
def member_update(account_id, id, params)
|
3308
|
+
path = sprintf("/api/v2/accounts/%s/members/%s", account_id, id)
|
3309
|
+
data_hash = {}
|
3310
|
+
post_body = nil
|
3311
|
+
|
3312
|
+
if params.present?
|
3313
|
+
unless params.kind_of?(PhraseApp::RequestParams::MemberUpdateParams)
|
3314
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::MemberUpdateParams")
|
3315
|
+
end
|
3316
|
+
end
|
3317
|
+
|
3318
|
+
data_hash = params.to_h
|
3319
|
+
err = params.validate
|
3320
|
+
if err != nil
|
3321
|
+
return nil, err
|
3322
|
+
end
|
3323
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3324
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
3325
|
+
if err != nil
|
3326
|
+
return nil, err
|
3327
|
+
end
|
3328
|
+
|
3329
|
+
return PhraseApp::ResponseObjects::Member.new(JSON.load(rc.body)), err
|
3330
|
+
end
|
3331
|
+
|
3332
|
+
# Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used.
|
3333
|
+
# API Path: /v2/accounts/:account_id/members
|
3334
|
+
# == Parameters:
|
3335
|
+
# account_id::
|
3336
|
+
# account_id
|
3337
|
+
#
|
3338
|
+
# == Returns:
|
3339
|
+
# PhraseApp::ResponseObjects::Member
|
3340
|
+
# err
|
3341
|
+
def members_list(account_id, page, per_page)
|
3342
|
+
path = sprintf("/api/v2/accounts/%s/members", account_id)
|
3343
|
+
data_hash = {}
|
3344
|
+
post_body = nil
|
3345
|
+
|
3346
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3347
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
3348
|
+
if err != nil
|
3349
|
+
return nil, err
|
3350
|
+
end
|
3351
|
+
|
3352
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Member.new(item) }, err
|
3353
|
+
end
|
3354
|
+
|
2872
3355
|
# Confirm an existing order and send it to the provider for translation. Same constraints as for create.
|
2873
3356
|
# API Path: /v2/projects/:project_id/orders/:id/confirm
|
2874
3357
|
# == Parameters:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phraseapp-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PhraseApp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PhraseApp API client libary
|
14
14
|
email:
|
@@ -41,9 +41,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
43
|
rubyforge_project:
|
44
|
-
rubygems_version: 2.
|
44
|
+
rubygems_version: 2.5.1
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Interact with the PhraseApp API
|
48
48
|
test_files: []
|
49
|
-
has_rdoc:
|