Class: PhraseApp::Client
- Inherits:
-
Object
- Object
- PhraseApp::Client
- 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
-
#account_show(id) ⇒ Object
Get details on a single account.
-
#accounts_list(page, per_page) ⇒ Object
List all accounts the current user has access to.
-
#authorization_create(params) ⇒ Object
Create a new authorization.
-
#authorization_delete(id) ⇒ Object
Delete an existing authorization.
-
#authorization_show(id) ⇒ Object
Get details on a single authorization.
-
#authorization_update(id, params) ⇒ Object
Update an existing authorization.
-
#authorizations_list(page, per_page) ⇒ Object
List all your authorizations.
-
#bitbucket_sync_export(id, params) ⇒ Object
Export translations from PhraseApp to Bitbucket according to the .phraseapp.yml file within the Bitbucket Repository.
-
#bitbucket_sync_import(id, params) ⇒ Object
Import translations from Bitbucket to PhraseApp according to the .phraseapp.yml file within the Bitbucket repository.
-
#bitbucket_syncs_list(page, per_page, params) ⇒ Object
List all Bitbucket repositories for which synchronisation with PhraseApp is activated.
-
#blacklisted_key_create(project_id, params) ⇒ Object
Create a new rule for blacklisting keys.
-
#blacklisted_key_delete(project_id, id) ⇒ Object
Delete an existing rule for blacklisting keys.
-
#blacklisted_key_show(project_id, id) ⇒ Object
Get details on a single rule for blacklisting keys for a given project.
-
#blacklisted_key_update(project_id, id, params) ⇒ Object
Update an existing rule for blacklisting keys.
-
#blacklisted_keys_list(project_id, page, per_page) ⇒ Object
List all rules for blacklisting keys for the given project.
-
#branch_create(project_id, params) ⇒ Object
Create a new branch.
-
#branch_delete(project_id, id) ⇒ Object
Delete an existing branch.
-
#branch_merge(project_id, id, params) ⇒ Object
Merge an existing branch.
-
#branch_show(project_id, id) ⇒ Object
Get details on a single branch for a given project.
-
#branch_update(project_id, id, params) ⇒ Object
Update an existing branch.
-
#branches_list(project_id, page, per_page) ⇒ Object
List all branches the of the current project.
-
#comment_create(project_id, key_id, params) ⇒ Object
Create a new comment for a key.
-
#comment_delete(project_id, key_id, id, params) ⇒ Object
Delete an existing comment.
-
#comment_mark_check(project_id, key_id, id, params) ⇒ Object
Check if comment was marked as read.
-
#comment_mark_read(project_id, key_id, id, params) ⇒ Object
Mark a comment as read.
-
#comment_mark_unread(project_id, key_id, id, params) ⇒ Object
Mark a comment as unread.
-
#comment_show(project_id, key_id, id, params) ⇒ Object
Get details on a single comment.
-
#comment_update(project_id, key_id, id, params) ⇒ Object
Update an existing comment.
-
#comments_list(project_id, key_id, page, per_page, params) ⇒ Object
List all comments for a key.
-
#distribution_create(account_id, params) ⇒ Object
Create a new distribution.
-
#distribution_delete(account_id, id) ⇒ Object
Delete an existing distribution.
-
#distribution_show(account_id, id) ⇒ Object
Get details on a single distribution.
-
#distribution_update(account_id, id, params) ⇒ Object
Update an existing distribution.
-
#distributions_list(account_id, page, per_page) ⇒ Object
List all distributions for the given account.
-
#formats_list(page, per_page) ⇒ Object
Get a handy list of all localization file formats supported in PhraseApp.
-
#glossaries_list(account_id, page, per_page) ⇒ Object
List all glossaries the current user has access to.
-
#glossary_create(account_id, params) ⇒ Object
Create a new glossary.
-
#glossary_delete(account_id, id) ⇒ Object
Delete an existing glossary.
-
#glossary_show(account_id, id) ⇒ Object
Get details on a single glossary.
-
#glossary_term_create(account_id, glossary_id, params) ⇒ Object
Create a new glossary term.
-
#glossary_term_delete(account_id, glossary_id, id) ⇒ Object
Delete an existing glossary term.
-
#glossary_term_show(account_id, glossary_id, id) ⇒ Object
Get details on a single glossary term.
-
#glossary_term_translation_create(account_id, glossary_id, term_id, params) ⇒ Object
Create a new glossary term translation.
-
#glossary_term_translation_delete(account_id, glossary_id, term_id, id) ⇒ Object
Delete an existing glossary term translation.
-
#glossary_term_translation_update(account_id, glossary_id, term_id, id, params) ⇒ Object
Update an existing glossary term translation.
-
#glossary_term_update(account_id, glossary_id, id, params) ⇒ Object
Update an existing glossary term.
-
#glossary_terms_list(account_id, glossary_id, page, per_page) ⇒ Object
List all glossary terms the current user has access to.
-
#glossary_update(account_id, id, params) ⇒ Object
Update an existing glossary.
-
#initialize(credentials) ⇒ Client
constructor
A new instance of Client.
-
#invitation_create(account_id, params) ⇒ Object
Invite a person to an account.
-
#invitation_delete(account_id, id) ⇒ Object
Delete an existing invitation (must not be accepted yet).
-
#invitation_resend(account_id, id) ⇒ Object
Resend the invitation email (must not be accepted yet).
-
#invitation_show(account_id, id) ⇒ Object
Get details on a single invitation.
-
#invitation_update(account_id, id, params) ⇒ Object
Update an existing invitation (must not be accepted yet).
-
#invitations_list(account_id, page, per_page) ⇒ Object
List invitations for an account.
-
#job_complete(project_id, id, params) ⇒ Object
Mark a job as completed.
-
#job_create(project_id, params) ⇒ Object
Create a new job.
-
#job_delete(project_id, id, params) ⇒ Object
Delete an existing job.
-
#job_keys_create(project_id, id, params) ⇒ Object
Add multiple keys to a existing job.
-
#job_keys_delete(project_id, id, params) ⇒ Object
Remove multiple keys from existing job.
-
#job_locale_complete(project_id, job_id, id, params) ⇒ Object
Mark a job locale as completed.
-
#job_locale_delete(project_id, job_id, id, params) ⇒ Object
Delete an existing job locale.
-
#job_locale_reopen(project_id, job_id, id, params) ⇒ Object
Mark a job locale as uncompleted.
-
#job_locale_show(project_id, job_id, id, params) ⇒ Object
Get a single job locale for a given job.
-
#job_locale_update(project_id, job_id, id, params) ⇒ Object
Update an existing job locale.
-
#job_locales_create(project_id, job_id, params) ⇒ Object
Create a new job locale.
-
#job_locales_list(project_id, job_id, page, per_page, params) ⇒ Object
List all job locales for a given job.
-
#job_reopen(project_id, id, params) ⇒ Object
Mark a job as uncompleted.
-
#job_show(project_id, id, params) ⇒ Object
Get details on a single job for a given project.
-
#job_start(project_id, id, params) ⇒ Object
Starts an existing job in state draft.
-
#job_update(project_id, id, params) ⇒ Object
Update an existing job.
-
#jobs_list(project_id, page, per_page, params) ⇒ Object
List all jobs for the given project.
-
#key_create(project_id, params) ⇒ Object
Create a new key.
-
#key_delete(project_id, id, params) ⇒ Object
Delete an existing key.
-
#key_show(project_id, id, params) ⇒ Object
Get details on a single key for a given project.
-
#key_update(project_id, id, params) ⇒ Object
Update an existing key.
-
#keys_delete(project_id, params) ⇒ Object
Delete all keys matching query.
-
#keys_list(project_id, page, per_page, params) ⇒ Object
List all keys for the given project.
-
#keys_search(project_id, page, per_page, params) ⇒ Object
Search keys for the given project matching query.
-
#keys_tag(project_id, params) ⇒ Object
Tags all keys matching query.
-
#keys_untag(project_id, params) ⇒ Object
Removes specified tags from keys matching query.
-
#locale_create(project_id, params) ⇒ Object
Create a new locale.
-
#locale_delete(project_id, id, params) ⇒ Object
Delete an existing locale.
-
#locale_download(project_id, id, params) ⇒ Object
Download a locale in a specific file format.
-
#locale_show(project_id, id, params) ⇒ Object
Get details on a single locale for a given project.
-
#locale_update(project_id, id, params) ⇒ Object
Update an existing locale.
-
#locales_list(project_id, page, per_page, params) ⇒ Object
List all locales for the given project.
-
#member_delete(account_id, id) ⇒ Object
Remove a user from the account.
-
#member_show(account_id, id) ⇒ Object
Get details on a single user in the account.
-
#member_update(account_id, id, params) ⇒ Object
Update user permissions in the account.
-
#members_list(account_id, page, per_page) ⇒ Object
Get all users active in the account.
-
#order_confirm(project_id, id, params) ⇒ Object
Confirm an existing order and send it to the provider for translation.
-
#order_create(project_id, params) ⇒ Object
Create a new order.
-
#order_delete(project_id, id, params) ⇒ Object
Cancel an existing order.
-
#order_show(project_id, id, params) ⇒ Object
Get details on a single order.
-
#orders_list(project_id, page, per_page, params) ⇒ Object
List all orders for the given project.
-
#project_create(params) ⇒ Object
Create a new project.
-
#project_delete(id) ⇒ Object
Delete an existing project.
-
#project_show(id) ⇒ Object
Get details on a single project.
-
#project_update(id, params) ⇒ Object
Update an existing project.
-
#projects_list(page, per_page) ⇒ Object
List all projects the current user has access to.
-
#release_create(account_id, distribution_id, params) ⇒ Object
Create a new release.
-
#release_delete(account_id, distribution_id, id) ⇒ Object
Delete an existing release.
-
#release_publish(account_id, distribution_id, id) ⇒ Object
Publish a release for production.
-
#release_show(account_id, distribution_id, id) ⇒ Object
Get details on a single release.
-
#release_update(account_id, distribution_id, id, params) ⇒ Object
Update an existing release.
-
#releases_list(account_id, distribution_id, page, per_page) ⇒ Object
List all releases for the given distribution.
-
#screenshot_create(project_id, params) ⇒ Object
Create a new screenshot.
-
#screenshot_delete(project_id, id) ⇒ Object
Delete an existing screenshot.
-
#screenshot_marker_create(project_id, screenshot_id, params) ⇒ Object
Create a new screenshot marker.
-
#screenshot_marker_delete(project_id, screenshot_id) ⇒ Object
Delete an existing screenshot marker.
-
#screenshot_marker_show(project_id, screenshot_id, id) ⇒ Object
Get details on a single screenshot marker for a given project.
-
#screenshot_marker_update(project_id, screenshot_id, params) ⇒ Object
Update an existing screenshot marker.
-
#screenshot_markers_list(project_id, id, page, per_page) ⇒ Object
List all screenshot markers for the given project.
-
#screenshot_show(project_id, id) ⇒ Object
Get details on a single screenshot for a given project.
-
#screenshot_update(project_id, id, params) ⇒ Object
Update an existing screenshot.
-
#screenshots_list(project_id, page, per_page) ⇒ Object
List all screenshots for the given project.
-
#show_user ⇒ Object
Show details for current User.
-
#styleguide_create(project_id, params) ⇒ Object
Create a new style guide.
-
#styleguide_delete(project_id, id) ⇒ Object
Delete an existing style guide.
-
#styleguide_show(project_id, id) ⇒ Object
Get details on a single style guide.
-
#styleguide_update(project_id, id, params) ⇒ Object
Update an existing style guide.
-
#styleguides_list(project_id, page, per_page) ⇒ Object
List all styleguides for the given project.
-
#tag_create(project_id, params) ⇒ Object
Create a new tag.
-
#tag_delete(project_id, name, params) ⇒ Object
Delete an existing tag.
-
#tag_show(project_id, name, params) ⇒ Object
Get details and progress information on a single tag for a given project.
-
#tags_list(project_id, page, per_page, params) ⇒ Object
List all tags for the given project.
-
#translation_create(project_id, params) ⇒ Object
Create a translation.
-
#translation_show(project_id, id, params) ⇒ Object
Get details on a single translation.
-
#translation_update(project_id, id, params) ⇒ Object
Update an existing translation.
-
#translations_by_key(project_id, key_id, page, per_page, params) ⇒ Object
List translations for a specific key.
-
#translations_by_locale(project_id, locale_id, page, per_page, params) ⇒ Object
List translations for a specific locale.
-
#translations_exclude(project_id, params) ⇒ Object
Exclude translations matching query from locale export.
-
#translations_include(project_id, params) ⇒ Object
Include translations matching query in locale export.
-
#translations_list(project_id, page, per_page, params) ⇒ Object
List translations for the given project.
-
#translations_search(project_id, page, per_page, params) ⇒ Object
Search translations for the given project.
-
#translations_unverify(project_id, params) ⇒ Object
Mark translations matching query as unverified.
-
#translations_verify(project_id, params) ⇒ Object
Verify translations matching query.
-
#upload_create(project_id, params) ⇒ Object
Upload a new language file.
-
#upload_show(project_id, id, params) ⇒ Object
View details and summary for a single upload.
-
#uploads_list(project_id, page, per_page, params) ⇒ Object
List all uploads for the given project.
-
#version_show(project_id, translation_id, id, params) ⇒ Object
Get details on a single version.
-
#versions_list(project_id, translation_id, page, per_page, params) ⇒ Object
List all versions for the given translation.
-
#webhook_create(project_id, params) ⇒ Object
Create a new webhook.
-
#webhook_delete(project_id, id) ⇒ Object
Delete an existing webhook.
-
#webhook_show(project_id, id) ⇒ Object
Get details on a single webhook.
-
#webhook_test(project_id, id) ⇒ Object
Perform a test request for a webhook.
-
#webhook_update(project_id, id, params) ⇒ Object
Update an existing webhook.
-
#webhooks_list(project_id, page, per_page) ⇒ Object
List all webhooks for the given project.
Constructor Details
#initialize(credentials) ⇒ Client
Returns a new instance of Client.
3479 3480 3481 |
# File 'lib/phraseapp-ruby.rb', line 3479 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
3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 |
# File 'lib/phraseapp-ruby.rb', line 3493 def account_show(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::Account
err
3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 |
# File 'lib/phraseapp-ruby.rb', line 3514 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::Account.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
3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 |
# File 'lib/phraseapp-ruby.rb', line 3537 def (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
3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 |
# File 'lib/phraseapp-ruby.rb', line 3570 def (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
3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 |
# File 'lib/phraseapp-ruby.rb', line 3593 def (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
3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 |
# File 'lib/phraseapp-ruby.rb', line 3618 def (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
3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 |
# File 'lib/phraseapp-ruby.rb', line 3650 def (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
3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 |
# File 'lib/phraseapp-ruby.rb', line 3675 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
3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 |
# File 'lib/phraseapp-ruby.rb', line 3710 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
3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 |
# File 'lib/phraseapp-ruby.rb', line 3744 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
3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 |
# File 'lib/phraseapp-ruby.rb', line 3780 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
3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 |
# File 'lib/phraseapp-ruby.rb', line 3815 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
3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 |
# File 'lib/phraseapp-ruby.rb', line 3840 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
3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 |
# File 'lib/phraseapp-ruby.rb', line 3867 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
3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 |
# File 'lib/phraseapp-ruby.rb', line 3901 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
3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 |
# File 'lib/phraseapp-ruby.rb', line 3926 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
3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 |
# File 'lib/phraseapp-ruby.rb', line 3961 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
3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 |
# File 'lib/phraseapp-ruby.rb', line 3987 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
4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 |
# File 'lib/phraseapp-ruby.rb', line 4023 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
4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 |
# File 'lib/phraseapp-ruby.rb', line 4050 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
4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 |
# File 'lib/phraseapp-ruby.rb', line 4084 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
4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 |
# File 'lib/phraseapp-ruby.rb', line 4111 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, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::CommentDeleteParams
Returns:
err
4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 |
# File 'lib/phraseapp-ruby.rb', line 4150 def comment_delete(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::CommentDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentDeleteParams") 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 |
#comment_mark_check(project_id, key_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::CommentMarkCheckParams
Returns:
err
4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 |
# File 'lib/phraseapp-ruby.rb', line 4189 def comment_mark_check(project_id, key_id, id, params) path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::CommentMarkCheckParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentMarkCheckParams") 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, 204) if err != nil return nil, err end return err end |
#comment_mark_read(project_id, key_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::CommentMarkReadParams
Returns:
err
4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 |
# File 'lib/phraseapp-ruby.rb', line 4228 def comment_mark_read(project_id, key_id, id, params) path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::CommentMarkReadParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentMarkReadParams") 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, 204) if err != nil return nil, err end return err end |
#comment_mark_unread(project_id, key_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::CommentMarkUnreadParams
Returns:
err
4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 |
# File 'lib/phraseapp-ruby.rb', line 4267 def comment_mark_unread(project_id, key_id, id, params) path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::CommentMarkUnreadParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentMarkUnreadParams") 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 |
#comment_show(project_id, key_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::CommentShowParams
Returns:
PhraseApp::ResponseObjects::Comment
err
4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 |
# File 'lib/phraseapp-ruby.rb', line 4307 def comment_show(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::CommentShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentShowParams") 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::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
4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 |
# File 'lib/phraseapp-ruby.rb', line 4347 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, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::CommentsListParams
Returns:
PhraseApp::ResponseObjects::Comment
err
4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 |
# File 'lib/phraseapp-ruby.rb', line 4385 def comments_list(project_id, key_id, page, per_page, 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::CommentsListParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentsListParams") 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::Comment.new(item) }, err end |
#distribution_create(account_id, params) ⇒ Object
Create a new distribution. API Path: /api/v2/accounts/:account_id/distributions
Parameters:
- account_id
-
account_id
- params
-
Parameters of type PhraseApp::RequestParams::DistributionsParams
Returns:
PhraseApp::ResponseObjects::Distribution
err
4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 |
# File 'lib/phraseapp-ruby.rb', line 4421 def distribution_create(account_id, params) path = sprintf("/api/v2/accounts/%s/distributions", account_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::DistributionsParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::DistributionsParams") 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::Distribution.new(JSON.load(rc.body)), err end |
#distribution_delete(account_id, id) ⇒ Object
Delete an existing distribution. API Path: /api/v2/accounts/:account_id/distributions/:id
Parameters:
- account_id
-
account_id
- id
-
id
Returns:
err
4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 |
# File 'lib/phraseapp-ruby.rb', line 4456 def distribution_delete(account_id, id) path = sprintf("/api/v2/accounts/%s/distributions/%s", account_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 |
#distribution_show(account_id, id) ⇒ Object
Get details on a single distribution. API Path: /api/v2/accounts/:account_id/distributions/:id
Parameters:
- account_id
-
account_id
- id
-
id
Returns:
PhraseApp::ResponseObjects::Distribution
err
4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 |
# File 'lib/phraseapp-ruby.rb', line 4481 def distribution_show(account_id, id) path = sprintf("/api/v2/accounts/%s/distributions/%s", account_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::Distribution.new(JSON.load(rc.body)), err end |
#distribution_update(account_id, id, params) ⇒ Object
Update an existing distribution. API Path: /api/v2/accounts/:account_id/distributions/:id
Parameters:
- account_id
-
account_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::DistributionsParams
Returns:
PhraseApp::ResponseObjects::Distribution
err
4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 |
# File 'lib/phraseapp-ruby.rb', line 4508 def distribution_update(account_id, id, params) path = sprintf("/api/v2/accounts/%s/distributions/%s", account_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::DistributionsParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::DistributionsParams") 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::Distribution.new(JSON.load(rc.body)), err end |
#distributions_list(account_id, page, per_page) ⇒ Object
List all distributions for the given account. API Path: /api/v2/accounts/:account_id/distributions
Parameters:
- account_id
-
account_id
Returns:
PhraseApp::ResponseObjects::DistributionPreview
err
4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 |
# File 'lib/phraseapp-ruby.rb', line 4542 def distributions_list(account_id, page, per_page) path = sprintf("/api/v2/accounts/%s/distributions", account_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::DistributionPreview.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
4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 |
# File 'lib/phraseapp-ruby.rb', line 4563 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
4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 |
# File 'lib/phraseapp-ruby.rb', line 4586 def glossaries_list(account_id, page, per_page) path = sprintf("/api/v2/accounts/%s/glossaries", account_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::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
4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 |
# File 'lib/phraseapp-ruby.rb', line 4611 def glossary_create(account_id, params) path = sprintf("/api/v2/accounts/%s/glossaries", account_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, "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
4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 |
# File 'lib/phraseapp-ruby.rb', line 4646 def glossary_delete(account_id, id) path = sprintf("/api/v2/accounts/%s/glossaries/%s", account_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_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
4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 |
# File 'lib/phraseapp-ruby.rb', line 4671 def glossary_show(account_id, id) path = sprintf("/api/v2/accounts/%s/glossaries/%s", account_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::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
4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 |
# File 'lib/phraseapp-ruby.rb', line 4736 def glossary_term_create(account_id, glossary_id, params) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms", account_id, 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
4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 |
# File 'lib/phraseapp-ruby.rb', line 4773 def glossary_term_delete(account_id, glossary_id, id) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", account_id, 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
4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 |
# File 'lib/phraseapp-ruby.rb', line 4800 def glossary_term_show(account_id, glossary_id, id) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", account_id, 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
4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 |
# File 'lib/phraseapp-ruby.rb', line 4869 def glossary_term_translation_create(account_id, glossary_id, term_id, params) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations", account_id, 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
4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 |
# File 'lib/phraseapp-ruby.rb', line 4908 def glossary_term_translation_delete(account_id, glossary_id, term_id, id) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations/%s", account_id, 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
4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 |
# File 'lib/phraseapp-ruby.rb', line 4939 def glossary_term_translation_update(account_id, glossary_id, term_id, id, params) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s/translations/%s", account_id, 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
4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 |
# File 'lib/phraseapp-ruby.rb', line 4829 def glossary_term_update(account_id, glossary_id, id, params) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms/%s", account_id, 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
4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 |
# File 'lib/phraseapp-ruby.rb', line 4975 def glossary_terms_list(account_id, glossary_id, page, per_page) path = sprintf("/api/v2/accounts/%s/glossaries/%s/terms", account_id, 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
4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 |
# File 'lib/phraseapp-ruby.rb', line 4698 def glossary_update(account_id, id, params) path = sprintf("/api/v2/accounts/%s/glossaries/%s", account_id, 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
5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 |
# File 'lib/phraseapp-ruby.rb', line 5000 def invitation_create(account_id, params) path = sprintf("/api/v2/accounts/%s/invitations", account_id) 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
5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 |
# File 'lib/phraseapp-ruby.rb', line 5035 def invitation_delete(account_id, id) path = sprintf("/api/v2/accounts/%s/invitations/%s", account_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 |
#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
5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 |
# File 'lib/phraseapp-ruby.rb', line 5060 def invitation_resend(account_id, id) path = sprintf("/api/v2/accounts/%s/invitations/%s/resend", account_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::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
5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 |
# File 'lib/phraseapp-ruby.rb', line 5085 def invitation_show(account_id, id) path = sprintf("/api/v2/accounts/%s/invitations/%s", account_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::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
5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 |
# File 'lib/phraseapp-ruby.rb', line 5112 def invitation_update(account_id, id, params) path = sprintf("/api/v2/accounts/%s/invitations/%s", account_id, 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
5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 |
# File 'lib/phraseapp-ruby.rb', line 5146 def invitations_list(account_id, page, per_page) path = sprintf("/api/v2/accounts/%s/invitations", account_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::Invitation.new(item) }, err end |
#job_complete(project_id, id, params) ⇒ Object
Mark a job as completed. API Path: /api/v2/projects/:project_id/jobs/:id/complete
Parameters:
- project_id
-
project_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::JobCompleteParams
Returns:
PhraseApp::ResponseObjects::JobDetails
err
5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 |
# File 'lib/phraseapp-ruby.rb', line 5173 def job_complete(project_id, id, params) path = sprintf("/api/v2/projects/%s/jobs/%s/complete", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::JobCompleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobCompleteParams") 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_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
5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 |
# File 'lib/phraseapp-ruby.rb', line 5209 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, params) ⇒ Object
Delete 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::JobDeleteParams
Returns:
err
5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 |
# File 'lib/phraseapp-ruby.rb', line 5246 def job_delete(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::JobDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobDeleteParams") 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_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
5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 |
# File 'lib/phraseapp-ruby.rb', line 5284 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
5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 |
# File 'lib/phraseapp-ruby.rb', line 5321 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, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobLocaleCompleteParams
Returns:
PhraseApp::ResponseObjects::JobLocale
err
5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 |
# File 'lib/phraseapp-ruby.rb', line 5513 def job_locale_complete(project_id, job_id, id, params) path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s/complete", project_id, job_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::JobLocaleCompleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleCompleteParams") 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::JobLocale.new(JSON.load(rc.body)), err end |
#job_locale_delete(project_id, job_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobLocaleDeleteParams
Returns:
err
5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 |
# File 'lib/phraseapp-ruby.rb', line 5552 def job_locale_delete(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::JobLocaleDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleDeleteParams") 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_reopen(project_id, job_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobLocaleReopenParams
Returns:
PhraseApp::ResponseObjects::JobLocale
err
5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 |
# File 'lib/phraseapp-ruby.rb', line 5592 def job_locale_reopen(project_id, job_id, id, params) path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s/reopen", project_id, job_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::JobLocaleReopenParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleReopenParams") 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::JobLocale.new(JSON.load(rc.body)), err end |
#job_locale_show(project_id, job_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobLocaleShowParams
Returns:
PhraseApp::ResponseObjects::JobLocale
err
5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 |
# File 'lib/phraseapp-ruby.rb', line 5632 def job_locale_show(project_id, job_id, id, params) path = sprintf("/api/v2/projects/%s/jobs/%s/locale/%s", project_id, job_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::JobLocaleShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleShowParams") 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::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
5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 |
# File 'lib/phraseapp-ruby.rb', line 5672 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
5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 |
# File 'lib/phraseapp-ruby.rb', line 5710 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, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobLocalesListParams
Returns:
PhraseApp::ResponseObjects::JobLocale
err
5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 |
# File 'lib/phraseapp-ruby.rb', line 5748 def job_locales_list(project_id, job_id, page, per_page, 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::JobLocalesListParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocalesListParams") 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::JobLocale.new(item) }, err end |
#job_reopen(project_id, id, params) ⇒ Object
Mark a job as uncompleted. API Path: /api/v2/projects/:project_id/jobs/:id/reopen
Parameters:
- project_id
-
project_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::JobReopenParams
Returns:
PhraseApp::ResponseObjects::JobDetails
err
5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 |
# File 'lib/phraseapp-ruby.rb', line 5359 def job_reopen(project_id, id, params) path = sprintf("/api/v2/projects/%s/jobs/%s/reopen", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::JobReopenParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobReopenParams") 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_show(project_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobShowParams
Returns:
PhraseApp::ResponseObjects::JobDetails
err
5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 |
# File 'lib/phraseapp-ruby.rb', line 5397 def job_show(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::JobShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobShowParams") 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::JobDetails.new(JSON.load(rc.body)), err end |
#job_start(project_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::JobStartParams
Returns:
PhraseApp::ResponseObjects::JobDetails
err
5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 |
# File 'lib/phraseapp-ruby.rb', line 5435 def job_start(project_id, id, params) path = sprintf("/api/v2/projects/%s/jobs/%s/start", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::JobStartParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobStartParams") 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_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
5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 |
# File 'lib/phraseapp-ruby.rb', line 5473 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
5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 |
# File 'lib/phraseapp-ruby.rb', line 5784 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
5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 |
# File 'lib/phraseapp-ruby.rb', line 5820 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.branch != nil data_hash["branch"] = params.branch 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. != nil data_hash["tags"] = params. 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, params) ⇒ Object
Delete 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::KeyDeleteParams
Returns:
err
5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 |
# File 'lib/phraseapp-ruby.rb', line 5919 def key_delete(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::KeyDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeyDeleteParams") 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 |
#key_show(project_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::KeyShowParams
Returns:
PhraseApp::ResponseObjects::TranslationKeyDetails
err
5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 |
# File 'lib/phraseapp-ruby.rb', line 5957 def key_show(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::KeyShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::KeyShowParams") 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::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
5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 |
# File 'lib/phraseapp-ruby.rb', line 5995 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.branch != nil data_hash["branch"] = params.branch 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. != nil data_hash["tags"] = params. 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
6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 |
# File 'lib/phraseapp-ruby.rb', line 6093 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
6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 |
# File 'lib/phraseapp-ruby.rb', line 6129 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
6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 |
# File 'lib/phraseapp-ruby.rb', line 6165 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
6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 |
# File 'lib/phraseapp-ruby.rb', line 6201 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
6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 |
# File 'lib/phraseapp-ruby.rb', line 6237 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
6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 |
# File 'lib/phraseapp-ruby.rb', line 6273 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, params) ⇒ Object
Delete 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::LocaleDeleteParams
Returns:
err
6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 |
# File 'lib/phraseapp-ruby.rb', line 6310 def locale_delete(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::LocaleDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::LocaleDeleteParams") 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 |
#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
6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 |
# File 'lib/phraseapp-ruby.rb', line 6347 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
6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 |
# File 'lib/phraseapp-ruby.rb', line 6385 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
6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 |
# File 'lib/phraseapp-ruby.rb', line 6423 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
6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 |
# File 'lib/phraseapp-ruby.rb', line 6459 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
6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 |
# File 'lib/phraseapp-ruby.rb', line 6494 def member_delete(account_id, id) path = sprintf("/api/v2/accounts/%s/members/%s", account_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 |
#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
6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 |
# File 'lib/phraseapp-ruby.rb', line 6519 def member_show(account_id, id) path = sprintf("/api/v2/accounts/%s/members/%s", account_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::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
6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 |
# File 'lib/phraseapp-ruby.rb', line 6546 def member_update(account_id, id, params) path = sprintf("/api/v2/accounts/%s/members/%s", account_id, 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
6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 |
# File 'lib/phraseapp-ruby.rb', line 6580 def members_list(account_id, page, per_page) path = sprintf("/api/v2/accounts/%s/members", account_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::Member.new(item) }, err end |
#order_confirm(project_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::OrderConfirmParams
Returns:
PhraseApp::ResponseObjects::TranslationOrder
err
6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 |
# File 'lib/phraseapp-ruby.rb', line 6607 def order_confirm(project_id, id, params) path = sprintf("/api/v2/projects/%s/orders/%s/confirm", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::OrderConfirmParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::OrderConfirmParams") 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::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
6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 |
# File 'lib/phraseapp-ruby.rb', line 6643 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, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::OrderDeleteParams
Returns:
err
6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 |
# File 'lib/phraseapp-ruby.rb', line 6680 def order_delete(project_id, id, params) path = sprintf("/api/v2/projects/%s/orders/%s", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::OrderDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::OrderDeleteParams") 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 |
#order_show(project_id, id, params) ⇒ Object
Get details on a single order. API Path: /api/v2/projects/:project_id/orders/:id
Parameters:
- project_id
-
project_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::OrderShowParams
Returns:
PhraseApp::ResponseObjects::TranslationOrder
err
6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 |
# File 'lib/phraseapp-ruby.rb', line 6718 def order_show(project_id, id, params) path = sprintf("/api/v2/projects/%s/orders/%s", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::OrderShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::OrderShowParams") 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::TranslationOrder.new(JSON.load(rc.body)), err end |
#orders_list(project_id, page, per_page, params) ⇒ Object
List all orders for the given project. API Path: /api/v2/projects/:project_id/orders
Parameters:
- project_id
-
project_id
- params
-
Parameters of type PhraseApp::RequestParams::OrdersListParams
Returns:
PhraseApp::ResponseObjects::TranslationOrder
err
6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 |
# File 'lib/phraseapp-ruby.rb', line 6754 def orders_list(project_id, page, per_page, params) path = sprintf("/api/v2/projects/%s/orders", project_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::OrdersListParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::OrdersListParams") 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::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
6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 |
# File 'lib/phraseapp-ruby.rb', line 6788 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.account_id != nil data_hash["account_id"] = params.account_id 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
6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 |
# File 'lib/phraseapp-ruby.rb', line 6847 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
6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 |
# File 'lib/phraseapp-ruby.rb', line 6870 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
6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 |
# File 'lib/phraseapp-ruby.rb', line 6895 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.account_id != nil data_hash["account_id"] = params.account_id 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
6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 |
# File 'lib/phraseapp-ruby.rb', line 6953 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 |
#release_create(account_id, distribution_id, params) ⇒ Object
Create a new release. API Path: /api/v2/accounts/:account_id/distributions/:distribution_id/releases
Parameters:
- account_id
-
account_id
- distribution_id
-
distribution_id
- params
-
Parameters of type PhraseApp::RequestParams::ReleasesParams
Returns:
PhraseApp::ResponseObjects::Release
err
6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 |
# File 'lib/phraseapp-ruby.rb', line 6980 def release_create(account_id, distribution_id, params) path = sprintf("/api/v2/accounts/%s/distributions/%s/releases", account_id, distribution_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::ReleasesParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ReleasesParams") 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::Release.new(JSON.load(rc.body)), err end |
#release_delete(account_id, distribution_id, id) ⇒ Object
Delete an existing release. API Path: /api/v2/accounts/:account_id/distributions/:distribution_id/releases/:id
Parameters:
- account_id
-
account_id
- distribution_id
-
distribution_id
- id
-
id
Returns:
err
7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 |
# File 'lib/phraseapp-ruby.rb', line 7017 def release_delete(account_id, distribution_id, id) path = sprintf("/api/v2/accounts/%s/distributions/%s/releases/%s", account_id, distribution_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 |
#release_publish(account_id, distribution_id, id) ⇒ Object
Publish a release for production. API Path: /api/v2/accounts/:account_id/distributions/:distribution_id/releases/:id/publish
Parameters:
- account_id
-
account_id
- distribution_id
-
distribution_id
- id
-
id
Returns:
PhraseApp::ResponseObjects::Release
err
7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 |
# File 'lib/phraseapp-ruby.rb', line 7044 def release_publish(account_id, distribution_id, id) path = sprintf("/api/v2/accounts/%s/distributions/%s/releases/%s/publish", account_id, distribution_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::Release.new(JSON.load(rc.body)), err end |
#release_show(account_id, distribution_id, id) ⇒ Object
Get details on a single release. API Path: /api/v2/accounts/:account_id/distributions/:distribution_id/releases/:id
Parameters:
- account_id
-
account_id
- distribution_id
-
distribution_id
- id
-
id
Returns:
PhraseApp::ResponseObjects::Release
err
7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 |
# File 'lib/phraseapp-ruby.rb', line 7071 def release_show(account_id, distribution_id, id) path = sprintf("/api/v2/accounts/%s/distributions/%s/releases/%s", account_id, distribution_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::Release.new(JSON.load(rc.body)), err end |
#release_update(account_id, distribution_id, id, params) ⇒ Object
Update an existing release. API Path: /api/v2/accounts/:account_id/distributions/:distribution_id/releases/:id
Parameters:
- account_id
-
account_id
- distribution_id
-
distribution_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::ReleasesParams
Returns:
PhraseApp::ResponseObjects::Release
err
7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 |
# File 'lib/phraseapp-ruby.rb', line 7100 def release_update(account_id, distribution_id, id, params) path = sprintf("/api/v2/accounts/%s/distributions/%s/releases/%s", account_id, distribution_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::ReleasesParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ReleasesParams") 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::Release.new(JSON.load(rc.body)), err end |
#releases_list(account_id, distribution_id, page, per_page) ⇒ Object
List all releases for the given distribution. API Path: /api/v2/accounts/:account_id/distributions/:distribution_id/releases
Parameters:
- account_id
-
account_id
- distribution_id
-
distribution_id
Returns:
PhraseApp::ResponseObjects::ReleasePreview
err
7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 |
# File 'lib/phraseapp-ruby.rb', line 7136 def releases_list(account_id, distribution_id, page, per_page) path = sprintf("/api/v2/accounts/%s/distributions/%s/releases", account_id, distribution_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::ReleasePreview.new(item) }, err end |
#screenshot_create(project_id, params) ⇒ Object
Create a new screenshot. API Path: /api/v2/projects/:project_id/screenshots
Parameters:
- project_id
-
project_id
- params
-
Parameters of type PhraseApp::RequestParams::ScreenshotParams
Returns:
PhraseApp::ResponseObjects::Screenshot
err
7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 |
# File 'lib/phraseapp-ruby.rb', line 7161 def screenshot_create(project_id, params) path = sprintf("/api/v2/projects/%s/screenshots", project_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::ScreenshotParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ScreenshotParams") end end if params.description != nil data_hash["description"] = params.description end if params.filename != nil post_body = [] post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n" post_body << "Content-Disposition: form-data; name=\"filename\"; filename=\"#{File.basename(params.filename )}\"\r\n" post_body << "Content-Type: text/plain\r\n" post_body << "\r\n" post_body << File.read(params.filename) post_body << "\r\n" end if params.name != nil data_hash["name"] = params.name 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::Screenshot.new(JSON.load(rc.body)), err end |
#screenshot_delete(project_id, id) ⇒ Object
Delete an existing screenshot. API Path: /api/v2/projects/:project_id/screenshots/:id
Parameters:
- project_id
-
project_id
- id
-
id
Returns:
err
7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 |
# File 'lib/phraseapp-ruby.rb', line 7210 def screenshot_delete(project_id, id) path = sprintf("/api/v2/projects/%s/screenshots/%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 |
#screenshot_marker_create(project_id, screenshot_id, params) ⇒ Object
Create a new screenshot marker. API Path: /api/v2/projects/:project_id/screenshots/:screenshot_id/markers
Parameters:
- project_id
-
project_id
- screenshot_id
-
screenshot_id
- params
-
Parameters of type PhraseApp::RequestParams::ScreenshotMarkerParams
Returns:
PhraseApp::ResponseObjects::ScreenshotMarker
err
7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 |
# File 'lib/phraseapp-ruby.rb', line 7314 def screenshot_marker_create(project_id, screenshot_id, params) path = sprintf("/api/v2/projects/%s/screenshots/%s/markers", project_id, screenshot_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::ScreenshotMarkerParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ScreenshotMarkerParams") 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::ScreenshotMarker.new(JSON.load(rc.body)), err end |
#screenshot_marker_delete(project_id, screenshot_id) ⇒ Object
Delete an existing screenshot marker. API Path: /api/v2/projects/:project_id/screenshots/:screenshot_id/markers
Parameters:
- project_id
-
project_id
- screenshot_id
-
screenshot_id
Returns:
err
7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 |
# File 'lib/phraseapp-ruby.rb', line 7349 def screenshot_marker_delete(project_id, screenshot_id) path = sprintf("/api/v2/projects/%s/screenshots/%s/markers", project_id, screenshot_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 |
#screenshot_marker_show(project_id, screenshot_id, id) ⇒ Object
Get details on a single screenshot marker for a given project. API Path: /api/v2/projects/:project_id/screenshots/:screenshot_id/markers/:id
Parameters:
- project_id
-
project_id
- screenshot_id
-
screenshot_id
- id
-
id
Returns:
PhraseApp::ResponseObjects::ScreenshotMarker
err
7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 |
# File 'lib/phraseapp-ruby.rb', line 7376 def screenshot_marker_show(project_id, screenshot_id, id) path = sprintf("/api/v2/projects/%s/screenshots/%s/markers/%s", project_id, screenshot_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::ScreenshotMarker.new(JSON.load(rc.body)), err end |
#screenshot_marker_update(project_id, screenshot_id, params) ⇒ Object
Update an existing screenshot marker. API Path: /api/v2/projects/:project_id/screenshots/:screenshot_id/markers
Parameters:
- project_id
-
project_id
- screenshot_id
-
screenshot_id
- params
-
Parameters of type PhraseApp::RequestParams::ScreenshotMarkerParams
Returns:
PhraseApp::ResponseObjects::ScreenshotMarker
err
7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 |
# File 'lib/phraseapp-ruby.rb', line 7403 def screenshot_marker_update(project_id, screenshot_id, params) path = sprintf("/api/v2/projects/%s/screenshots/%s/markers", project_id, screenshot_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::ScreenshotMarkerParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ScreenshotMarkerParams") 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::ScreenshotMarker.new(JSON.load(rc.body)), err end |
#screenshot_markers_list(project_id, id, page, per_page) ⇒ Object
List all screenshot markers for the given project. API Path: /api/v2/projects/:project_id/screenshots/:id/markers
Parameters:
- project_id
-
project_id
- id
-
id
Returns:
PhraseApp::ResponseObjects::ScreenshotMarker
err
7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 |
# File 'lib/phraseapp-ruby.rb', line 7439 def screenshot_markers_list(project_id, id, page, per_page) path = sprintf("/api/v2/projects/%s/screenshots/%s/markers", project_id, 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::ScreenshotMarker.new(item) }, err end |
#screenshot_show(project_id, id) ⇒ Object
Get details on a single screenshot for a given project. API Path: /api/v2/projects/:project_id/screenshots/:id
Parameters:
- project_id
-
project_id
- id
-
id
Returns:
PhraseApp::ResponseObjects::Screenshot
err
7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 |
# File 'lib/phraseapp-ruby.rb', line 7235 def screenshot_show(project_id, id) path = sprintf("/api/v2/projects/%s/screenshots/%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::Screenshot.new(JSON.load(rc.body)), err end |
#screenshot_update(project_id, id, params) ⇒ Object
Update an existing screenshot. API Path: /api/v2/projects/:project_id/screenshots/:id
Parameters:
- project_id
-
project_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::ScreenshotParams
Returns:
PhraseApp::ResponseObjects::Screenshot
err
7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 |
# File 'lib/phraseapp-ruby.rb', line 7262 def screenshot_update(project_id, id, params) path = sprintf("/api/v2/projects/%s/screenshots/%s", project_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::ScreenshotParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ScreenshotParams") end end if params.description != nil data_hash["description"] = params.description end if params.filename != nil post_body = [] post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n" post_body << "Content-Disposition: form-data; name=\"filename\"; filename=\"#{File.basename(params.filename )}\"\r\n" post_body << "Content-Type: text/plain\r\n" post_body << "\r\n" post_body << File.read(params.filename) post_body << "\r\n" end if params.name != nil data_hash["name"] = params.name 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::Screenshot.new(JSON.load(rc.body)), err end |
#screenshots_list(project_id, page, per_page) ⇒ Object
List all screenshots for the given project. API Path: /api/v2/projects/:project_id/screenshots
Parameters:
- project_id
-
project_id
Returns:
PhraseApp::ResponseObjects::Screenshot
err
7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 |
# File 'lib/phraseapp-ruby.rb', line 7462 def screenshots_list(project_id, page, per_page) path = sprintf("/api/v2/projects/%s/screenshots", 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::Screenshot.new(item) }, err end |
#show_user ⇒ Object
Show details for current User. API Path: /api/v2/user
Parameters:
Returns:
PhraseApp::ResponseObjects::User
err
7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 |
# File 'lib/phraseapp-ruby.rb', line 7483 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
7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 |
# File 'lib/phraseapp-ruby.rb', line 7508 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
7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 |
# File 'lib/phraseapp-ruby.rb', line 7543 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
7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 |
# File 'lib/phraseapp-ruby.rb', line 7568 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
7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 |
# File 'lib/phraseapp-ruby.rb', line 7595 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
7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 |
# File 'lib/phraseapp-ruby.rb', line 7629 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
7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 |
# File 'lib/phraseapp-ruby.rb', line 7654 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, params) ⇒ Object
Delete an existing tag. API Path: /api/v2/projects/:project_id/tags/:name
Parameters:
- project_id
-
project_id
- name
-
name
- params
-
Parameters of type PhraseApp::RequestParams::TagDeleteParams
Returns:
err
7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 |
# File 'lib/phraseapp-ruby.rb', line 7691 def tag_delete(project_id, name, params) path = sprintf("/api/v2/projects/%s/tags/%s", project_id, name) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::TagDeleteParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TagDeleteParams") 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 |
#tag_show(project_id, name, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::TagShowParams
Returns:
PhraseApp::ResponseObjects::TagWithStats
err
7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 |
# File 'lib/phraseapp-ruby.rb', line 7729 def tag_show(project_id, name, params) path = sprintf("/api/v2/projects/%s/tags/%s", project_id, name) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::TagShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TagShowParams") 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::TagWithStats.new(JSON.load(rc.body)), err end |
#tags_list(project_id, page, per_page, params) ⇒ Object
List all tags for the given project. API Path: /api/v2/projects/:project_id/tags
Parameters:
- project_id
-
project_id
- params
-
Parameters of type PhraseApp::RequestParams::TagsListParams
Returns:
PhraseApp::ResponseObjects::Tag
err
7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 |
# File 'lib/phraseapp-ruby.rb', line 7765 def (project_id, page, per_page, params) path = sprintf("/api/v2/projects/%s/tags", project_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::TagsListParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TagsListParams") 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::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
7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 |
# File 'lib/phraseapp-ruby.rb', line 7801 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, params) ⇒ Object
Get details on a single translation. API Path: /api/v2/projects/:project_id/translations/:id
Parameters:
- project_id
-
project_id
- id
-
id
- params
-
Parameters of type PhraseApp::RequestParams::TranslationShowParams
Returns:
PhraseApp::ResponseObjects::TranslationDetails
err
7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 |
# File 'lib/phraseapp-ruby.rb', line 7839 def translation_show(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::TranslationShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::TranslationShowParams") 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::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
7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 |
# File 'lib/phraseapp-ruby.rb', line 7877 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
7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 |
# File 'lib/phraseapp-ruby.rb', line 7915 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
7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 |
# File 'lib/phraseapp-ruby.rb', line 7953 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
7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 |
# File 'lib/phraseapp-ruby.rb', line 7989 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
8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 |
# File 'lib/phraseapp-ruby.rb', line 8025 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
8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 |
# File 'lib/phraseapp-ruby.rb', line 8061 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
Search translations for the given project. Provides the same search interface as translations#index
but allows POST requests to avoid limitations imposed by GET requests. 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
8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 |
# File 'lib/phraseapp-ruby.rb', line 8097 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
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
8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 |
# File 'lib/phraseapp-ruby.rb', line 8133 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
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
8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 |
# File 'lib/phraseapp-ruby.rb', line 8169 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
8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 |
# File 'lib/phraseapp-ruby.rb', line 8205 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. != nil params..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.mark_reviewed != nil data_hash["mark_reviewed"] = (params.mark_reviewed == true) end if params.skip_unverification != nil data_hash["skip_unverification"] = (params.skip_unverification == true) end if params. != nil data_hash["skip_upload_tags"] = (params. == true) end if params. != nil data_hash["tags"] = params. 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
8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 |
# File 'lib/phraseapp-ruby.rb', line 8309 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, params) ⇒ Object
List all uploads for the given project. API Path: /api/v2/projects/:project_id/uploads
Parameters:
- project_id
-
project_id
- params
-
Parameters of type PhraseApp::RequestParams::UploadsListParams
Returns:
PhraseApp::ResponseObjects::Upload
err
8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 |
# File 'lib/phraseapp-ruby.rb', line 8345 def uploads_list(project_id, page, per_page, params) path = sprintf("/api/v2/projects/%s/uploads", project_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::UploadsListParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::UploadsListParams") 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::Upload.new(item) }, err end |
#version_show(project_id, translation_id, id, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::VersionShowParams
Returns:
PhraseApp::ResponseObjects::TranslationVersionWithUser
err
8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 |
# File 'lib/phraseapp-ruby.rb', line 8385 def version_show(project_id, translation_id, id, params) path = sprintf("/api/v2/projects/%s/translations/%s/versions/%s", project_id, translation_id, id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::VersionShowParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::VersionShowParams") 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::TranslationVersionWithUser.new(JSON.load(rc.body)), err end |
#versions_list(project_id, translation_id, page, per_page, params) ⇒ 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
- params
-
Parameters of type PhraseApp::RequestParams::VersionsListParams
Returns:
PhraseApp::ResponseObjects::TranslationVersion
err
8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 |
# File 'lib/phraseapp-ruby.rb', line 8423 def versions_list(project_id, translation_id, page, per_page, params) path = sprintf("/api/v2/projects/%s/translations/%s/versions", project_id, translation_id) data_hash = {} post_body = nil if params.present? unless params.kind_of?(PhraseApp::RequestParams::VersionsListParams) raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::VersionsListParams") 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::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
8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 |
# File 'lib/phraseapp-ruby.rb', line 8459 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
8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 |
# File 'lib/phraseapp-ruby.rb', line 8494 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
8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 |
# File 'lib/phraseapp-ruby.rb', line 8519 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
8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 |
# File 'lib/phraseapp-ruby.rb', line 8543 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
8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 |
# File 'lib/phraseapp-ruby.rb', line 8570 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
8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 |
# File 'lib/phraseapp-ruby.rb', line 8604 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 |