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.



2476
2477
2478
# File 'lib/phraseapp-ruby.rb', line 2476

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


2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
# File 'lib/phraseapp-ruby.rb', line 2490

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


2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
# File 'lib/phraseapp-ruby.rb', line 2511

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


2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
# File 'lib/phraseapp-ruby.rb', line 2534

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


2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
# File 'lib/phraseapp-ruby.rb', line 2567

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


2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
# File 'lib/phraseapp-ruby.rb', line 2590

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


2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
# File 'lib/phraseapp-ruby.rb', line 2615

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


2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
# File 'lib/phraseapp-ruby.rb', line 2647

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


2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
# File 'lib/phraseapp-ruby.rb', line 2672

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


2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
# File 'lib/phraseapp-ruby.rb', line 2707

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


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

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


2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
# File 'lib/phraseapp-ruby.rb', line 2777

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


2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
# File 'lib/phraseapp-ruby.rb', line 2812

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


2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
# File 'lib/phraseapp-ruby.rb', line 2837

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


2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
# File 'lib/phraseapp-ruby.rb', line 2864

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


2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
# File 'lib/phraseapp-ruby.rb', line 2898

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


2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
# File 'lib/phraseapp-ruby.rb', line 2923

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


2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
# File 'lib/phraseapp-ruby.rb', line 2958

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


2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
# File 'lib/phraseapp-ruby.rb', line 2984

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


3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
# File 'lib/phraseapp-ruby.rb', line 3020

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


3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
# File 'lib/phraseapp-ruby.rb', line 3047

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


3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
# File 'lib/phraseapp-ruby.rb', line 3081

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


3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
# File 'lib/phraseapp-ruby.rb', line 3108

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


3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
# File 'lib/phraseapp-ruby.rb', line 3145

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


3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
# File 'lib/phraseapp-ruby.rb', line 3171

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


3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
# File 'lib/phraseapp-ruby.rb', line 3197

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


3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
# File 'lib/phraseapp-ruby.rb', line 3223

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


3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
# File 'lib/phraseapp-ruby.rb', line 3250

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


3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
# File 'lib/phraseapp-ruby.rb', line 3279

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


3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
# File 'lib/phraseapp-ruby.rb', line 3315

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


3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
# File 'lib/phraseapp-ruby.rb', line 3336

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


3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
# File 'lib/phraseapp-ruby.rb', line 3359

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


3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
# File 'lib/phraseapp-ruby.rb', line 3384

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


3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
# File 'lib/phraseapp-ruby.rb', line 3419

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


3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
# File 'lib/phraseapp-ruby.rb', line 3444

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


3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
# File 'lib/phraseapp-ruby.rb', line 3509

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


3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
# File 'lib/phraseapp-ruby.rb', line 3546

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


3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
# File 'lib/phraseapp-ruby.rb', line 3573

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


3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
# File 'lib/phraseapp-ruby.rb', line 3642

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


3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
# File 'lib/phraseapp-ruby.rb', line 3681

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


3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
# File 'lib/phraseapp-ruby.rb', line 3712

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


3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
# File 'lib/phraseapp-ruby.rb', line 3602

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


3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
# File 'lib/phraseapp-ruby.rb', line 3748

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


3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
# File 'lib/phraseapp-ruby.rb', line 3471

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


3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
# File 'lib/phraseapp-ruby.rb', line 3773

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


3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
# File 'lib/phraseapp-ruby.rb', line 3808

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


3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
# File 'lib/phraseapp-ruby.rb', line 3833

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


3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
# File 'lib/phraseapp-ruby.rb', line 3858

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


3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
# File 'lib/phraseapp-ruby.rb', line 3885

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


3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
# File 'lib/phraseapp-ruby.rb', line 3919

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


3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
# File 'lib/phraseapp-ruby.rb', line 3944

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


3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
# File 'lib/phraseapp-ruby.rb', line 3969

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


4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
# File 'lib/phraseapp-ruby.rb', line 4004

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


4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
# File 'lib/phraseapp-ruby.rb', line 4031

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


4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
# File 'lib/phraseapp-ruby.rb', line 4068

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


4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
# File 'lib/phraseapp-ruby.rb', line 4219

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


4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
# File 'lib/phraseapp-ruby.rb', line 4245

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


4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
# File 'lib/phraseapp-ruby.rb', line 4272

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


4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
# File 'lib/phraseapp-ruby.rb', line 4299

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


4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
# File 'lib/phraseapp-ruby.rb', line 4328

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


4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
# File 'lib/phraseapp-ruby.rb', line 4366

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


4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
# File 'lib/phraseapp-ruby.rb', line 4402

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


4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
# File 'lib/phraseapp-ruby.rb', line 4104

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


4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
# File 'lib/phraseapp-ruby.rb', line 4129

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


4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
# File 'lib/phraseapp-ruby.rb', line 4154

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


4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
# File 'lib/phraseapp-ruby.rb', line 4181

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


4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
# File 'lib/phraseapp-ruby.rb', line 4427

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


4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
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
# File 'lib/phraseapp-ruby.rb', line 4463

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


4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
# File 'lib/phraseapp-ruby.rb', line 4556

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


4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
# File 'lib/phraseapp-ruby.rb', line 4581

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


4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
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
# File 'lib/phraseapp-ruby.rb', line 4608

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


4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
# File 'lib/phraseapp-ruby.rb', line 4702

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


4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
# File 'lib/phraseapp-ruby.rb', line 4738

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


4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
# File 'lib/phraseapp-ruby.rb', line 4774

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


4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
# File 'lib/phraseapp-ruby.rb', line 4810

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


4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
# File 'lib/phraseapp-ruby.rb', line 4846

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


4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
# File 'lib/phraseapp-ruby.rb', line 4882

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


4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
# File 'lib/phraseapp-ruby.rb', line 4917

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


4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
# File 'lib/phraseapp-ruby.rb', line 4943

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


4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
# File 'lib/phraseapp-ruby.rb', line 4981

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


5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
# File 'lib/phraseapp-ruby.rb', line 5019

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


5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
# File 'lib/phraseapp-ruby.rb', line 5055

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


5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
# File 'lib/phraseapp-ruby.rb', line 5090

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


5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
# File 'lib/phraseapp-ruby.rb', line 5115

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


5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
# File 'lib/phraseapp-ruby.rb', line 5142

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


5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
# File 'lib/phraseapp-ruby.rb', line 5176

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


5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
# File 'lib/phraseapp-ruby.rb', line 5201

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


5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
# File 'lib/phraseapp-ruby.rb', line 5226

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


5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
# File 'lib/phraseapp-ruby.rb', line 5261

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


5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
# File 'lib/phraseapp-ruby.rb', line 5286

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


5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
# File 'lib/phraseapp-ruby.rb', line 5309

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


5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
# File 'lib/phraseapp-ruby.rb', line 5332

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


5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
# File 'lib/phraseapp-ruby.rb', line 5391

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


5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
# File 'lib/phraseapp-ruby.rb', line 5414

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


5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
# File 'lib/phraseapp-ruby.rb', line 5439

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


5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
# File 'lib/phraseapp-ruby.rb', line 5497

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


5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
# File 'lib/phraseapp-ruby.rb', line 5518

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


5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
# File 'lib/phraseapp-ruby.rb', line 5543

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


5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
# File 'lib/phraseapp-ruby.rb', line 5578

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


5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
# File 'lib/phraseapp-ruby.rb', line 5603

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


5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
# File 'lib/phraseapp-ruby.rb', line 5630

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


5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
# File 'lib/phraseapp-ruby.rb', line 5664

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


5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
# File 'lib/phraseapp-ruby.rb', line 5689

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


5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
# File 'lib/phraseapp-ruby.rb', line 5724

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


5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
# File 'lib/phraseapp-ruby.rb', line 5749

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


5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
# File 'lib/phraseapp-ruby.rb', line 5772

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


5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
# File 'lib/phraseapp-ruby.rb', line 5797

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


5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
# File 'lib/phraseapp-ruby.rb', line 5833

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


5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
# File 'lib/phraseapp-ruby.rb', line 5860

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


5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
# File 'lib/phraseapp-ruby.rb', line 5898

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


5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
# File 'lib/phraseapp-ruby.rb', line 5936

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


5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
# File 'lib/phraseapp-ruby.rb', line 5972

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


6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
# File 'lib/phraseapp-ruby.rb', line 6008

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


6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
# File 'lib/phraseapp-ruby.rb', line 6044

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


6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
# File 'lib/phraseapp-ruby.rb', line 6080

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


6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
# File 'lib/phraseapp-ruby.rb', line 6116

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


6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
# File 'lib/phraseapp-ruby.rb', line 6152

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


6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
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
# File 'lib/phraseapp-ruby.rb', line 6188

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


6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
# File 'lib/phraseapp-ruby.rb', line 6288

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


6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
# File 'lib/phraseapp-ruby.rb', line 6322

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


6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
# File 'lib/phraseapp-ruby.rb', line 6349

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


6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
# File 'lib/phraseapp-ruby.rb', line 6374

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


6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
# File 'lib/phraseapp-ruby.rb', line 6399

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


6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
# File 'lib/phraseapp-ruby.rb', line 6434

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


6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
# File 'lib/phraseapp-ruby.rb', line 6459

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


6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
# File 'lib/phraseapp-ruby.rb', line 6483

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


6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
# File 'lib/phraseapp-ruby.rb', line 6510

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


6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
# File 'lib/phraseapp-ruby.rb', line 6544

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