crowdin-api 0.4.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/build-and-publish.yml +30 -0
  3. data/.github/workflows/test-and-lint.yml +31 -0
  4. data/.gitignore +12 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +5 -0
  7. data/.rubocop_todo.yml +139 -0
  8. data/CODE_OF_CONDUCT.md +128 -0
  9. data/CONTRIBUTING.md +71 -0
  10. data/Gemfile +5 -0
  11. data/LICENSE +1 -1
  12. data/README.md +114 -267
  13. data/Rakefile +19 -0
  14. data/bin/crowdin-console +54 -0
  15. data/bin/setup +6 -0
  16. data/crowdin-api.gemspec +33 -0
  17. data/lib/crowdin-api/api-resources/languages.rb +81 -0
  18. data/lib/crowdin-api/api-resources/projects.rb +134 -0
  19. data/lib/crowdin-api/api-resources/source_files.rb +303 -0
  20. data/lib/crowdin-api/api-resources/source_strings.rb +74 -0
  21. data/lib/crowdin-api/api-resources/storages.rb +102 -0
  22. data/lib/crowdin-api/api-resources/translation_status.rb +89 -0
  23. data/lib/crowdin-api/api-resources/translations.rb +160 -0
  24. data/lib/crowdin-api/api-resources/workflows.rb +59 -0
  25. data/lib/crowdin-api/client/client.rb +82 -0
  26. data/lib/crowdin-api/client/configuration.rb +44 -0
  27. data/lib/crowdin-api/client/version.rb +7 -0
  28. data/lib/crowdin-api/core/api_errors_raiser.rb +29 -0
  29. data/lib/crowdin-api/core/errors.rb +7 -0
  30. data/lib/crowdin-api/core/request.rb +115 -0
  31. data/lib/crowdin-api.rb +23 -127
  32. data/spec/core/config-instance_spec.rb +72 -0
  33. data/spec/crowdin-api_spec.rb +7 -0
  34. data/spec/spec_helper.rb +9 -0
  35. metadata +129 -57
  36. data/lib/crowdin-api/errors.rb +0 -23
  37. data/lib/crowdin-api/methods.rb +0 -427
  38. data/lib/crowdin-api/version.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8c138f45a8854edffda7bcb6bc573895758b6e20
4
- data.tar.gz: aa1132583f473f6b27d6a3631f8353fb6fb74072
2
+ SHA256:
3
+ metadata.gz: cc71aeec74dd34cef85bb90b9accdd273d18ce3fd8ba9888eb3ce6a073e6aff0
4
+ data.tar.gz: 39e8290a34930ad659e1ad5879f4f91283f82f88f2316c7f64f03ef524de35cc
5
5
  SHA512:
6
- metadata.gz: cb3a25cd79a827e583cf4329b086d9b5156b6de3f5bdb6afeafd944b09c3b3b923dd557c9b312c94840a1a53bf67022aced7ed029e555017c213110049e6d896
7
- data.tar.gz: fc721048b93b6f4961d4b5457af231398d509a950e65623aa1d4c09128b61d342e38113c8276e7535094389c7b867c5c4502ee4f4c8121b135816d2940633110
6
+ metadata.gz: d95cbb784a0148eab14bce79dff1dd70735e60aecad95f3be2402ac525581bae5c42dfce8f888ab7255fa3096f7153201a3256d3a6f41821a35f9eaec215abab
7
+ data.tar.gz: 4b9604fa346136d64a69beb7643beff66433cbbc9102242f56bac6b3f9ebd23e29cc70339e63b9c1a754ce77cf71a6c624d1b97120a5b7f82fb3dbdcb3b23054
@@ -0,0 +1,30 @@
1
+ name: Build and Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ packages: write
13
+ contents: read
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby 2.6
17
+ uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
18
+ with:
19
+ ruby-version: 2.6
20
+ - run: bundle install
21
+ - name: Publish to RubyGems
22
+ run: |
23
+ mkdir -p $HOME/.gem
24
+ touch $HOME/.gem/credentials
25
+ chmod 0600 $HOME/.gem/credentials
26
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27
+ gem build *.gemspec
28
+ gem push *.gem
29
+ env:
30
+ GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
@@ -0,0 +1,31 @@
1
+ name: Test and Lint
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '**'
7
+ pull_request:
8
+ branches: [ main ]
9
+
10
+ jobs:
11
+ test-and-lint:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ['2.6', '2.7', '3.0']
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+ - name: Run tests and linter
25
+ run: |
26
+ bundle exec rubocop
27
+ bundle exec rake
28
+ - name: Publish code coverage report
29
+ uses: codecov/codecov-action@v1
30
+ with:
31
+ token: ${{ secrets.CODECOV_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ # Ignore Ruby logs
2
+ .ruby-version
3
+ .idea
4
+
5
+ # Ignore MacOS logs
6
+ .DS_Store
7
+
8
+ # Ignore versioning file
9
+ Gemfile.lock
10
+
11
+ # Ignore tests coverage folder
12
+ coverage
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ SuggestExtensions: false
5
+ NewCops: enable
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,139 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-12-13 20:26:23 UTC using RuboCop version 1.23.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/RequireMFA:
14
+ Exclude:
15
+ - 'crowdin-api.gemspec'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'crowdin-api.gemspec'
23
+
24
+ # Offense count: 2
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
27
+ Layout/ExtraSpacing:
28
+ Exclude:
29
+ - 'bin/crowdin-console'
30
+
31
+ # Offense count: 1
32
+ # Cop supports --auto-correct.
33
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
34
+ # SupportedStylesForExponentOperator: space, no_space
35
+ Layout/SpaceAroundOperators:
36
+ Exclude:
37
+ - 'crowdin-api.gemspec'
38
+
39
+ # Offense count: 2
40
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
41
+ Metrics/AbcSize:
42
+ Max: 23
43
+
44
+ # Offense count: 1
45
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
46
+ # IgnoredMethods: refine
47
+ Metrics/BlockLength:
48
+ Max: 54
49
+
50
+ # Offense count: 4
51
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
52
+ Metrics/MethodLength:
53
+ Max: 18
54
+
55
+ # Offense count: 2
56
+ # Configuration parameters: CountComments, CountAsOne.
57
+ Metrics/ModuleLength:
58
+ Max: 205
59
+
60
+ # Offense count: 1
61
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
62
+ Metrics/ParameterLists:
63
+ Max: 6
64
+
65
+ # Offense count: 1
66
+ Naming/AccessorMethodName:
67
+ Exclude:
68
+ - 'lib/crowdin-api/core/request.rb'
69
+
70
+ # Offense count: 3
71
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
72
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
73
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
74
+ Naming/FileName:
75
+ Exclude:
76
+ - 'lib/crowdin-api.rb'
77
+ - 'spec/core/config-instance_spec.rb'
78
+ - 'spec/crowdin-api_spec.rb'
79
+
80
+ # Offense count: 3
81
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
82
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
83
+ Naming/MemoizedInstanceVariableName:
84
+ Exclude:
85
+ - 'lib/crowdin-api/client/client.rb'
86
+
87
+ # Offense count: 3
88
+ # Cop supports --auto-correct.
89
+ # Configuration parameters: PreferredName.
90
+ Naming/RescuedExceptionsVariableName:
91
+ Exclude:
92
+ - 'lib/crowdin-api/core/request.rb'
93
+
94
+ # Offense count: 7
95
+ # Cop supports --auto-correct.
96
+ # Configuration parameters: EnforcedStyle.
97
+ # SupportedStyles: separated, grouped
98
+ Style/AccessorGrouping:
99
+ Exclude:
100
+ - 'lib/crowdin-api/client/client.rb'
101
+ - 'lib/crowdin-api/client/configuration.rb'
102
+
103
+ # Offense count: 2
104
+ # Cop supports --auto-correct.
105
+ Style/CollectionCompact:
106
+ Exclude:
107
+ - 'lib/crowdin-api/core/request.rb'
108
+
109
+ # Offense count: 12
110
+ # Configuration parameters: AllowedConstants.
111
+ Style/Documentation:
112
+ Exclude:
113
+ - 'spec/**/*'
114
+ - 'test/**/*'
115
+ - 'lib/crowdin-api/api-resources/languages.rb'
116
+ - 'lib/crowdin-api/api-resources/projects.rb'
117
+ - 'lib/crowdin-api/api-resources/source_files.rb'
118
+ - 'lib/crowdin-api/api-resources/source_strings.rb'
119
+ - 'lib/crowdin-api/api-resources/storages.rb'
120
+ - 'lib/crowdin-api/api-resources/translation_status.rb'
121
+ - 'lib/crowdin-api/api-resources/translations.rb'
122
+ - 'lib/crowdin-api/api-resources/workflows.rb'
123
+ - 'lib/crowdin-api/client/client.rb'
124
+ - 'lib/crowdin-api/client/configuration.rb'
125
+ - 'lib/crowdin-api/core/api_errors_raiser.rb'
126
+ - 'lib/crowdin-api/core/request.rb'
127
+
128
+ # Offense count: 1
129
+ # Cop supports --auto-correct.
130
+ # Configuration parameters: EnforcedStyle.
131
+ # SupportedStyles: always, always_true, never
132
+ Style/FrozenStringLiteralComment:
133
+ Exclude:
134
+ - 'bin/crowdin-console'
135
+
136
+ # Offense count: 1
137
+ Style/MixinUsage:
138
+ Exclude:
139
+ - 'bin/crowdin-console'
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ support@crowdin.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,71 @@
1
+ # Contributing
2
+
3
+ :tada: First off, thanks for taking the time to contribute! :tada:
4
+
5
+ The following is a set of guidelines for contributing to Crowdin Ruby Client. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
6
+
7
+ This project and everyone participating in it are governed by the [Code of Conduct](/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
8
+
9
+ ## How can I contribute?
10
+
11
+ ### Star this repo
12
+
13
+ It's quick and goes a long way! :stars:
14
+
15
+ ### Reporting Bugs
16
+
17
+ This section guides you through submitting a bug report for Crowdin Ruby Client. Following these guidelines helps maintainers, and the community understand your report :pencil:, reproduce the behavior :computer:, and find related reports :mag_right:.
18
+
19
+ When you are creating a bug report, please include as many details as possible.
20
+
21
+ #### How Do I Submit a Bug Report?
22
+
23
+ Bugs are tracked as [GitHub issues](https://github.com/crowdin/crowdin-api-client-ruby/issues/).
24
+
25
+ Explain the problem and include additional details to help reproduce the problem:
26
+
27
+ * **Use a clear and descriptive title** for the issue to identify the problem.
28
+ * **Describe the exact steps which reproduce the problem** in as many details as possible. Don't just say what you did, but explain how you did it.
29
+ * **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
30
+ * **Explain which behavior you expected to see instead and why.**
31
+
32
+ Include details about your environment.
33
+
34
+ ### Suggesting Enhancements
35
+
36
+ This section guides you through submitting an enhancement suggestion for Crowdin Ruby Client. Following these guidelines helps maintainers and the community understand your suggestion :pencil: and find related suggestions :mag_right:.
37
+
38
+ When you are creating an enhancement suggestion, please include as many details as possible.
39
+
40
+ #### How Do I Submit an Enhancement Suggestion?
41
+
42
+ Enhancement suggestions are tracked as [GitHub issues](https://github.com/crowdin/crowdin-api-client-ruby/issues/).
43
+
44
+ Create an issue on that repository and provide the following information:
45
+
46
+ * **Use a clear and descriptive title** for the issue to identify the suggestion.
47
+ * **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
48
+ * **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
49
+ * **Explain why this enhancement would be useful** to most Ruby Client users.
50
+
51
+ ### Your First Code Contribution
52
+
53
+ Unsure where to begin contributing to Crowdin Ruby Client? You can start by looking through these `good-first-issue` and `help-wanted` issues:
54
+
55
+ * [Good first issue](https://github.com/crowdin/crowdin-api-client-ruby/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) - issues which should only require a small amount of code, and a test or two.
56
+ * [Help wanted](https://github.com/crowdin/crowdin-api-client-ruby/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) - issues which should be a bit more involved than `Good first issue` issues.
57
+
58
+ #### Pull Request Checklist
59
+
60
+ Before sending your pull requests, make sure you followed the list below:
61
+
62
+ - Read this guidelines.
63
+ - Read [Code of Conduct](/CODE_OF_CONDUCT.md).
64
+ - Ensure that your code adheres to standard conventions, as used in the rest of the project.
65
+ - Ensure that there are unit tests for your code.
66
+ - Run unit tests.
67
+
68
+ #### Philosophy of code contribution
69
+
70
+ - Include unit tests when you contribute new features, as they help to a) prove that your code works correctly, and b) guard against future breaking changes to lower the maintenance cost.
71
+ - Bug fixes also generally require unit tests, because the presence of bugs usually indicates insufficient test coverage.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2012-2014 Anton Maminov
3
+ Copyright (c) 2021 Crowdin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal