phraseapp-ruby 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/phraseapp-ruby.rb +351 -0
  3. data/lib/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0eea924c065d13a8e7336118e4de8a796f71733
4
- data.tar.gz: a1e928e85fe3ac3c9dbbef6e13a76bbee56f0b2c
3
+ metadata.gz: 4caf83d60f3e12126d0acf8a77e8508f5e24502b
4
+ data.tar.gz: 2ba69581362cf717a18bc1c61557908ae0d2f4f9
5
5
  SHA512:
6
- metadata.gz: 8fe5749736f80a222ea9bfc341769e4332215d7d730b405a626753ce1c00dc7fe69ea6057c82427c5befd66b87c50b4bfbb3081a6cce4c3a159f2e686f145972
7
- data.tar.gz: fecf3b80b1248dcd4e2abb7fc3de9fc018ead7dfe7047cfee7207563ec01f280b8a92a8a2ff9251148f5a118db2b91b90613ce190ac2c2c7ef93fbdbc5244741
6
+ metadata.gz: eac4418e5f119507759584ed277c71f7b25e5bd566769c956517600e09a93e635c60fa9ef211d9f9f10c45243437e8ba9fe387ad9e86100ed00a8b97a9816468
7
+ data.tar.gz: 46efb8abe5808275d83887b72b3642a696ab594a7c65eaa29a91da706c4dd4dc4a29a57b733dbc1f2d689467242b48fc417a27776db2d202a1d3445d2d825cad
@@ -804,6 +804,213 @@ class PhraseApp::RequestHelper
804
804
  end
805
805
  end
806
806
 
807
+ class PhraseApp::ParamsError < StandardError; end
808
+
809
+
810
+ class PhraseApp::KeyListParams < ::OpenStruct
811
+ # :locale_id, :order, :sort, :translated,
812
+ def locale_id=(val)
813
+ self.locale_id = val
814
+ end
815
+
816
+ def order=(val)
817
+ self.order = val
818
+ end
819
+
820
+ def sort=(val)
821
+ self.sort = val
822
+ end
823
+
824
+ def translated=(val)
825
+ if val == "true"
826
+ self.translated = true
827
+ elsif val == "false" #ignore
828
+ self.translated = b
829
+ else
830
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
831
+ end
832
+ end
833
+
834
+ def validate
835
+
836
+ end
837
+ end
838
+
839
+ class PhraseApp::LocaleDownloadParams < ::OpenStruct
840
+ # :convert_emoji, :format, :format_options, :include_empty_translations, :keep_notranslate_tags, :tag_id,
841
+ def convert_emoji=(val)
842
+ if val == "true"
843
+ self.convert_emoji = true
844
+ elsif val == "false" #ignore
845
+ self.convert_emoji = b
846
+ else
847
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
848
+ end
849
+ end
850
+
851
+ def format=(val)
852
+ self.format = val
853
+ end
854
+
855
+ def format_options=(val)
856
+ self.format_options = JSON.load(val)
857
+ end
858
+
859
+ def include_empty_translations=(val)
860
+ if val == "true"
861
+ self.include_empty_translations = true
862
+ elsif val == "false" #ignore
863
+ self.include_empty_translations = b
864
+ else
865
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
866
+ end
867
+ end
868
+
869
+ def keep_notranslate_tags=(val)
870
+ if val == "true"
871
+ self.keep_notranslate_tags = true
872
+ elsif val == "false" #ignore
873
+ self.keep_notranslate_tags = b
874
+ else
875
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
876
+ end
877
+ end
878
+
879
+ def tag_id=(val)
880
+ self.tag_id = val
881
+ end
882
+
883
+ def validate
884
+ if self.format == nil || self.format == ""
885
+ raise PhraseApp::ParamsValidationError.new("Required parameter \"format\" of \"locale_downloadParams\" not set")
886
+ end
887
+ end
888
+ end
889
+
890
+ class PhraseApp::TranslationListAllParams < ::OpenStruct
891
+ # :order, :since, :sort, :unverified,
892
+ def order=(val)
893
+ self.order = val
894
+ end
895
+
896
+ def since=(val)
897
+ self.since = Time.parse(val)
898
+ end
899
+
900
+ def sort=(val)
901
+ self.sort = val
902
+ end
903
+
904
+ def unverified=(val)
905
+ if val == "true"
906
+ self.unverified = true
907
+ elsif val == "false" #ignore
908
+ self.unverified = b
909
+ else
910
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
911
+ end
912
+ end
913
+
914
+ def validate
915
+
916
+ end
917
+ end
918
+
919
+ class PhraseApp::TranslationListKeyParams < ::OpenStruct
920
+ # :order, :since, :sort, :unverified,
921
+ def order=(val)
922
+ self.order = val
923
+ end
924
+
925
+ def since=(val)
926
+ self.since = Time.parse(val)
927
+ end
928
+
929
+ def sort=(val)
930
+ self.sort = val
931
+ end
932
+
933
+ def unverified=(val)
934
+ if val == "true"
935
+ self.unverified = true
936
+ elsif val == "false" #ignore
937
+ self.unverified = b
938
+ else
939
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
940
+ end
941
+ end
942
+
943
+ def validate
944
+
945
+ end
946
+ end
947
+
948
+ class PhraseApp::TranslationListLocaleParams < ::OpenStruct
949
+ # :order, :since, :sort, :unverified,
950
+ def order=(val)
951
+ self.order = val
952
+ end
953
+
954
+ def since=(val)
955
+ self.since = Time.parse(val)
956
+ end
957
+
958
+ def sort=(val)
959
+ self.sort = val
960
+ end
961
+
962
+ def unverified=(val)
963
+ if val == "true"
964
+ self.unverified = true
965
+ elsif val == "false" #ignore
966
+ self.unverified = b
967
+ else
968
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
969
+ end
970
+ end
971
+
972
+ def validate
973
+
974
+ end
975
+ end
976
+
977
+ class PhraseApp::TranslationUpdateParams < ::OpenStruct
978
+ # :content, :excluded, :plural_suffix, :unverified,
979
+ def content=(val)
980
+ self.content = val
981
+ end
982
+
983
+ def excluded=(val)
984
+ if val == "true"
985
+ self.excluded = true
986
+ elsif val == "false" #ignore
987
+ self.excluded = b
988
+ else
989
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
990
+ end
991
+ end
992
+
993
+ def plural_suffix=(val)
994
+ self.plural_suffix = val
995
+ end
996
+
997
+ def unverified=(val)
998
+ if val == "true"
999
+ self.unverified = true
1000
+ elsif val == "false" #ignore
1001
+ self.unverified = b
1002
+ else
1003
+ PhraseApp::ParamsValidationError.new("invalid value #{val}")
1004
+ end
1005
+ end
1006
+
1007
+ def validate
1008
+ if self.content == nil || self.content == ""
1009
+ raise PhraseApp::ParamsValidationError.new("Required parameter \"content\" of \"translation_updateParams\" not set")
1010
+ end
1011
+ end
1012
+ end
1013
+
807
1014
  class PhraseApp::Client
808
1015
 
809
1016
  # Create a new authorization.
@@ -812,6 +1019,12 @@ class PhraseApp::Client
812
1019
  data_hash = {}
813
1020
  post_body = nil
814
1021
 
1022
+ if params.present?
1023
+ unless params.kind_of?(PhraseApp::AuthorizationCreateParams)
1024
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::AuthorizationCreateParams")
1025
+ end
1026
+ end
1027
+
815
1028
  data_hash = params.to_h
816
1029
  err = params.validate
817
1030
  if err != nil
@@ -877,6 +1090,12 @@ class PhraseApp::Client
877
1090
  data_hash = {}
878
1091
  post_body = nil
879
1092
 
1093
+ if params.present?
1094
+ unless params.kind_of?(PhraseApp::AuthorizationUpdateParams)
1095
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::AuthorizationUpdateParams")
1096
+ end
1097
+ end
1098
+
880
1099
  data_hash = params.to_h
881
1100
  err = params.validate
882
1101
  if err != nil
@@ -897,6 +1116,12 @@ class PhraseApp::Client
897
1116
  data_hash = {}
898
1117
  post_body = nil
899
1118
 
1119
+ if params.present?
1120
+ unless params.kind_of?(PhraseApp::BlacklistKeyCreateParams)
1121
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::BlacklistKeyCreateParams")
1122
+ end
1123
+ end
1124
+
900
1125
  data_hash = params.to_h
901
1126
  err = params.validate
902
1127
  if err != nil
@@ -947,6 +1172,12 @@ class PhraseApp::Client
947
1172
  data_hash = {}
948
1173
  post_body = nil
949
1174
 
1175
+ if params.present?
1176
+ unless params.kind_of?(PhraseApp::BlacklistKeyUpdateParams)
1177
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::BlacklistKeyUpdateParams")
1178
+ end
1179
+ end
1180
+
950
1181
  data_hash = params.to_h
951
1182
  err = params.validate
952
1183
  if err != nil
@@ -982,6 +1213,12 @@ class PhraseApp::Client
982
1213
  data_hash = {}
983
1214
  post_body = nil
984
1215
 
1216
+ if params.present?
1217
+ unless params.kind_of?(PhraseApp::CommentCreateParams)
1218
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::CommentCreateParams")
1219
+ end
1220
+ end
1221
+
985
1222
  data_hash = params.to_h
986
1223
  err = params.validate
987
1224
  if err != nil
@@ -1092,6 +1329,12 @@ class PhraseApp::Client
1092
1329
  data_hash = {}
1093
1330
  post_body = nil
1094
1331
 
1332
+ if params.present?
1333
+ unless params.kind_of?(PhraseApp::CommentUpdateParams)
1334
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::CommentUpdateParams")
1335
+ end
1336
+ end
1337
+
1095
1338
  data_hash = params.to_h
1096
1339
  err = params.validate
1097
1340
  if err != nil
@@ -1126,6 +1369,12 @@ class PhraseApp::Client
1126
1369
  path = sprintf("/v2/projects/%s/keys", project_id)
1127
1370
  data_hash = {}
1128
1371
  post_body = nil
1372
+
1373
+ if params.present?
1374
+ unless params.kind_of?(PhraseApp::KeyCreateParams)
1375
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeyCreateParams")
1376
+ end
1377
+ end
1129
1378
  if params.data_type != nil
1130
1379
  data_hash["data_type"] = params.data_type
1131
1380
  end
@@ -1216,6 +1465,12 @@ class PhraseApp::Client
1216
1465
  data_hash = {}
1217
1466
  post_body = nil
1218
1467
 
1468
+ if params.present?
1469
+ unless params.kind_of?(PhraseApp::KeyListParams)
1470
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeyListParams")
1471
+ end
1472
+ end
1473
+
1219
1474
  data_hash = params.to_h
1220
1475
  err = params.validate
1221
1476
  if err != nil
@@ -1250,6 +1505,12 @@ class PhraseApp::Client
1250
1505
  path = sprintf("/v2/projects/%s/keys/%s", project_id, id)
1251
1506
  data_hash = {}
1252
1507
  post_body = nil
1508
+
1509
+ if params.present?
1510
+ unless params.kind_of?(PhraseApp::KeyUpdateParams)
1511
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeyUpdateParams")
1512
+ end
1513
+ end
1253
1514
  if params.data_type != nil
1254
1515
  data_hash["data_type"] = params.data_type
1255
1516
  end
@@ -1325,6 +1586,12 @@ class PhraseApp::Client
1325
1586
  data_hash = {}
1326
1587
  post_body = nil
1327
1588
 
1589
+ if params.present?
1590
+ unless params.kind_of?(PhraseApp::LocaleCreateParams)
1591
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::LocaleCreateParams")
1592
+ end
1593
+ end
1594
+
1328
1595
  data_hash = params.to_h
1329
1596
  err = params.validate
1330
1597
  if err != nil
@@ -1360,6 +1627,12 @@ class PhraseApp::Client
1360
1627
  data_hash = {}
1361
1628
  post_body = nil
1362
1629
 
1630
+ if params.present?
1631
+ unless params.kind_of?(PhraseApp::LocaleDownloadParams)
1632
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::LocaleDownloadParams")
1633
+ end
1634
+ end
1635
+
1363
1636
  data_hash = params.to_h
1364
1637
  err = params.validate
1365
1638
  if err != nil
@@ -1410,6 +1683,12 @@ class PhraseApp::Client
1410
1683
  data_hash = {}
1411
1684
  post_body = nil
1412
1685
 
1686
+ if params.present?
1687
+ unless params.kind_of?(PhraseApp::LocaleUpdateParams)
1688
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::LocaleUpdateParams")
1689
+ end
1690
+ end
1691
+
1413
1692
  data_hash = params.to_h
1414
1693
  err = params.validate
1415
1694
  if err != nil
@@ -1445,6 +1724,12 @@ class PhraseApp::Client
1445
1724
  data_hash = {}
1446
1725
  post_body = nil
1447
1726
 
1727
+ if params.present?
1728
+ unless params.kind_of?(PhraseApp::OrderCreateParams)
1729
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::OrderCreateParams")
1730
+ end
1731
+ end
1732
+
1448
1733
  data_hash = params.to_h
1449
1734
  err = params.validate
1450
1735
  if err != nil
@@ -1510,6 +1795,12 @@ class PhraseApp::Client
1510
1795
  data_hash = {}
1511
1796
  post_body = nil
1512
1797
 
1798
+ if params.present?
1799
+ unless params.kind_of?(PhraseApp::ProjectCreateParams)
1800
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::ProjectCreateParams")
1801
+ end
1802
+ end
1803
+
1513
1804
  data_hash = params.to_h
1514
1805
  err = params.validate
1515
1806
  if err != nil
@@ -1575,6 +1866,12 @@ class PhraseApp::Client
1575
1866
  data_hash = {}
1576
1867
  post_body = nil
1577
1868
 
1869
+ if params.present?
1870
+ unless params.kind_of?(PhraseApp::ProjectUpdateParams)
1871
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::ProjectUpdateParams")
1872
+ end
1873
+ end
1874
+
1578
1875
  data_hash = params.to_h
1579
1876
  err = params.validate
1580
1877
  if err != nil
@@ -1610,6 +1907,12 @@ class PhraseApp::Client
1610
1907
  data_hash = {}
1611
1908
  post_body = nil
1612
1909
 
1910
+ if params.present?
1911
+ unless params.kind_of?(PhraseApp::StyleguideCreateParams)
1912
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::StyleguideCreateParams")
1913
+ end
1914
+ end
1915
+
1613
1916
  data_hash = params.to_h
1614
1917
  err = params.validate
1615
1918
  if err != nil
@@ -1675,6 +1978,12 @@ class PhraseApp::Client
1675
1978
  data_hash = {}
1676
1979
  post_body = nil
1677
1980
 
1981
+ if params.present?
1982
+ unless params.kind_of?(PhraseApp::StyleguideUpdateParams)
1983
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::StyleguideUpdateParams")
1984
+ end
1985
+ end
1986
+
1678
1987
  data_hash = params.to_h
1679
1988
  err = params.validate
1680
1989
  if err != nil
@@ -1695,6 +2004,12 @@ class PhraseApp::Client
1695
2004
  data_hash = {}
1696
2005
  post_body = nil
1697
2006
 
2007
+ if params.present?
2008
+ unless params.kind_of?(PhraseApp::TagCreateParams)
2009
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TagCreateParams")
2010
+ end
2011
+ end
2012
+
1698
2013
  data_hash = params.to_h
1699
2014
  err = params.validate
1700
2015
  if err != nil
@@ -1760,6 +2075,12 @@ class PhraseApp::Client
1760
2075
  data_hash = {}
1761
2076
  post_body = nil
1762
2077
 
2078
+ if params.present?
2079
+ unless params.kind_of?(PhraseApp::TranslationCreateParams)
2080
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationCreateParams")
2081
+ end
2082
+ end
2083
+
1763
2084
  data_hash = params.to_h
1764
2085
  err = params.validate
1765
2086
  if err != nil
@@ -1780,6 +2101,12 @@ class PhraseApp::Client
1780
2101
  data_hash = {}
1781
2102
  post_body = nil
1782
2103
 
2104
+ if params.present?
2105
+ unless params.kind_of?(PhraseApp::TranslationListAllParams)
2106
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationListAllParams")
2107
+ end
2108
+ end
2109
+
1783
2110
  data_hash = params.to_h
1784
2111
  err = params.validate
1785
2112
  if err != nil
@@ -1800,6 +2127,12 @@ class PhraseApp::Client
1800
2127
  data_hash = {}
1801
2128
  post_body = nil
1802
2129
 
2130
+ if params.present?
2131
+ unless params.kind_of?(PhraseApp::TranslationListKeyParams)
2132
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationListKeyParams")
2133
+ end
2134
+ end
2135
+
1803
2136
  data_hash = params.to_h
1804
2137
  err = params.validate
1805
2138
  if err != nil
@@ -1820,6 +2153,12 @@ class PhraseApp::Client
1820
2153
  data_hash = {}
1821
2154
  post_body = nil
1822
2155
 
2156
+ if params.present?
2157
+ unless params.kind_of?(PhraseApp::TranslationListLocaleParams)
2158
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationListLocaleParams")
2159
+ end
2160
+ end
2161
+
1823
2162
  data_hash = params.to_h
1824
2163
  err = params.validate
1825
2164
  if err != nil
@@ -1855,6 +2194,12 @@ class PhraseApp::Client
1855
2194
  data_hash = {}
1856
2195
  post_body = nil
1857
2196
 
2197
+ if params.present?
2198
+ unless params.kind_of?(PhraseApp::TranslationUpdateParams)
2199
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationUpdateParams")
2200
+ end
2201
+ end
2202
+
1858
2203
  data_hash = params.to_h
1859
2204
  err = params.validate
1860
2205
  if err != nil
@@ -1874,6 +2219,12 @@ class PhraseApp::Client
1874
2219
  path = sprintf("/v2/projects/%s/uploads", project_id)
1875
2220
  data_hash = {}
1876
2221
  post_body = nil
2222
+
2223
+ if params.present?
2224
+ unless params.kind_of?(PhraseApp::UploadCreateParams)
2225
+ raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::UploadCreateParams")
2226
+ end
2227
+ end
1877
2228
  if params.convert_emoji != nil
1878
2229
  data_hash["convert_emoji"] = (params.convert_emoji == "true")
1879
2230
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PhraseApp
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phraseapp-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhraseApp