phraseapp-ruby 1.3.0 → 1.3.1
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 +555 -11
- data/lib/phraseapp-ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b2cc9b3d292a34cf2e853776ebbe2b7fdd4008f
|
4
|
+
data.tar.gz: 38ef695b8c4b67444b4584bc78df64fb4340016d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 585390ba61d7ea26020a04f2a0cb9c5c548412056330da57f8a2cb2e8ac635aa90d68adefc40f31f551ef8006436f694eae8e607922b333c8056c9a90d52b0fc
|
7
|
+
data.tar.gz: 4521e8871f084f904e3df7ae4c26fc90e2ff5f39d6c107b29425a7bd96f64c5e20f5f9824bdb7d3e81364c5825c36050aceaf30b69bb068a9a7b979412bc8d31
|
data/lib/phraseapp-ruby.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
# revision_docs:
|
2
|
+
# revision_docs:e5ee68f42b4e4c5990df830df68cd6b57800aa30
|
3
3
|
# revision_generator:8509abb5f6ffe365e0c33db40f00f3db0a450671
|
4
4
|
require 'ostruct'
|
5
5
|
require 'net/https'
|
@@ -92,6 +92,30 @@ module ResponseObjects
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
class Glossary < ::OpenStruct
|
96
|
+
#created_at, id, name, projects, updated_at,
|
97
|
+
def initialize(hash)
|
98
|
+
super(hash)
|
99
|
+
PhraseApp.handle_times(self)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class GlossaryTerm < ::OpenStruct
|
104
|
+
#case_sensitive, created_at, description, id, term, translatable, translations, updated_at,
|
105
|
+
def initialize(hash)
|
106
|
+
super(hash)
|
107
|
+
PhraseApp.handle_times(self)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
class GlossaryTermTranslation < ::OpenStruct
|
112
|
+
#content, created_at, id, locale_code, updated_at,
|
113
|
+
def initialize(hash)
|
114
|
+
super(hash)
|
115
|
+
PhraseApp.handle_times(self)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
95
119
|
class Invitation < ::OpenStruct
|
96
120
|
#accepted_at, created_at, email, id, locales, projects, role, state, updated_at,
|
97
121
|
def initialize(hash)
|
@@ -414,6 +438,114 @@ module RequestParams
|
|
414
438
|
end
|
415
439
|
|
416
440
|
|
441
|
+
module RequestParams
|
442
|
+
# GlossaryParams
|
443
|
+
# == Parameters:
|
444
|
+
# name::
|
445
|
+
# Name of the glossary
|
446
|
+
# project_ids::
|
447
|
+
# List of project ids the glossary should be assigned to.
|
448
|
+
class GlossaryParams < ::OpenStruct
|
449
|
+
|
450
|
+
def name=(val)
|
451
|
+
super(val)
|
452
|
+
end
|
453
|
+
|
454
|
+
def project_ids=(val)
|
455
|
+
super(val)
|
456
|
+
end
|
457
|
+
|
458
|
+
def validate
|
459
|
+
|
460
|
+
if name == nil || name == ""
|
461
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"name\" of \"GlossaryParams\" not set")
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
|
469
|
+
module RequestParams
|
470
|
+
# GlossaryTermTranslationParams
|
471
|
+
# == Parameters:
|
472
|
+
# content::
|
473
|
+
# The content of the translation
|
474
|
+
# locale_code::
|
475
|
+
# Identifies the language for this translation
|
476
|
+
class GlossaryTermTranslationParams < ::OpenStruct
|
477
|
+
|
478
|
+
def content=(val)
|
479
|
+
super(val)
|
480
|
+
end
|
481
|
+
|
482
|
+
def locale_code=(val)
|
483
|
+
super(val)
|
484
|
+
end
|
485
|
+
|
486
|
+
def validate
|
487
|
+
|
488
|
+
if locale_code == nil || locale_code == ""
|
489
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"locale_code\" of \"GlossaryTermTranslationParams\" not set")
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
|
497
|
+
module RequestParams
|
498
|
+
# GlossaryTermParams
|
499
|
+
# == Parameters:
|
500
|
+
# case_sensitive::
|
501
|
+
# Indicates whether the term is case sensitive
|
502
|
+
# description::
|
503
|
+
# Description of term
|
504
|
+
# term::
|
505
|
+
# Glossary term
|
506
|
+
# translatable::
|
507
|
+
# Indicates whether the term should be used for all languages or can be translated
|
508
|
+
class GlossaryTermParams < ::OpenStruct
|
509
|
+
|
510
|
+
def case_sensitive=(val)
|
511
|
+
if val.is_a?(TrueClass)
|
512
|
+
super(true)
|
513
|
+
elsif val.is_a?(FalseClass)
|
514
|
+
return
|
515
|
+
else
|
516
|
+
PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
def description=(val)
|
521
|
+
super(val)
|
522
|
+
end
|
523
|
+
|
524
|
+
def term=(val)
|
525
|
+
super(val)
|
526
|
+
end
|
527
|
+
|
528
|
+
def translatable=(val)
|
529
|
+
if val.is_a?(TrueClass)
|
530
|
+
super(true)
|
531
|
+
elsif val.is_a?(FalseClass)
|
532
|
+
return
|
533
|
+
else
|
534
|
+
PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
538
|
+
def validate
|
539
|
+
|
540
|
+
if term == nil || term == ""
|
541
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"term\" of \"GlossaryTermParams\" not set")
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
|
417
549
|
module RequestParams
|
418
550
|
# TranslationKeyParams
|
419
551
|
# == Parameters:
|
@@ -2469,7 +2601,419 @@ end
|
|
2469
2601
|
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Format.new(item) }, err
|
2470
2602
|
end
|
2471
2603
|
|
2472
|
-
#
|
2604
|
+
# List all glossaries the current user has access to.
|
2605
|
+
# API Path: /v2/accounts/:account_id/glossaries
|
2606
|
+
# == Parameters:
|
2607
|
+
# account_id::
|
2608
|
+
# account_id
|
2609
|
+
#
|
2610
|
+
# == Returns:
|
2611
|
+
# PhraseApp::ResponseObjects::Glossary
|
2612
|
+
# err
|
2613
|
+
def glossaries_list(account_id, page, per_page)
|
2614
|
+
path = sprintf("/api/v2/accounts/%s/glossaries", account_id)
|
2615
|
+
data_hash = {}
|
2616
|
+
post_body = nil
|
2617
|
+
|
2618
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2619
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2620
|
+
if err != nil
|
2621
|
+
return nil, err
|
2622
|
+
end
|
2623
|
+
|
2624
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Glossary.new(item) }, err
|
2625
|
+
end
|
2626
|
+
|
2627
|
+
# Create a new glossary.
|
2628
|
+
# API Path: /v2/accounts/:account_id/glossaries
|
2629
|
+
# == Parameters:
|
2630
|
+
# account_id::
|
2631
|
+
# account_id
|
2632
|
+
# params::
|
2633
|
+
# Parameters of type PhraseApp::RequestParams::GlossaryParams
|
2634
|
+
#
|
2635
|
+
# == Returns:
|
2636
|
+
# PhraseApp::ResponseObjects::Glossary
|
2637
|
+
# err
|
2638
|
+
def glossary_create(account_id, params)
|
2639
|
+
path = sprintf("/api/v2/accounts/%s/glossaries", account_id)
|
2640
|
+
data_hash = {}
|
2641
|
+
post_body = nil
|
2642
|
+
|
2643
|
+
if params.present?
|
2644
|
+
unless params.kind_of?(PhraseApp::RequestParams::GlossaryParams)
|
2645
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryParams")
|
2646
|
+
end
|
2647
|
+
end
|
2648
|
+
|
2649
|
+
data_hash = params.to_h
|
2650
|
+
err = params.validate
|
2651
|
+
if err != nil
|
2652
|
+
return nil, err
|
2653
|
+
end
|
2654
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2655
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
|
2656
|
+
if err != nil
|
2657
|
+
return nil, err
|
2658
|
+
end
|
2659
|
+
|
2660
|
+
return PhraseApp::ResponseObjects::Glossary.new(JSON.load(rc.body)), err
|
2661
|
+
end
|
2662
|
+
|
2663
|
+
# Delete an existing glossary.
|
2664
|
+
# API Path: /v2/accounts/:account_id/glossaries/:id
|
2665
|
+
# == Parameters:
|
2666
|
+
# account_id::
|
2667
|
+
# account_id
|
2668
|
+
# id::
|
2669
|
+
# id
|
2670
|
+
#
|
2671
|
+
# == Returns:
|
2672
|
+
# err
|
2673
|
+
def glossary_delete(account_id, id)
|
2674
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s", account_id, id)
|
2675
|
+
data_hash = {}
|
2676
|
+
post_body = nil
|
2677
|
+
|
2678
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2679
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
2680
|
+
if err != nil
|
2681
|
+
return nil, err
|
2682
|
+
end
|
2683
|
+
|
2684
|
+
return err
|
2685
|
+
end
|
2686
|
+
|
2687
|
+
# Get details on a single glossary.
|
2688
|
+
# API Path: /v2/accounts/:account_id/glossaries/:id
|
2689
|
+
# == Parameters:
|
2690
|
+
# account_id::
|
2691
|
+
# account_id
|
2692
|
+
# id::
|
2693
|
+
# id
|
2694
|
+
#
|
2695
|
+
# == Returns:
|
2696
|
+
# PhraseApp::ResponseObjects::Glossary
|
2697
|
+
# err
|
2698
|
+
def glossary_show(account_id, id)
|
2699
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s", account_id, id)
|
2700
|
+
data_hash = {}
|
2701
|
+
post_body = nil
|
2702
|
+
|
2703
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2704
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
2705
|
+
if err != nil
|
2706
|
+
return nil, err
|
2707
|
+
end
|
2708
|
+
|
2709
|
+
return PhraseApp::ResponseObjects::Glossary.new(JSON.load(rc.body)), err
|
2710
|
+
end
|
2711
|
+
|
2712
|
+
# Update an existing glossary.
|
2713
|
+
# API Path: /v2/accounts/:account_id/glossaries/:id
|
2714
|
+
# == Parameters:
|
2715
|
+
# account_id::
|
2716
|
+
# account_id
|
2717
|
+
# id::
|
2718
|
+
# id
|
2719
|
+
# params::
|
2720
|
+
# Parameters of type PhraseApp::RequestParams::GlossaryParams
|
2721
|
+
#
|
2722
|
+
# == Returns:
|
2723
|
+
# PhraseApp::ResponseObjects::Glossary
|
2724
|
+
# err
|
2725
|
+
def glossary_update(account_id, id, params)
|
2726
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s", account_id, id)
|
2727
|
+
data_hash = {}
|
2728
|
+
post_body = nil
|
2729
|
+
|
2730
|
+
if params.present?
|
2731
|
+
unless params.kind_of?(PhraseApp::RequestParams::GlossaryParams)
|
2732
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryParams")
|
2733
|
+
end
|
2734
|
+
end
|
2735
|
+
|
2736
|
+
data_hash = params.to_h
|
2737
|
+
err = params.validate
|
2738
|
+
if err != nil
|
2739
|
+
return nil, err
|
2740
|
+
end
|
2741
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2742
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2743
|
+
if err != nil
|
2744
|
+
return nil, err
|
2745
|
+
end
|
2746
|
+
|
2747
|
+
return PhraseApp::ResponseObjects::Glossary.new(JSON.load(rc.body)), err
|
2748
|
+
end
|
2749
|
+
|
2750
|
+
# Create a new glossary term.
|
2751
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms
|
2752
|
+
# == Parameters:
|
2753
|
+
# account_id::
|
2754
|
+
# account_id
|
2755
|
+
# glossary_id::
|
2756
|
+
# glossary_id
|
2757
|
+
# params::
|
2758
|
+
# Parameters of type PhraseApp::RequestParams::GlossaryTermParams
|
2759
|
+
#
|
2760
|
+
# == Returns:
|
2761
|
+
# PhraseApp::ResponseObjects::GlossaryTerm
|
2762
|
+
# err
|
2763
|
+
def glossary_term_create(account_id, glossary_id, params)
|
2764
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms", account_id, glossary_id)
|
2765
|
+
data_hash = {}
|
2766
|
+
post_body = nil
|
2767
|
+
|
2768
|
+
if params.present?
|
2769
|
+
unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermParams)
|
2770
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermParams")
|
2771
|
+
end
|
2772
|
+
end
|
2773
|
+
|
2774
|
+
data_hash = params.to_h
|
2775
|
+
err = params.validate
|
2776
|
+
if err != nil
|
2777
|
+
return nil, err
|
2778
|
+
end
|
2779
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2780
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
|
2781
|
+
if err != nil
|
2782
|
+
return nil, err
|
2783
|
+
end
|
2784
|
+
|
2785
|
+
return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err
|
2786
|
+
end
|
2787
|
+
|
2788
|
+
# Delete an existing glossary term.
|
2789
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms/:id
|
2790
|
+
# == Parameters:
|
2791
|
+
# account_id::
|
2792
|
+
# account_id
|
2793
|
+
# glossary_id::
|
2794
|
+
# glossary_id
|
2795
|
+
# id::
|
2796
|
+
# id
|
2797
|
+
#
|
2798
|
+
# == Returns:
|
2799
|
+
# err
|
2800
|
+
def glossary_term_delete(account_id, glossary_id, id)
|
2801
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", account_id, glossary_id, id)
|
2802
|
+
data_hash = {}
|
2803
|
+
post_body = nil
|
2804
|
+
|
2805
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2806
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
2807
|
+
if err != nil
|
2808
|
+
return nil, err
|
2809
|
+
end
|
2810
|
+
|
2811
|
+
return err
|
2812
|
+
end
|
2813
|
+
|
2814
|
+
# Get details on a single glossary term.
|
2815
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms/:id
|
2816
|
+
# == Parameters:
|
2817
|
+
# account_id::
|
2818
|
+
# account_id
|
2819
|
+
# glossary_id::
|
2820
|
+
# glossary_id
|
2821
|
+
# id::
|
2822
|
+
# id
|
2823
|
+
#
|
2824
|
+
# == Returns:
|
2825
|
+
# PhraseApp::ResponseObjects::GlossaryTerm
|
2826
|
+
# err
|
2827
|
+
def glossary_term_show(account_id, glossary_id, id)
|
2828
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", account_id, glossary_id, id)
|
2829
|
+
data_hash = {}
|
2830
|
+
post_body = nil
|
2831
|
+
|
2832
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2833
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
2834
|
+
if err != nil
|
2835
|
+
return nil, err
|
2836
|
+
end
|
2837
|
+
|
2838
|
+
return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err
|
2839
|
+
end
|
2840
|
+
|
2841
|
+
# Update an existing glossary term.
|
2842
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms/:id
|
2843
|
+
# == Parameters:
|
2844
|
+
# account_id::
|
2845
|
+
# account_id
|
2846
|
+
# glossary_id::
|
2847
|
+
# glossary_id
|
2848
|
+
# id::
|
2849
|
+
# id
|
2850
|
+
# params::
|
2851
|
+
# Parameters of type PhraseApp::RequestParams::GlossaryTermParams
|
2852
|
+
#
|
2853
|
+
# == Returns:
|
2854
|
+
# PhraseApp::ResponseObjects::GlossaryTerm
|
2855
|
+
# err
|
2856
|
+
def glossary_term_update(account_id, glossary_id, id, params)
|
2857
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", account_id, glossary_id, id)
|
2858
|
+
data_hash = {}
|
2859
|
+
post_body = nil
|
2860
|
+
|
2861
|
+
if params.present?
|
2862
|
+
unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermParams)
|
2863
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermParams")
|
2864
|
+
end
|
2865
|
+
end
|
2866
|
+
|
2867
|
+
data_hash = params.to_h
|
2868
|
+
err = params.validate
|
2869
|
+
if err != nil
|
2870
|
+
return nil, err
|
2871
|
+
end
|
2872
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2873
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2874
|
+
if err != nil
|
2875
|
+
return nil, err
|
2876
|
+
end
|
2877
|
+
|
2878
|
+
return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err
|
2879
|
+
end
|
2880
|
+
|
2881
|
+
# Create a new glossary term translation.
|
2882
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms/:term_id/translations
|
2883
|
+
# == Parameters:
|
2884
|
+
# account_id::
|
2885
|
+
# account_id
|
2886
|
+
# glossary_id::
|
2887
|
+
# glossary_id
|
2888
|
+
# term_id::
|
2889
|
+
# term_id
|
2890
|
+
# params::
|
2891
|
+
# Parameters of type PhraseApp::RequestParams::GlossaryTermTranslationParams
|
2892
|
+
#
|
2893
|
+
# == Returns:
|
2894
|
+
# PhraseApp::ResponseObjects::GlossaryTermTranslation
|
2895
|
+
# err
|
2896
|
+
def glossary_term_translation_create(account_id, glossary_id, term_id, params)
|
2897
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations", account_id, glossary_id, term_id)
|
2898
|
+
data_hash = {}
|
2899
|
+
post_body = nil
|
2900
|
+
|
2901
|
+
if params.present?
|
2902
|
+
unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermTranslationParams)
|
2903
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermTranslationParams")
|
2904
|
+
end
|
2905
|
+
end
|
2906
|
+
|
2907
|
+
data_hash = params.to_h
|
2908
|
+
err = params.validate
|
2909
|
+
if err != nil
|
2910
|
+
return nil, err
|
2911
|
+
end
|
2912
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2913
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
|
2914
|
+
if err != nil
|
2915
|
+
return nil, err
|
2916
|
+
end
|
2917
|
+
|
2918
|
+
return PhraseApp::ResponseObjects::GlossaryTermTranslation.new(JSON.load(rc.body)), err
|
2919
|
+
end
|
2920
|
+
|
2921
|
+
# Delete an existing glossary term translation.
|
2922
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms/:term_id/translations/:id
|
2923
|
+
# == Parameters:
|
2924
|
+
# account_id::
|
2925
|
+
# account_id
|
2926
|
+
# glossary_id::
|
2927
|
+
# glossary_id
|
2928
|
+
# term_id::
|
2929
|
+
# term_id
|
2930
|
+
# id::
|
2931
|
+
# id
|
2932
|
+
#
|
2933
|
+
# == Returns:
|
2934
|
+
# err
|
2935
|
+
def glossary_term_translation_delete(account_id, glossary_id, term_id, id)
|
2936
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations/%s", account_id, glossary_id, term_id, id)
|
2937
|
+
data_hash = {}
|
2938
|
+
post_body = nil
|
2939
|
+
|
2940
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2941
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
2942
|
+
if err != nil
|
2943
|
+
return nil, err
|
2944
|
+
end
|
2945
|
+
|
2946
|
+
return err
|
2947
|
+
end
|
2948
|
+
|
2949
|
+
# Update an existing glossary term translation.
|
2950
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms/:term_id/translations/:id
|
2951
|
+
# == Parameters:
|
2952
|
+
# account_id::
|
2953
|
+
# account_id
|
2954
|
+
# glossary_id::
|
2955
|
+
# glossary_id
|
2956
|
+
# term_id::
|
2957
|
+
# term_id
|
2958
|
+
# id::
|
2959
|
+
# id
|
2960
|
+
# params::
|
2961
|
+
# Parameters of type PhraseApp::RequestParams::GlossaryTermTranslationParams
|
2962
|
+
#
|
2963
|
+
# == Returns:
|
2964
|
+
# PhraseApp::ResponseObjects::GlossaryTermTranslation
|
2965
|
+
# err
|
2966
|
+
def glossary_term_translation_update(account_id, glossary_id, term_id, id, params)
|
2967
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations/%s", account_id, glossary_id, term_id, id)
|
2968
|
+
data_hash = {}
|
2969
|
+
post_body = nil
|
2970
|
+
|
2971
|
+
if params.present?
|
2972
|
+
unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermTranslationParams)
|
2973
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermTranslationParams")
|
2974
|
+
end
|
2975
|
+
end
|
2976
|
+
|
2977
|
+
data_hash = params.to_h
|
2978
|
+
err = params.validate
|
2979
|
+
if err != nil
|
2980
|
+
return nil, err
|
2981
|
+
end
|
2982
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
2983
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2984
|
+
if err != nil
|
2985
|
+
return nil, err
|
2986
|
+
end
|
2987
|
+
|
2988
|
+
return PhraseApp::ResponseObjects::GlossaryTermTranslation.new(JSON.load(rc.body)), err
|
2989
|
+
end
|
2990
|
+
|
2991
|
+
# List all glossary terms the current user has access to.
|
2992
|
+
# API Path: /v2/accounts/:account_id/glossaries/:glossary_id/terms
|
2993
|
+
# == Parameters:
|
2994
|
+
# account_id::
|
2995
|
+
# account_id
|
2996
|
+
# glossary_id::
|
2997
|
+
# glossary_id
|
2998
|
+
#
|
2999
|
+
# == Returns:
|
3000
|
+
# PhraseApp::ResponseObjects::GlossaryTerm
|
3001
|
+
# err
|
3002
|
+
def glossary_terms_list(account_id, glossary_id, page, per_page)
|
3003
|
+
path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms", account_id, glossary_id)
|
3004
|
+
data_hash = {}
|
3005
|
+
post_body = nil
|
3006
|
+
|
3007
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3008
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
3009
|
+
if err != nil
|
3010
|
+
return nil, err
|
3011
|
+
end
|
3012
|
+
|
3013
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::GlossaryTerm.new(item) }, err
|
3014
|
+
end
|
3015
|
+
|
3016
|
+
# Invite a person to an account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>.
|
2473
3017
|
# API Path: /v2/accounts/:account_id/invitations
|
2474
3018
|
# == Parameters:
|
2475
3019
|
# account_id::
|
@@ -2505,7 +3049,7 @@ end
|
|
2505
3049
|
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2506
3050
|
end
|
2507
3051
|
|
2508
|
-
# Delete an existing invitation (must not be accepted yet).
|
3052
|
+
# Delete an existing invitation (must not be accepted yet). Access token scope must include <code>team.manage</code>.
|
2509
3053
|
# API Path: /v2/accounts/:account_id/invitations/:id
|
2510
3054
|
# == Parameters:
|
2511
3055
|
# account_id::
|
@@ -2529,7 +3073,7 @@ end
|
|
2529
3073
|
return err
|
2530
3074
|
end
|
2531
3075
|
|
2532
|
-
# Resend the invitation email (must not be accepted yet).
|
3076
|
+
# Resend the invitation email (must not be accepted yet). Access token scope must include <code>team.manage</code>.
|
2533
3077
|
# API Path: /v2/accounts/:account_id/invitations/:id/resend
|
2534
3078
|
# == Parameters:
|
2535
3079
|
# account_id::
|
@@ -2554,7 +3098,7 @@ end
|
|
2554
3098
|
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2555
3099
|
end
|
2556
3100
|
|
2557
|
-
# Get details on a single invitation.
|
3101
|
+
# Get details on a single invitation. Access token scope must include <code>team.manage</code>.
|
2558
3102
|
# API Path: /v2/accounts/:account_id/invitations/:id
|
2559
3103
|
# == Parameters:
|
2560
3104
|
# account_id::
|
@@ -2579,7 +3123,7 @@ end
|
|
2579
3123
|
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2580
3124
|
end
|
2581
3125
|
|
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.
|
3126
|
+
# 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. Access token scope must include <code>team.manage</code>.
|
2583
3127
|
# API Path: /v2/accounts/:account_id/invitations/:id
|
2584
3128
|
# == Parameters:
|
2585
3129
|
# account_id::
|
@@ -2617,7 +3161,7 @@ end
|
|
2617
3161
|
return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
|
2618
3162
|
end
|
2619
3163
|
|
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.
|
3164
|
+
# 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. Access token scope must include <code>team.manage</code>.
|
2621
3165
|
# API Path: /v2/accounts/:account_id/invitations
|
2622
3166
|
# == Parameters:
|
2623
3167
|
# account_id::
|
@@ -3242,7 +3786,7 @@ end
|
|
3242
3786
|
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Locale.new(item) }, err
|
3243
3787
|
end
|
3244
3788
|
|
3245
|
-
# Remove a user from the account. The user will be removed from the account but not deleted from PhraseApp.
|
3789
|
+
# Remove a user from the account. The user will be removed from the account but not deleted from PhraseApp. Access token scope must include <code>team.manage</code>.
|
3246
3790
|
# API Path: /v2/accounts/:account_id/members/:id
|
3247
3791
|
# == Parameters:
|
3248
3792
|
# account_id::
|
@@ -3266,7 +3810,7 @@ end
|
|
3266
3810
|
return err
|
3267
3811
|
end
|
3268
3812
|
|
3269
|
-
# Get details on a single user in the account.
|
3813
|
+
# Get details on a single user in the account. Access token scope must include <code>team.manage</code>.
|
3270
3814
|
# API Path: /v2/accounts/:account_id/members/:id
|
3271
3815
|
# == Parameters:
|
3272
3816
|
# account_id::
|
@@ -3291,7 +3835,7 @@ end
|
|
3291
3835
|
return PhraseApp::ResponseObjects::Member.new(JSON.load(rc.body)), err
|
3292
3836
|
end
|
3293
3837
|
|
3294
|
-
# Update user permissions in the account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them.
|
3838
|
+
# Update user permissions in the account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>.
|
3295
3839
|
# API Path: /v2/accounts/:account_id/members/:id
|
3296
3840
|
# == Parameters:
|
3297
3841
|
# account_id::
|
@@ -3329,7 +3873,7 @@ end
|
|
3329
3873
|
return PhraseApp::ResponseObjects::Member.new(JSON.load(rc.body)), err
|
3330
3874
|
end
|
3331
3875
|
|
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.
|
3876
|
+
# 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. Access token scope must include <code>team.manage</code>.
|
3333
3877
|
# API Path: /v2/accounts/:account_id/members
|
3334
3878
|
# == Parameters:
|
3335
3879
|
# account_id::
|
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.3.
|
4
|
+
version: 1.3.1
|
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-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PhraseApp API client libary
|
14
14
|
email:
|