Class: PhraseApp::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/phraseapp-ruby.rb

Overview

Usage example:

Require the gem

require 'phraseapp-ruby'

Setup Credentials for Authentication

credentials = PhraseApp::Auth::Credentials.new(token: "YOUR_ACCESS_TOKEN")

Create a client

client = PhraseApp::Client.new(credentials)

List Projects

rsp, err = client.projects_list(1, 10)
puts rsp

Create a new key

params = PhraseApp::RequestParams::TranslationKeyParams.new(:name => "foo")
rsp, err = client.key_create('YOUR_PROJECT_ID', params)
puts rsp

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ Client

Returns a new instance of Client.



2506
2507
2508
# File 'lib/phraseapp-ruby.rb', line 2506

def initialize(credentials)
  @credentials = credentials
end

Instance Method Details

#account_show(id) ⇒ Object

Get details on a single account. API Path: /api/v2/accounts/:id

Parameters:

id

id

Returns:

PhraseApp::ResponseObjects::AccountDetails
err


2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
# File 'lib/phraseapp-ruby.rb', line 2520

def (id)
  path = sprintf("/api/v2/accounts/%s", id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AccountDetails.new(JSON.load(rc.body)), err
end

#accounts_list(page, per_page) ⇒ Object

List all accounts the current user has access to. API Path: /api/v2/accounts

Parameters:

Returns:

PhraseApp::ResponseObjects::
err


2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
# File 'lib/phraseapp-ruby.rb', line 2541

def accounts_list(page, per_page)
  path = sprintf("/api/v2/accounts")
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::.new(item) }, err
end

#authorization_create(params) ⇒ Object

Create a new authorization. API Path: /api/v2/authorizations

Parameters:

params

Parameters of type PhraseApp::RequestParams::AuthorizationParams

Returns:

PhraseApp::ResponseObjects::AuthorizationWithToken
err


2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
# File 'lib/phraseapp-ruby.rb', line 2564

def authorization_create(params)
  path = sprintf("/api/v2/authorizations")
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::AuthorizationParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::AuthorizationParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AuthorizationWithToken.new(JSON.load(rc.body)), err
end

#authorization_delete(id) ⇒ Object

Delete an existing authorization. API calls using that token will stop working. API Path: /api/v2/authorizations/:id

Parameters:

id

id

Returns:

err


2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
# File 'lib/phraseapp-ruby.rb', line 2597

def authorization_delete(id)
  path = sprintf("/api/v2/authorizations/%s", id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#authorization_show(id) ⇒ Object

Get details on a single authorization. API Path: /api/v2/authorizations/:id

Parameters:

id

id

Returns:

PhraseApp::ResponseObjects::Authorization
err


2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
# File 'lib/phraseapp-ruby.rb', line 2620

def authorization_show(id)
  path = sprintf("/api/v2/authorizations/%s", id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Authorization.new(JSON.load(rc.body)), err
end

#authorization_update(id, params) ⇒ Object

Update an existing authorization. API Path: /api/v2/authorizations/:id

Parameters:

id

id

params

Parameters of type PhraseApp::RequestParams::AuthorizationParams

Returns:

PhraseApp::ResponseObjects::Authorization
err


2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
# File 'lib/phraseapp-ruby.rb', line 2645

def authorization_update(id, params)
  path = sprintf("/api/v2/authorizations/%s", id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::AuthorizationParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::AuthorizationParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Authorization.new(JSON.load(rc.body)), err
end

#authorizations_list(page, per_page) ⇒ Object

List all your authorizations. API Path: /api/v2/authorizations

Parameters:

Returns:

PhraseApp::ResponseObjects::Authorization
err


2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
# File 'lib/phraseapp-ruby.rb', line 2677

def authorizations_list(page, per_page)
  path = sprintf("/api/v2/authorizations")
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Authorization.new(item) }, err
end

#bitbucket_sync_export(id, params) ⇒ Object

Export translations from PhraseApp to Bitbucket according to the .phraseapp.yml file within the Bitbucket Repository. API Path: /api/v2/bitbucket_syncs/:id/export

Parameters:

id

id

params

Parameters of type PhraseApp::RequestParams::BitbucketSyncParams

Returns:

PhraseApp::ResponseObjects::BitbucketSyncExportResponse
err


2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
# File 'lib/phraseapp-ruby.rb', line 2702

def bitbucket_sync_export(id, params)
  path = sprintf("/api/v2/bitbucket_syncs/%s/export", id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BitbucketSyncParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BitbucketSyncParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::BitbucketSyncExportResponse.new(JSON.load(rc.body)), err
end

#bitbucket_sync_import(id, params) ⇒ Object

Import translations from Bitbucket to PhraseApp according to the .phraseapp.yml file within the Bitbucket repository. API Path: /api/v2/bitbucket_syncs/:id/import

Parameters:

id

id

params

Parameters of type PhraseApp::RequestParams::BitbucketSyncParams

Returns:

err


2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
# File 'lib/phraseapp-ruby.rb', line 2737

def bitbucket_sync_import(id, params)
  path = sprintf("/api/v2/bitbucket_syncs/%s/import", id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BitbucketSyncParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BitbucketSyncParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return err
end

#bitbucket_syncs_list(page, per_page, params) ⇒ Object

List all Bitbucket repositories for which synchronisation with PhraseApp is activated. API Path: /api/v2/bitbucket_syncs

Parameters:

params

Parameters of type PhraseApp::RequestParams::BitbucketSyncParams

Returns:

PhraseApp::ResponseObjects::BitbucketSync
err


2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
# File 'lib/phraseapp-ruby.rb', line 2771

def bitbucket_syncs_list(page, per_page, params)
  path = sprintf("/api/v2/bitbucket_syncs")
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BitbucketSyncParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BitbucketSyncParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::BitbucketSync.new(item) }, err
end

#blacklisted_key_create(project_id, params) ⇒ Object

Create a new rule for blacklisting keys. API Path: /api/v2/projects/:project_id/blacklisted_keys

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::BlacklistedKeyParams

Returns:

PhraseApp::ResponseObjects::BlacklistedKey
err


2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
# File 'lib/phraseapp-ruby.rb', line 2807

def blacklisted_key_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/blacklisted_keys", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BlacklistedKeyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BlacklistedKeyParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
end

#blacklisted_key_delete(project_id, id) ⇒ Object

Delete an existing rule for blacklisting keys. API Path: /api/v2/projects/:project_id/blacklisted_keys/:id

Parameters:

project_id

project_id

id

id

Returns:

err


2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
# File 'lib/phraseapp-ruby.rb', line 2842

def blacklisted_key_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#blacklisted_key_show(project_id, id) ⇒ Object

Get details on a single rule for blacklisting keys for a given project. API Path: /api/v2/projects/:project_id/blacklisted_keys/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::BlacklistedKey
err


2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
# File 'lib/phraseapp-ruby.rb', line 2867

def blacklisted_key_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
end

#blacklisted_key_update(project_id, id, params) ⇒ Object

Update an existing rule for blacklisting keys. API Path: /api/v2/projects/:project_id/blacklisted_keys/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::BlacklistedKeyParams

Returns:

PhraseApp::ResponseObjects::BlacklistedKey
err


2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
# File 'lib/phraseapp-ruby.rb', line 2894

def blacklisted_key_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BlacklistedKeyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BlacklistedKeyParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
end

#blacklisted_keys_list(project_id, page, per_page) ⇒ Object

List all rules for blacklisting keys for the given project. API Path: /api/v2/projects/:project_id/blacklisted_keys

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::BlacklistedKey
err


2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
# File 'lib/phraseapp-ruby.rb', line 2928

def blacklisted_keys_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/blacklisted_keys", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::BlacklistedKey.new(item) }, err
end

#branch_create(project_id, params) ⇒ Object

Create a new branch. API Path: /api/v2/projects/:project_id/branches

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::BranchParams

Returns:

PhraseApp::ResponseObjects::Branch
err


2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
# File 'lib/phraseapp-ruby.rb', line 2953

def branch_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/branches", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BranchParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BranchParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Branch.new(JSON.load(rc.body)), err
end

#branch_delete(project_id, id) ⇒ Object

Delete an existing branch. API Path: /api/v2/projects/:project_id/branches/:id

Parameters:

project_id

project_id

id

id

Returns:

err


2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
# File 'lib/phraseapp-ruby.rb', line 2988

def branch_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/branches/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#branch_merge(project_id, id, params) ⇒ Object

Merge an existing branch. API Path: /api/v2/projects/:project_id/branches/:id/merge

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::BranchMergeParams

Returns:

err


3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
# File 'lib/phraseapp-ruby.rb', line 3014

def branch_merge(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/branches/%s/merge", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BranchMergeParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BranchMergeParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return err
end

#branch_show(project_id, id) ⇒ Object

Get details on a single branch for a given project. API Path: /api/v2/projects/:project_id/branches/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::Branch
err


3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
# File 'lib/phraseapp-ruby.rb', line 3050

def branch_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/branches/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Branch.new(JSON.load(rc.body)), err
end

#branch_update(project_id, id, params) ⇒ Object

Update an existing branch. API Path: /api/v2/projects/:project_id/branches/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::BranchParams

Returns:

PhraseApp::ResponseObjects::Branch
err


3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
# File 'lib/phraseapp-ruby.rb', line 3077

def branch_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/branches/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::BranchParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BranchParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Branch.new(JSON.load(rc.body)), err
end

#branches_list(project_id, page, per_page) ⇒ Object

List all branches the of the current project. API Path: /api/v2/projects/:project_id/branches

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::Branch
err


3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
# File 'lib/phraseapp-ruby.rb', line 3111

def branches_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/branches", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Branch.new(item) }, err
end

#comment_create(project_id, key_id, params) ⇒ Object

Create a new comment for a key. API Path: /api/v2/projects/:project_id/keys/:key_id/comments

Parameters:

project_id

project_id

key_id

key_id

params

Parameters of type PhraseApp::RequestParams::CommentParams

Returns:

PhraseApp::ResponseObjects::Comment
err


3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
# File 'lib/phraseapp-ruby.rb', line 3138

def comment_create(project_id, key_id, params)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments", project_id, key_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::CommentParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
end

#comment_delete(project_id, key_id, id) ⇒ Object

Delete an existing comment. API Path: /api/v2/projects/:project_id/keys/:key_id/comments/:id

Parameters:

project_id

project_id

key_id

key_id

id

id

Returns:

err


3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
# File 'lib/phraseapp-ruby.rb', line 3175

def comment_delete(project_id, key_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#comment_mark_check(project_id, key_id, id) ⇒ Object

Check if comment was marked as read. Returns 204 if read, 404 if unread. API Path: /api/v2/projects/:project_id/keys/:key_id/comments/:id/read

Parameters:

project_id

project_id

key_id

key_id

id

id

Returns:

err


3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
# File 'lib/phraseapp-ruby.rb', line 3201

def comment_mark_check(project_id, key_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#comment_mark_read(project_id, key_id, id) ⇒ Object

Mark a comment as read. API Path: /api/v2/projects/:project_id/keys/:key_id/comments/:id/read

Parameters:

project_id

project_id

key_id

key_id

id

id

Returns:

err


3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
# File 'lib/phraseapp-ruby.rb', line 3227

def comment_mark_read(project_id, key_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#comment_mark_unread(project_id, key_id, id) ⇒ Object

Mark a comment as unread. API Path: /api/v2/projects/:project_id/keys/:key_id/comments/:id/read

Parameters:

project_id

project_id

key_id

key_id

id

id

Returns:

err


3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
# File 'lib/phraseapp-ruby.rb', line 3253

def comment_mark_unread(project_id, key_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#comment_show(project_id, key_id, id) ⇒ Object

Get details on a single comment. API Path: /api/v2/projects/:project_id/keys/:key_id/comments/:id

Parameters:

project_id

project_id

key_id

key_id

id

id

Returns:

PhraseApp::ResponseObjects::Comment
err


3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
# File 'lib/phraseapp-ruby.rb', line 3280

def comment_show(project_id, key_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
end

#comment_update(project_id, key_id, id, params) ⇒ Object

Update an existing comment. API Path: /api/v2/projects/:project_id/keys/:key_id/comments/:id

Parameters:

project_id

project_id

key_id

key_id

id

id

params

Parameters of type PhraseApp::RequestParams::CommentParams

Returns:

PhraseApp::ResponseObjects::Comment
err


3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
# File 'lib/phraseapp-ruby.rb', line 3309

def comment_update(project_id, key_id, id, params)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::CommentParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
end

#comments_list(project_id, key_id, page, per_page) ⇒ Object

List all comments for a key. API Path: /api/v2/projects/:project_id/keys/:key_id/comments

Parameters:

project_id

project_id

key_id

key_id

Returns:

PhraseApp::ResponseObjects::Comment
err


3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
# File 'lib/phraseapp-ruby.rb', line 3345

def comments_list(project_id, key_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/keys/%s/comments", project_id, key_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Comment.new(item) }, err
end

#formats_list(page, per_page) ⇒ Object

Get a handy list of all localization file formats supported in PhraseApp. API Path: /api/v2/formats

Parameters:

Returns:

PhraseApp::ResponseObjects::Format
err


3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
# File 'lib/phraseapp-ruby.rb', line 3366

def formats_list(page, per_page)
  path = sprintf("/api/v2/formats")
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Format.new(item) }, err
end

#glossaries_list(account_id, page, per_page) ⇒ Object

List all glossaries the current user has access to. API Path: /api/v2/accounts/:account_id/glossaries

Parameters:

account_id

account_id

Returns:

PhraseApp::ResponseObjects::Glossary
err


3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
# File 'lib/phraseapp-ruby.rb', line 3389

def glossaries_list(, page, per_page)
  path = sprintf("/api/v2/accounts/%s/glossaries", )
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Glossary.new(item) }, err
end

#glossary_create(account_id, params) ⇒ Object

Create a new glossary. API Path: /api/v2/accounts/:account_id/glossaries

Parameters:

account_id

account_id

params

Parameters of type PhraseApp::RequestParams::GlossaryParams

Returns:

PhraseApp::ResponseObjects::Glossary
err


3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
# File 'lib/phraseapp-ruby.rb', line 3414

def glossary_create(, params)
  path = sprintf("/api/v2/accounts/%s/glossaries", )
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::GlossaryParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Glossary.new(JSON.load(rc.body)), err
end

#glossary_delete(account_id, id) ⇒ Object

Delete an existing glossary. API Path: /api/v2/accounts/:account_id/glossaries/:id

Parameters:

account_id

account_id

id

id

Returns:

err


3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
# File 'lib/phraseapp-ruby.rb', line 3449

def glossary_delete(, id)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#glossary_show(account_id, id) ⇒ Object

Get details on a single glossary. API Path: /api/v2/accounts/:account_id/glossaries/:id

Parameters:

account_id

account_id

id

id

Returns:

PhraseApp::ResponseObjects::Glossary
err


3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
# File 'lib/phraseapp-ruby.rb', line 3474

def glossary_show(, id)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Glossary.new(JSON.load(rc.body)), err
end

#glossary_term_create(account_id, glossary_id, params) ⇒ Object

Create a new glossary term. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms

Parameters:

account_id

account_id

glossary_id

glossary_id

params

Parameters of type PhraseApp::RequestParams::GlossaryTermParams

Returns:

PhraseApp::ResponseObjects::GlossaryTerm
err


3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
# File 'lib/phraseapp-ruby.rb', line 3539

def glossary_term_create(, glossary_id, params)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms", , glossary_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err
end

#glossary_term_delete(account_id, glossary_id, id) ⇒ Object

Delete an existing glossary term. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms/:id

Parameters:

account_id

account_id

glossary_id

glossary_id

id

id

Returns:

err


3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
# File 'lib/phraseapp-ruby.rb', line 3576

def glossary_term_delete(, glossary_id, id)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", , glossary_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#glossary_term_show(account_id, glossary_id, id) ⇒ Object

Get details on a single glossary term. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms/:id

Parameters:

account_id

account_id

glossary_id

glossary_id

id

id

Returns:

PhraseApp::ResponseObjects::GlossaryTerm
err


3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
# File 'lib/phraseapp-ruby.rb', line 3603

def glossary_term_show(, glossary_id, id)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", , glossary_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err
end

#glossary_term_translation_create(account_id, glossary_id, term_id, params) ⇒ Object

Create a new glossary term translation. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms/:term_id/translations

Parameters:

account_id

account_id

glossary_id

glossary_id

term_id

term_id

params

Parameters of type PhraseApp::RequestParams::GlossaryTermTranslationParams

Returns:

PhraseApp::ResponseObjects::GlossaryTermTranslation
err


3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
# File 'lib/phraseapp-ruby.rb', line 3672

def glossary_term_translation_create(, glossary_id, term_id, params)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations", , glossary_id, term_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermTranslationParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermTranslationParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::GlossaryTermTranslation.new(JSON.load(rc.body)), err
end

#glossary_term_translation_delete(account_id, glossary_id, term_id, id) ⇒ Object

Delete an existing glossary term translation. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms/:term_id/translations/:id

Parameters:

account_id

account_id

glossary_id

glossary_id

term_id

term_id

id

id

Returns:

err


3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
# File 'lib/phraseapp-ruby.rb', line 3711

def glossary_term_translation_delete(, glossary_id, term_id, id)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations/%s", , glossary_id, term_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#glossary_term_translation_update(account_id, glossary_id, term_id, id, params) ⇒ Object

Update an existing glossary term translation. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms/:term_id/translations/:id

Parameters:

account_id

account_id

glossary_id

glossary_id

term_id

term_id

id

id

params

Parameters of type PhraseApp::RequestParams::GlossaryTermTranslationParams

Returns:

PhraseApp::ResponseObjects::GlossaryTermTranslation
err


3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
# File 'lib/phraseapp-ruby.rb', line 3742

def glossary_term_translation_update(, glossary_id, term_id, id, params)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations/%s", , glossary_id, term_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermTranslationParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermTranslationParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::GlossaryTermTranslation.new(JSON.load(rc.body)), err
end

#glossary_term_update(account_id, glossary_id, id, params) ⇒ Object

Update an existing glossary term. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms/:id

Parameters:

account_id

account_id

glossary_id

glossary_id

id

id

params

Parameters of type PhraseApp::RequestParams::GlossaryTermParams

Returns:

PhraseApp::ResponseObjects::GlossaryTerm
err


3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
# File 'lib/phraseapp-ruby.rb', line 3632

def glossary_term_update(, glossary_id, id, params)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", , glossary_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::GlossaryTermParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryTermParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err
end

#glossary_terms_list(account_id, glossary_id, page, per_page) ⇒ Object

List all glossary terms the current user has access to. API Path: /api/v2/accounts/:account_id/glossaries/:glossary_id/terms

Parameters:

account_id

account_id

glossary_id

glossary_id

Returns:

PhraseApp::ResponseObjects::GlossaryTerm
err


3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
# File 'lib/phraseapp-ruby.rb', line 3778

def glossary_terms_list(, glossary_id, page, per_page)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms", , glossary_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::GlossaryTerm.new(item) }, err
end

#glossary_update(account_id, id, params) ⇒ Object

Update an existing glossary. API Path: /api/v2/accounts/:account_id/glossaries/:id

Parameters:

account_id

account_id

id

id

params

Parameters of type PhraseApp::RequestParams::GlossaryParams

Returns:

PhraseApp::ResponseObjects::Glossary
err


3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
# File 'lib/phraseapp-ruby.rb', line 3501

def glossary_update(, id, params)
  path = sprintf("/api/v2/accounts/%s/glossaries/%s", , id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::GlossaryParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::GlossaryParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Glossary.new(JSON.load(rc.body)), err
end

#invitation_create(account_id, params) ⇒ Object

Invite a person to an account. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/invitations

Parameters:

account_id

account_id

params

Parameters of type PhraseApp::RequestParams::InvitationCreateParams

Returns:

PhraseApp::ResponseObjects::Invitation
err


3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
# File 'lib/phraseapp-ruby.rb', line 3803

def invitation_create(, params)
  path = sprintf("/api/v2/accounts/%s/invitations", )
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::InvitationCreateParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::InvitationCreateParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
end

#invitation_delete(account_id, id) ⇒ Object

Delete an existing invitation (must not be accepted yet). Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/invitations/:id

Parameters:

account_id

account_id

id

id

Returns:

err


3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
# File 'lib/phraseapp-ruby.rb', line 3838

def invitation_delete(, id)
  path = sprintf("/api/v2/accounts/%s/invitations/%s", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#invitation_resend(account_id, id) ⇒ Object

Resend the invitation email (must not be accepted yet). Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/invitations/:id/resend

Parameters:

account_id

account_id

id

id

Returns:

PhraseApp::ResponseObjects::Invitation
err


3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
# File 'lib/phraseapp-ruby.rb', line 3863

def invitation_resend(, id)
  path = sprintf("/api/v2/accounts/%s/invitations/%s/resend", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
end

#invitation_show(account_id, id) ⇒ Object

Get details on a single invitation. Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/invitations/:id

Parameters:

account_id

account_id

id

id

Returns:

PhraseApp::ResponseObjects::Invitation
err


3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
# File 'lib/phraseapp-ruby.rb', line 3888

def invitation_show(, id)
  path = sprintf("/api/v2/accounts/%s/invitations/%s", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
end

#invitation_update(account_id, id, params) ⇒ Object

Update an existing invitation (must not be accepted yet). The email cannot be updated. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/invitations/:id

Parameters:

account_id

account_id

id

id

params

Parameters of type PhraseApp::RequestParams::InvitationUpdateParams

Returns:

PhraseApp::ResponseObjects::Invitation
err


3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
# File 'lib/phraseapp-ruby.rb', line 3915

def invitation_update(, id, params)
  path = sprintf("/api/v2/accounts/%s/invitations/%s", , id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::InvitationUpdateParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::InvitationUpdateParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Invitation.new(JSON.load(rc.body)), err
end

#invitations_list(account_id, page, per_page) ⇒ Object

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 team.manage. API Path: /api/v2/accounts/:account_id/invitations

Parameters:

account_id

account_id

Returns:

PhraseApp::ResponseObjects::Invitation
err


3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
# File 'lib/phraseapp-ruby.rb', line 3949

def invitations_list(, page, per_page)
  path = sprintf("/api/v2/accounts/%s/invitations", )
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Invitation.new(item) }, err
end

#job_complete(project_id, id) ⇒ Object

Mark a job as completed. API Path: /api/v2/projects/:project_id/jobs/:id/complete

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::JobDetails
err


3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
# File 'lib/phraseapp-ruby.rb', line 3974

def job_complete(project_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/complete", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#job_create(project_id, params) ⇒ Object

Create a new job. API Path: /api/v2/projects/:project_id/jobs

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::JobParams

Returns:

PhraseApp::ResponseObjects::JobDetails
err


3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
# File 'lib/phraseapp-ruby.rb', line 3999

def job_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/jobs", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#job_delete(project_id, id) ⇒ Object

Delete an existing job. API Path: /api/v2/projects/:project_id/jobs/:id

Parameters:

project_id

project_id

id

id

Returns:

err


4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
# File 'lib/phraseapp-ruby.rb', line 4034

def job_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#job_keys_create(project_id, id, params) ⇒ Object

Add multiple keys to a existing job. API Path: /api/v2/projects/:project_id/jobs/:id/keys

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::JobKeysCreateParams

Returns:

PhraseApp::ResponseObjects::JobDetails
err


4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
# File 'lib/phraseapp-ruby.rb', line 4061

def job_keys_create(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/jobs/%s/keys", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobKeysCreateParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobKeysCreateParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#job_keys_delete(project_id, id, params) ⇒ Object

Remove multiple keys from existing job. API Path: /api/v2/projects/:project_id/jobs/:id/keys

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::JobKeysDeleteParams

Returns:

err


4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
# File 'lib/phraseapp-ruby.rb', line 4098

def job_keys_delete(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/jobs/%s/keys", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobKeysDeleteParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobKeysDeleteParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#job_locale_complete(project_id, job_id, id) ⇒ Object

Mark a job locale as completed. API Path: /api/v2/projects/:project_id/jobs/:job_id/locales/:id/complete

Parameters:

project_id

project_id

job_id

job_id

id

id

Returns:

PhraseApp::ResponseObjects::JobLocale
err


4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
# File 'lib/phraseapp-ruby.rb', line 4249

def job_locale_complete(project_id, job_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s/complete", project_id, job_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
end

#job_locale_delete(project_id, job_id, id) ⇒ Object

Delete an existing job locale. API Path: /api/v2/projects/:project_id/jobs/:job_id/locales/:id

Parameters:

project_id

project_id

job_id

job_id

id

id

Returns:

err


4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
# File 'lib/phraseapp-ruby.rb', line 4275

def job_locale_delete(project_id, job_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s", project_id, job_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#job_locale_reopen(project_id, job_id, id) ⇒ Object

Mark a job locale as uncompleted. API Path: /api/v2/projects/:project_id/jobs/:job_id/locales/:id/reopen

Parameters:

project_id

project_id

job_id

job_id

id

id

Returns:

PhraseApp::ResponseObjects::JobLocale
err


4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
# File 'lib/phraseapp-ruby.rb', line 4302

def job_locale_reopen(project_id, job_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s/reopen", project_id, job_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
end

#job_locale_show(project_id, job_id, id) ⇒ Object

Get a single job locale for a given job. API Path: /api/v2/projects/:project_id/jobs/:job_id/locale/:id

Parameters:

project_id

project_id

job_id

job_id

id

id

Returns:

PhraseApp::ResponseObjects::JobLocale
err


4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
# File 'lib/phraseapp-ruby.rb', line 4329

def job_locale_show(project_id, job_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locale/%s", project_id, job_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
end

#job_locale_update(project_id, job_id, id, params) ⇒ Object

Update an existing job locale. API Path: /api/v2/projects/:project_id/jobs/:job_id/locales/:id

Parameters:

project_id

project_id

job_id

job_id

id

id

params

Parameters of type PhraseApp::RequestParams::JobLocaleParams

Returns:

PhraseApp::ResponseObjects::JobLocale
err


4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
# File 'lib/phraseapp-ruby.rb', line 4358

def job_locale_update(project_id, job_id, id, params)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s", project_id, job_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobLocaleParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
end

#job_locales_create(project_id, job_id, params) ⇒ Object

Create a new job locale. API Path: /api/v2/projects/:project_id/jobs/:job_id/locales

Parameters:

project_id

project_id

job_id

job_id

params

Parameters of type PhraseApp::RequestParams::JobLocaleParams

Returns:

PhraseApp::ResponseObjects::JobLocale
err


4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
# File 'lib/phraseapp-ruby.rb', line 4396

def job_locales_create(project_id, job_id, params)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locales", project_id, job_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobLocaleParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
end

#job_locales_list(project_id, job_id, page, per_page) ⇒ Object

List all job locales for a given job. API Path: /api/v2/projects/:project_id/jobs/:job_id/locales

Parameters:

project_id

project_id

job_id

job_id

Returns:

PhraseApp::ResponseObjects::JobLocale
err


4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
# File 'lib/phraseapp-ruby.rb', line 4432

def job_locales_list(project_id, job_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/jobs/%s/locales", project_id, job_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::JobLocale.new(item) }, err
end

#job_reopen(project_id, id) ⇒ Object

Mark a job as uncompleted. API Path: /api/v2/projects/:project_id/jobs/:id/reopen

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::JobDetails
err


4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
# File 'lib/phraseapp-ruby.rb', line 4134

def job_reopen(project_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/reopen", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#job_show(project_id, id) ⇒ Object

Get details on a single job for a given project. API Path: /api/v2/projects/:project_id/jobs/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::JobDetails
err


4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
# File 'lib/phraseapp-ruby.rb', line 4159

def job_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#job_start(project_id, id) ⇒ Object

Starts an existing job in state draft. API Path: /api/v2/projects/:project_id/jobs/:id/start

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::JobDetails
err


4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
# File 'lib/phraseapp-ruby.rb', line 4184

def job_start(project_id, id)
  path = sprintf("/api/v2/projects/%s/jobs/%s/start", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#job_update(project_id, id, params) ⇒ Object

Update an existing job. API Path: /api/v2/projects/:project_id/jobs/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::JobUpdateParams

Returns:

PhraseApp::ResponseObjects::JobDetails
err


4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
# File 'lib/phraseapp-ruby.rb', line 4211

def job_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/jobs/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobUpdateParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobUpdateParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
end

#jobs_list(project_id, page, per_page, params) ⇒ Object

List all jobs for the given project. API Path: /api/v2/projects/:project_id/jobs

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::JobsListParams

Returns:

PhraseApp::ResponseObjects::Job
err


4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
# File 'lib/phraseapp-ruby.rb', line 4457

def jobs_list(project_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/jobs", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::JobsListParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobsListParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Job.new(item) }, err
end

#key_create(project_id, params) ⇒ Object

Create a new key. API Path: /api/v2/projects/:project_id/keys

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationKeyParams

Returns:

PhraseApp::ResponseObjects::TranslationKeyDetails
err


4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
# File 'lib/phraseapp-ruby.rb', line 4493

def key_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/keys", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationKeyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationKeyParams")
    end
  end
  if params.data_type != nil
    data_hash["data_type"] = params.data_type
  end

  if params.description != nil
    data_hash["description"] = params.description
  end

  if params.localized_format_key != nil
    data_hash["localized_format_key"] = params.localized_format_key
  end

  if params.localized_format_string != nil
    data_hash["localized_format_string"] = params.localized_format_string
  end

  if params.max_characters_allowed != nil
    data_hash["max_characters_allowed"] = params.max_characters_allowed.to_i
  end

  if params.name != nil
    data_hash["name"] = params.name
  end

  if params.name_plural != nil
    data_hash["name_plural"] = params.name_plural
  end

  if params.original_file != nil
    data_hash["original_file"] = params.original_file
  end

  if params.plural != nil
    data_hash["plural"] = (params.plural == true)
  end

  if params.remove_screenshot != nil
    data_hash["remove_screenshot"] = (params.remove_screenshot == true)
  end

  if params.screenshot != nil
    post_body = []
    post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
    post_body << "Content-Disposition: form-data; name=\"screenshot\"; filename=\"#{File.basename(params.screenshot )}\"\r\n"
    post_body << "Content-Type: text/plain\r\n"
    post_body << "\r\n"
    post_body << File.read(params.screenshot)
    post_body << "\r\n"
  end

  if params.tags != nil
    data_hash["tags"] = params.tags
  end

  if params.unformatted != nil
    data_hash["unformatted"] = (params.unformatted == true)
  end

  if params.xml_space_preserve != nil
    data_hash["xml_space_preserve"] = (params.xml_space_preserve == true)
  end

  
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationKeyDetails.new(JSON.load(rc.body)), err
end

#key_delete(project_id, id) ⇒ Object

Delete an existing key. API Path: /api/v2/projects/:project_id/keys/:id

Parameters:

project_id

project_id

id

id

Returns:

err


4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
# File 'lib/phraseapp-ruby.rb', line 4586

def key_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#key_show(project_id, id) ⇒ Object

Get details on a single key for a given project. API Path: /api/v2/projects/:project_id/keys/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::TranslationKeyDetails
err


4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
# File 'lib/phraseapp-ruby.rb', line 4611

def key_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/keys/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationKeyDetails.new(JSON.load(rc.body)), err
end

#key_update(project_id, id, params) ⇒ Object

Update an existing key. API Path: /api/v2/projects/:project_id/keys/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::TranslationKeyParams

Returns:

PhraseApp::ResponseObjects::TranslationKeyDetails
err


4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
# File 'lib/phraseapp-ruby.rb', line 4638

def key_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/keys/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationKeyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationKeyParams")
    end
  end
  if params.data_type != nil
    data_hash["data_type"] = params.data_type
  end

  if params.description != nil
    data_hash["description"] = params.description
  end

  if params.localized_format_key != nil
    data_hash["localized_format_key"] = params.localized_format_key
  end

  if params.localized_format_string != nil
    data_hash["localized_format_string"] = params.localized_format_string
  end

  if params.max_characters_allowed != nil
    data_hash["max_characters_allowed"] = params.max_characters_allowed.to_i
  end

  if params.name != nil
    data_hash["name"] = params.name
  end

  if params.name_plural != nil
    data_hash["name_plural"] = params.name_plural
  end

  if params.original_file != nil
    data_hash["original_file"] = params.original_file
  end

  if params.plural != nil
    data_hash["plural"] = (params.plural == true)
  end

  if params.remove_screenshot != nil
    data_hash["remove_screenshot"] = (params.remove_screenshot == true)
  end

  if params.screenshot != nil
    post_body = []
    post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
    post_body << "Content-Disposition: form-data; name=\"screenshot\"; filename=\"#{File.basename(params.screenshot )}\"\r\n"
    post_body << "Content-Type: text/plain\r\n"
    post_body << "\r\n"
    post_body << File.read(params.screenshot)
    post_body << "\r\n"
  end

  if params.tags != nil
    data_hash["tags"] = params.tags
  end

  if params.unformatted != nil
    data_hash["unformatted"] = (params.unformatted == true)
  end

  if params.xml_space_preserve != nil
    data_hash["xml_space_preserve"] = (params.xml_space_preserve == true)
  end

  
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationKeyDetails.new(JSON.load(rc.body)), err
end

#keys_delete(project_id, params) ⇒ Object

Delete all keys matching query. Same constraints as list. Please limit the number of affected keys to about 1,000 as you might experience timeouts otherwise. API Path: /api/v2/projects/:project_id/keys

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::KeysDeleteParams

Returns:

PhraseApp::ResponseObjects::AffectedResources
err


4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
# File 'lib/phraseapp-ruby.rb', line 4732

def keys_delete(project_id, params)
  path = sprintf("/api/v2/projects/%s/keys", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::KeysDeleteParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeysDeleteParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedResources.new(JSON.load(rc.body)), err
end

#keys_list(project_id, page, per_page, params) ⇒ Object

List all keys for the given project. Alternatively you can POST requests to /search. API Path: /api/v2/projects/:project_id/keys

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::KeysListParams

Returns:

PhraseApp::ResponseObjects::TranslationKey
err


4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
# File 'lib/phraseapp-ruby.rb', line 4768

def keys_list(project_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/keys", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::KeysListParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeysListParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::TranslationKey.new(item) }, err
end

#keys_search(project_id, page, per_page, params) ⇒ Object

Search keys for the given project matching query. API Path: /api/v2/projects/:project_id/keys/search

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::KeysSearchParams

Returns:

PhraseApp::ResponseObjects::TranslationKey
err


4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
# File 'lib/phraseapp-ruby.rb', line 4804

def keys_search(project_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/keys/search", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::KeysSearchParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeysSearchParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::TranslationKey.new(item) }, err
end

#keys_tag(project_id, params) ⇒ Object

Tags all keys matching query. Same constraints as list. API Path: /api/v2/projects/:project_id/keys/tag

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::KeysTagParams

Returns:

PhraseApp::ResponseObjects::AffectedResources
err


4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
# File 'lib/phraseapp-ruby.rb', line 4840

def keys_tag(project_id, params)
  path = sprintf("/api/v2/projects/%s/keys/tag", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::KeysTagParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeysTagParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedResources.new(JSON.load(rc.body)), err
end

#keys_untag(project_id, params) ⇒ Object

Removes specified tags from keys matching query. API Path: /api/v2/projects/:project_id/keys/untag

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::KeysUntagParams

Returns:

PhraseApp::ResponseObjects::AffectedResources
err


4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
# File 'lib/phraseapp-ruby.rb', line 4876

def keys_untag(project_id, params)
  path = sprintf("/api/v2/projects/%s/keys/untag", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::KeysUntagParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeysUntagParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedResources.new(JSON.load(rc.body)), err
end

#locale_create(project_id, params) ⇒ Object

Create a new locale. API Path: /api/v2/projects/:project_id/locales

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::LocaleParams

Returns:

PhraseApp::ResponseObjects::LocaleDetails
err


4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
# File 'lib/phraseapp-ruby.rb', line 4912

def locale_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/locales", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::LocaleParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::LocaleParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::LocaleDetails.new(JSON.load(rc.body)), err
end

#locale_delete(project_id, id) ⇒ Object

Delete an existing locale. API Path: /api/v2/projects/:project_id/locales/:id

Parameters:

project_id

project_id

id

id

Returns:

err


4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
# File 'lib/phraseapp-ruby.rb', line 4947

def locale_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/locales/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#locale_download(project_id, id, params) ⇒ Object

Download a locale in a specific file format. API Path: /api/v2/projects/:project_id/locales/:id/download

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::LocaleDownloadParams

Returns:

err


4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
# File 'lib/phraseapp-ruby.rb', line 4973

def locale_download(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/locales/%s/download", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::LocaleDownloadParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::LocaleDownloadParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  return rc.body
  return err
end

#locale_show(project_id, id, params) ⇒ Object

Get details on a single locale for a given project. API Path: /api/v2/projects/:project_id/locales/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::LocaleShowParams

Returns:

PhraseApp::ResponseObjects::LocaleDetails
err


5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
# File 'lib/phraseapp-ruby.rb', line 5011

def locale_show(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/locales/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::LocaleShowParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::LocaleShowParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::LocaleDetails.new(JSON.load(rc.body)), err
end

#locale_update(project_id, id, params) ⇒ Object

Update an existing locale. API Path: /api/v2/projects/:project_id/locales/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::LocaleParams

Returns:

PhraseApp::ResponseObjects::LocaleDetails
err


5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
# File 'lib/phraseapp-ruby.rb', line 5049

def locale_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/locales/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::LocaleParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::LocaleParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::LocaleDetails.new(JSON.load(rc.body)), err
end

#locales_list(project_id, page, per_page, params) ⇒ Object

List all locales for the given project. API Path: /api/v2/projects/:project_id/locales

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::LocalesListParams

Returns:

PhraseApp::ResponseObjects::Locale
err


5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
# File 'lib/phraseapp-ruby.rb', line 5085

def locales_list(project_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/locales", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::LocalesListParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::LocalesListParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Locale.new(item) }, err
end

#member_delete(account_id, id) ⇒ Object

Remove a user from the account. The user will be removed from the account but not deleted from PhraseApp. Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/members/:id

Parameters:

account_id

account_id

id

id

Returns:

err


5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
# File 'lib/phraseapp-ruby.rb', line 5120

def member_delete(, id)
  path = sprintf("/api/v2/accounts/%s/members/%s", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#member_show(account_id, id) ⇒ Object

Get details on a single user in the account. Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/members/:id

Parameters:

account_id

account_id

id

id

Returns:

PhraseApp::ResponseObjects::Member
err


5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
# File 'lib/phraseapp-ruby.rb', line 5145

def member_show(, id)
  path = sprintf("/api/v2/accounts/%s/members/%s", , id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Member.new(JSON.load(rc.body)), err
end

#member_update(account_id, id, params) ⇒ Object

Update user permissions in the account. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. API Path: /api/v2/accounts/:account_id/members/:id

Parameters:

account_id

account_id

id

id

params

Parameters of type PhraseApp::RequestParams::MemberUpdateParams

Returns:

PhraseApp::ResponseObjects::Member
err


5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
# File 'lib/phraseapp-ruby.rb', line 5172

def member_update(, id, params)
  path = sprintf("/api/v2/accounts/%s/members/%s", , id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::MemberUpdateParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::MemberUpdateParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Member.new(JSON.load(rc.body)), err
end

#members_list(account_id, page, per_page) ⇒ Object

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 team.manage. API Path: /api/v2/accounts/:account_id/members

Parameters:

account_id

account_id

Returns:

PhraseApp::ResponseObjects::Member
err


5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
# File 'lib/phraseapp-ruby.rb', line 5206

def members_list(, page, per_page)
  path = sprintf("/api/v2/accounts/%s/members", )
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Member.new(item) }, err
end

#order_confirm(project_id, id) ⇒ Object

Confirm an existing order and send it to the provider for translation. Same constraints as for create. API Path: /api/v2/projects/:project_id/orders/:id/confirm

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::TranslationOrder
err


5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
# File 'lib/phraseapp-ruby.rb', line 5231

def order_confirm(project_id, id)
  path = sprintf("/api/v2/projects/%s/orders/%s/confirm", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationOrder.new(JSON.load(rc.body)), err
end

#order_create(project_id, params) ⇒ Object

Create a new order. Access token scope must include orders.create. API Path: /api/v2/projects/:project_id/orders

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationOrderParams

Returns:

PhraseApp::ResponseObjects::TranslationOrder
err


5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
# File 'lib/phraseapp-ruby.rb', line 5256

def order_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/orders", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationOrderParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationOrderParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationOrder.new(JSON.load(rc.body)), err
end

#order_delete(project_id, id) ⇒ Object

Cancel an existing order. Must not yet be confirmed. API Path: /api/v2/projects/:project_id/orders/:id

Parameters:

project_id

project_id

id

id

Returns:

err


5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
# File 'lib/phraseapp-ruby.rb', line 5291

def order_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/orders/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#order_show(project_id, id) ⇒ Object

Get details on a single order. API Path: /api/v2/projects/:project_id/orders/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::TranslationOrder
err


5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
# File 'lib/phraseapp-ruby.rb', line 5316

def order_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/orders/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationOrder.new(JSON.load(rc.body)), err
end

#orders_list(project_id, page, per_page) ⇒ Object

List all orders for the given project. API Path: /api/v2/projects/:project_id/orders

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::TranslationOrder
err


5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
# File 'lib/phraseapp-ruby.rb', line 5339

def orders_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/orders", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::TranslationOrder.new(item) }, err
end

#project_create(params) ⇒ Object

Create a new project. API Path: /api/v2/projects

Parameters:

params

Parameters of type PhraseApp::RequestParams::ProjectParams

Returns:

PhraseApp::ResponseObjects::ProjectDetails
err


5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
# File 'lib/phraseapp-ruby.rb', line 5362

def project_create(params)
  path = sprintf("/api/v2/projects")
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::ProjectParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ProjectParams")
    end
  end
  if params. != nil
    data_hash["account_id"] = params.
  end

  if params.main_format != nil
    data_hash["main_format"] = params.main_format
  end

  if params.name != nil
    data_hash["name"] = params.name
  end

  if params.project_image != nil
    post_body = []
    post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
    post_body << "Content-Disposition: form-data; name=\"project_image\"; filename=\"#{File.basename(params.project_image )}\"\r\n"
    post_body << "Content-Type: text/plain\r\n"
    post_body << "\r\n"
    post_body << File.read(params.project_image)
    post_body << "\r\n"
  end

  if params.remove_project_image != nil
    data_hash["remove_project_image"] = (params.remove_project_image == true)
  end

  if params.shares_translation_memory != nil
    data_hash["shares_translation_memory"] = (params.shares_translation_memory == true)
  end

  
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::ProjectDetails.new(JSON.load(rc.body)), err
end

#project_delete(id) ⇒ Object

Delete an existing project. API Path: /api/v2/projects/:id

Parameters:

id

id

Returns:

err


5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
# File 'lib/phraseapp-ruby.rb', line 5421

def project_delete(id)
  path = sprintf("/api/v2/projects/%s", id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#project_show(id) ⇒ Object

Get details on a single project. API Path: /api/v2/projects/:id

Parameters:

id

id

Returns:

PhraseApp::ResponseObjects::ProjectDetails
err


5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
# File 'lib/phraseapp-ruby.rb', line 5444

def project_show(id)
  path = sprintf("/api/v2/projects/%s", id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::ProjectDetails.new(JSON.load(rc.body)), err
end

#project_update(id, params) ⇒ Object

Update an existing project. API Path: /api/v2/projects/:id

Parameters:

id

id

params

Parameters of type PhraseApp::RequestParams::ProjectParams

Returns:

PhraseApp::ResponseObjects::ProjectDetails
err


5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
# File 'lib/phraseapp-ruby.rb', line 5469

def project_update(id, params)
  path = sprintf("/api/v2/projects/%s", id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::ProjectParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ProjectParams")
    end
  end
  if params. != nil
    data_hash["account_id"] = params.
  end

  if params.main_format != nil
    data_hash["main_format"] = params.main_format
  end

  if params.name != nil
    data_hash["name"] = params.name
  end

  if params.project_image != nil
    post_body = []
    post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
    post_body << "Content-Disposition: form-data; name=\"project_image\"; filename=\"#{File.basename(params.project_image )}\"\r\n"
    post_body << "Content-Type: text/plain\r\n"
    post_body << "\r\n"
    post_body << File.read(params.project_image)
    post_body << "\r\n"
  end

  if params.remove_project_image != nil
    data_hash["remove_project_image"] = (params.remove_project_image == true)
  end

  if params.shares_translation_memory != nil
    data_hash["shares_translation_memory"] = (params.shares_translation_memory == true)
  end

  
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::ProjectDetails.new(JSON.load(rc.body)), err
end

#projects_list(page, per_page) ⇒ Object

List all projects the current user has access to. API Path: /api/v2/projects

Parameters:

Returns:

PhraseApp::ResponseObjects::Project
err


5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
# File 'lib/phraseapp-ruby.rb', line 5527

def projects_list(page, per_page)
  path = sprintf("/api/v2/projects")
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Project.new(item) }, err
end

#show_userObject

Show details for current User. API Path: /api/v2/user

Parameters:

Returns:

PhraseApp::ResponseObjects::User
err


5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
# File 'lib/phraseapp-ruby.rb', line 5548

def show_user()
  path = sprintf("/api/v2/user")
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::User.new(JSON.load(rc.body)), err
end

#styleguide_create(project_id, params) ⇒ Object

Create a new style guide. API Path: /api/v2/projects/:project_id/styleguides

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::StyleguideParams

Returns:

PhraseApp::ResponseObjects::StyleguideDetails
err


5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
# File 'lib/phraseapp-ruby.rb', line 5573

def styleguide_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/styleguides", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::StyleguideParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::StyleguideParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::StyleguideDetails.new(JSON.load(rc.body)), err
end

#styleguide_delete(project_id, id) ⇒ Object

Delete an existing style guide. API Path: /api/v2/projects/:project_id/styleguides/:id

Parameters:

project_id

project_id

id

id

Returns:

err


5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
# File 'lib/phraseapp-ruby.rb', line 5608

def styleguide_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/styleguides/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#styleguide_show(project_id, id) ⇒ Object

Get details on a single style guide. API Path: /api/v2/projects/:project_id/styleguides/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::StyleguideDetails
err


5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
# File 'lib/phraseapp-ruby.rb', line 5633

def styleguide_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/styleguides/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::StyleguideDetails.new(JSON.load(rc.body)), err
end

#styleguide_update(project_id, id, params) ⇒ Object

Update an existing style guide. API Path: /api/v2/projects/:project_id/styleguides/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::StyleguideParams

Returns:

PhraseApp::ResponseObjects::StyleguideDetails
err


5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
# File 'lib/phraseapp-ruby.rb', line 5660

def styleguide_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/styleguides/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::StyleguideParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::StyleguideParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::StyleguideDetails.new(JSON.load(rc.body)), err
end

#styleguides_list(project_id, page, per_page) ⇒ Object

List all styleguides for the given project. API Path: /api/v2/projects/:project_id/styleguides

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::Styleguide
err


5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
# File 'lib/phraseapp-ruby.rb', line 5694

def styleguides_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/styleguides", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Styleguide.new(item) }, err
end

#tag_create(project_id, params) ⇒ Object

Create a new tag. API Path: /api/v2/projects/:project_id/tags

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TagParams

Returns:

PhraseApp::ResponseObjects::TagWithStats
err


5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
# File 'lib/phraseapp-ruby.rb', line 5719

def tag_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/tags", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TagParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TagParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TagWithStats.new(JSON.load(rc.body)), err
end

#tag_delete(project_id, name) ⇒ Object

Delete an existing tag. API Path: /api/v2/projects/:project_id/tags/:name

Parameters:

project_id

project_id

name

name

Returns:

err


5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
# File 'lib/phraseapp-ruby.rb', line 5754

def tag_delete(project_id, name)
  path = sprintf("/api/v2/projects/%s/tags/%s", project_id, name)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#tag_show(project_id, name) ⇒ Object

Get details and progress information on a single tag for a given project. API Path: /api/v2/projects/:project_id/tags/:name

Parameters:

project_id

project_id

name

name

Returns:

PhraseApp::ResponseObjects::TagWithStats
err


5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
# File 'lib/phraseapp-ruby.rb', line 5779

def tag_show(project_id, name)
  path = sprintf("/api/v2/projects/%s/tags/%s", project_id, name)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TagWithStats.new(JSON.load(rc.body)), err
end

#tags_list(project_id, page, per_page) ⇒ Object

List all tags for the given project. API Path: /api/v2/projects/:project_id/tags

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::Tag
err


5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
# File 'lib/phraseapp-ruby.rb', line 5802

def tags_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/tags", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Tag.new(item) }, err
end

#translation_create(project_id, params) ⇒ Object

Create a translation. API Path: /api/v2/projects/:project_id/translations

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationParams

Returns:

PhraseApp::ResponseObjects::TranslationDetails
err


5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
# File 'lib/phraseapp-ruby.rb', line 5827

def translation_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/translations", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationDetails.new(JSON.load(rc.body)), err
end

#translation_show(project_id, id) ⇒ Object

Get details on a single translation. API Path: /api/v2/projects/:project_id/translations/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::TranslationDetails
err


5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
# File 'lib/phraseapp-ruby.rb', line 5863

def translation_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/translations/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationDetails.new(JSON.load(rc.body)), err
end

#translation_update(project_id, id, params) ⇒ Object

Update an existing translation. API Path: /api/v2/projects/:project_id/translations/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::TranslationUpdateParams

Returns:

PhraseApp::ResponseObjects::TranslationDetails
err


5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
# File 'lib/phraseapp-ruby.rb', line 5890

def translation_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/translations/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationUpdateParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationUpdateParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationDetails.new(JSON.load(rc.body)), err
end

#translations_by_key(project_id, key_id, page, per_page, params) ⇒ Object

List translations for a specific key. API Path: /api/v2/projects/:project_id/keys/:key_id/translations

Parameters:

project_id

project_id

key_id

key_id

params

Parameters of type PhraseApp::RequestParams::TranslationsByKeyParams

Returns:

PhraseApp::ResponseObjects::Translation
err


5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
# File 'lib/phraseapp-ruby.rb', line 5928

def translations_by_key(project_id, key_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/keys/%s/translations", project_id, key_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsByKeyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsByKeyParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Translation.new(item) }, err
end

#translations_by_locale(project_id, locale_id, page, per_page, params) ⇒ Object

List translations for a specific locale. If you want to download all translations for one locale we recommend to use the locales#download endpoint. API Path: /api/v2/projects/:project_id/locales/:locale_id/translations

Parameters:

project_id

project_id

locale_id

locale_id

params

Parameters of type PhraseApp::RequestParams::TranslationsByLocaleParams

Returns:

PhraseApp::ResponseObjects::Translation
err


5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
# File 'lib/phraseapp-ruby.rb', line 5966

def translations_by_locale(project_id, locale_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/locales/%s/translations", project_id, locale_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsByLocaleParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsByLocaleParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Translation.new(item) }, err
end

#translations_exclude(project_id, params) ⇒ Object

Exclude translations matching query from locale export. API Path: /api/v2/projects/:project_id/translations/exclude

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationsExcludeParams

Returns:

PhraseApp::ResponseObjects::AffectedCount
err


6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
# File 'lib/phraseapp-ruby.rb', line 6002

def translations_exclude(project_id, params)
  path = sprintf("/api/v2/projects/%s/translations/exclude", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsExcludeParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsExcludeParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedCount.new(JSON.load(rc.body)), err
end

#translations_include(project_id, params) ⇒ Object

Include translations matching query in locale export. API Path: /api/v2/projects/:project_id/translations/include

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationsIncludeParams

Returns:

PhraseApp::ResponseObjects::AffectedCount
err


6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
# File 'lib/phraseapp-ruby.rb', line 6038

def translations_include(project_id, params)
  path = sprintf("/api/v2/projects/%s/translations/include", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsIncludeParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsIncludeParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedCount.new(JSON.load(rc.body)), err
end

#translations_list(project_id, page, per_page, params) ⇒ Object

List translations for the given project. If you want to download all translations for one locale we recommend to use the locales#download endpoint. API Path: /api/v2/projects/:project_id/translations

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationsListParams

Returns:

PhraseApp::ResponseObjects::Translation
err


6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
# File 'lib/phraseapp-ruby.rb', line 6074

def translations_list(project_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/translations", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsListParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsListParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Translation.new(item) }, err
end

#translations_search(project_id, page, per_page, params) ⇒ Object

List translations for the given project if you exceed GET request limitations on translations list. If you want to download all translations for one locale we recommend to use the locales#download endpoint. API Path: /api/v2/projects/:project_id/translations/search

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationsSearchParams

Returns:

PhraseApp::ResponseObjects::Translation
err


6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
# File 'lib/phraseapp-ruby.rb', line 6110

def translations_search(project_id, page, per_page, params)
  path = sprintf("/api/v2/projects/%s/translations/search", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsSearchParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsSearchParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Translation.new(item) }, err
end

#translations_unverify(project_id, params) ⇒ Object

<div class=‘alert alert-info’>Only available in the <a href=‘phraseapp.com/pricing’ target=‘_blank’>Control Package</a>.</div>Mark translations matching query as unverified. API Path: /api/v2/projects/:project_id/translations/unverify

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationsUnverifyParams

Returns:

PhraseApp::ResponseObjects::AffectedCount
err


6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
# File 'lib/phraseapp-ruby.rb', line 6146

def translations_unverify(project_id, params)
  path = sprintf("/api/v2/projects/%s/translations/unverify", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsUnverifyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsUnverifyParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedCount.new(JSON.load(rc.body)), err
end

#translations_verify(project_id, params) ⇒ Object

<div class=‘alert alert-info’>Only available in the <a href=‘phraseapp.com/pricing’ target=‘_blank’>Control Package</a>.</div>Verify translations matching query. API Path: /api/v2/projects/:project_id/translations/verify

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::TranslationsVerifyParams

Returns:

PhraseApp::ResponseObjects::AffectedCount
err


6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
# File 'lib/phraseapp-ruby.rb', line 6182

def translations_verify(project_id, params)
  path = sprintf("/api/v2/projects/%s/translations/verify", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::TranslationsVerifyParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationsVerifyParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::AffectedCount.new(JSON.load(rc.body)), err
end

#upload_create(project_id, params) ⇒ Object

Upload a new language file. Creates necessary resources in your project. API Path: /api/v2/projects/:project_id/uploads

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::UploadParams

Returns:

PhraseApp::ResponseObjects::Upload
err


6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
# File 'lib/phraseapp-ruby.rb', line 6218

def upload_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/uploads", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::UploadParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::UploadParams")
    end
  end
  if params.autotranslate != nil
    data_hash["autotranslate"] = (params.autotranslate == true)
  end

  if params.branch != nil
    data_hash["branch"] = params.branch
  end

  if params.convert_emoji != nil
    data_hash["convert_emoji"] = (params.convert_emoji == true)
  end

  if params.file != nil
    post_body = []
    post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
    post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{File.basename(params.file )}\"\r\n"
    post_body << "Content-Type: text/plain\r\n"
    post_body << "\r\n"
    post_body << File.read(params.file)
    post_body << "\r\n"
  end

  if params.file_encoding != nil
    data_hash["file_encoding"] = params.file_encoding
  end

  if params.file_format != nil
    data_hash["file_format"] = params.file_format
  end

  if params.format_options != nil
    params.format_options.each do |key, value|
      data_hash["format_options"][key] = value
    end
  end

  if params.locale_id != nil
    data_hash["locale_id"] = params.locale_id
  end

  if params.locale_mapping != nil
    params.locale_mapping.each do |key, value|
      data_hash["locale_mapping"][key] = value
    end
  end

  if params.skip_unverification != nil
    data_hash["skip_unverification"] = (params.skip_unverification == true)
  end

  if params.skip_upload_tags != nil
    data_hash["skip_upload_tags"] = (params.skip_upload_tags == true)
  end

  if params.tags != nil
    data_hash["tags"] = params.tags
  end

  if params.update_descriptions != nil
    data_hash["update_descriptions"] = (params.update_descriptions == true)
  end

  if params.update_translations != nil
    data_hash["update_translations"] = (params.update_translations == true)
  end

  
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Upload.new(JSON.load(rc.body)), err
end

#upload_show(project_id, id, params) ⇒ Object

View details and summary for a single upload. API Path: /api/v2/projects/:project_id/uploads/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::UploadShowParams

Returns:

PhraseApp::ResponseObjects::Upload
err


6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
# File 'lib/phraseapp-ruby.rb', line 6318

def upload_show(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/uploads/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::UploadShowParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::UploadShowParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Upload.new(JSON.load(rc.body)), err
end

#uploads_list(project_id, page, per_page) ⇒ Object

List all uploads for the given project. API Path: /api/v2/projects/:project_id/uploads

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::Upload
err


6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
# File 'lib/phraseapp-ruby.rb', line 6352

def uploads_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/uploads", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Upload.new(item) }, err
end

#version_show(project_id, translation_id, id) ⇒ Object

Get details on a single version. API Path: /api/v2/projects/:project_id/translations/:translation_id/versions/:id

Parameters:

project_id

project_id

translation_id

translation_id

id

id

Returns:

PhraseApp::ResponseObjects::TranslationVersionWithUser
err


6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
# File 'lib/phraseapp-ruby.rb', line 6379

def version_show(project_id, translation_id, id)
  path = sprintf("/api/v2/projects/%s/translations/%s/versions/%s", project_id, translation_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::TranslationVersionWithUser.new(JSON.load(rc.body)), err
end

#versions_list(project_id, translation_id, page, per_page) ⇒ Object

List all versions for the given translation. API Path: /api/v2/projects/:project_id/translations/:translation_id/versions

Parameters:

project_id

project_id

translation_id

translation_id

Returns:

PhraseApp::ResponseObjects::TranslationVersion
err


6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
# File 'lib/phraseapp-ruby.rb', line 6404

def versions_list(project_id, translation_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/translations/%s/versions", project_id, translation_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::TranslationVersion.new(item) }, err
end

#webhook_create(project_id, params) ⇒ Object

Create a new webhook. API Path: /api/v2/projects/:project_id/webhooks

Parameters:

project_id

project_id

params

Parameters of type PhraseApp::RequestParams::WebhookParams

Returns:

PhraseApp::ResponseObjects::Webhook
err


6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
# File 'lib/phraseapp-ruby.rb', line 6429

def webhook_create(project_id, params)
  path = sprintf("/api/v2/projects/%s/webhooks", project_id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::WebhookParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::WebhookParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Webhook.new(JSON.load(rc.body)), err
end

#webhook_delete(project_id, id) ⇒ Object

Delete an existing webhook. API Path: /api/v2/projects/:project_id/webhooks/:id

Parameters:

project_id

project_id

id

id

Returns:

err


6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
# File 'lib/phraseapp-ruby.rb', line 6464

def webhook_delete(project_id, id)
  path = sprintf("/api/v2/projects/%s/webhooks/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
  if err != nil
    return nil, err
  end
  
  return err
end

#webhook_show(project_id, id) ⇒ Object

Get details on a single webhook. API Path: /api/v2/projects/:project_id/webhooks/:id

Parameters:

project_id

project_id

id

id

Returns:

PhraseApp::ResponseObjects::Webhook
err


6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
# File 'lib/phraseapp-ruby.rb', line 6489

def webhook_show(project_id, id)
  path = sprintf("/api/v2/projects/%s/webhooks/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Webhook.new(JSON.load(rc.body)), err
end

#webhook_test(project_id, id) ⇒ Object

Perform a test request for a webhook. API Path: /api/v2/projects/:project_id/webhooks/:id/test

Parameters:

project_id

project_id

id

id

Returns:

err


6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
# File 'lib/phraseapp-ruby.rb', line 6513

def webhook_test(project_id, id)
  path = sprintf("/api/v2/projects/%s/webhooks/%s/test", project_id, id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return err
end

#webhook_update(project_id, id, params) ⇒ Object

Update an existing webhook. API Path: /api/v2/projects/:project_id/webhooks/:id

Parameters:

project_id

project_id

id

id

params

Parameters of type PhraseApp::RequestParams::WebhookParams

Returns:

PhraseApp::ResponseObjects::Webhook
err


6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
# File 'lib/phraseapp-ruby.rb', line 6540

def webhook_update(project_id, id, params)
  path = sprintf("/api/v2/projects/%s/webhooks/%s", project_id, id)
  data_hash = {}
  post_body = nil
  
  if params.present?
    unless params.kind_of?(PhraseApp::RequestParams::WebhookParams)
      raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::WebhookParams")
    end
  end
  
  data_hash = params.to_h
  err = params.validate
  if err != nil
    return nil, err
  end
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
  if err != nil
    return nil, err
  end
  
  return PhraseApp::ResponseObjects::Webhook.new(JSON.load(rc.body)), err
end

#webhooks_list(project_id, page, per_page) ⇒ Object

List all webhooks for the given project. API Path: /api/v2/projects/:project_id/webhooks

Parameters:

project_id

project_id

Returns:

PhraseApp::ResponseObjects::Webhook
err


6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
# File 'lib/phraseapp-ruby.rb', line 6574

def webhooks_list(project_id, page, per_page)
  path = sprintf("/api/v2/projects/%s/webhooks", project_id)
  data_hash = {}
  post_body = nil
  
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
  rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
  if err != nil
    return nil, err
  end
  
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Webhook.new(item) }, err
end