gladwords 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +34 -0
  3. data/.gitignore +4 -0
  4. data/.projections.json +5 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +57 -0
  7. data/.rubocop_todo.yml +32 -0
  8. data/.vim/coc-settings.json +12 -0
  9. data/.vim/install.sh +38 -0
  10. data/.vscode/launch.json +13 -0
  11. data/.vscode/settings.json +9 -0
  12. data/.vscode/tasks.json +21 -0
  13. data/Gemfile +20 -0
  14. data/Gemfile.lock +200 -0
  15. data/LICENSE.txt +21 -0
  16. data/README.md +71 -0
  17. data/Rakefile +15 -0
  18. data/bin/rake +31 -0
  19. data/bin/rspec +31 -0
  20. data/bin/solargraph +29 -0
  21. data/config/environment.rb +3 -0
  22. data/gladwords.code-workspace +11 -0
  23. data/gladwords.gemspec +27 -0
  24. data/lib/ext/rom/inflector.rb +8 -0
  25. data/lib/gladwords.rb +22 -0
  26. data/lib/gladwords/associations.rb +7 -0
  27. data/lib/gladwords/associations/many_to_many.rb +18 -0
  28. data/lib/gladwords/associations/many_to_one.rb +22 -0
  29. data/lib/gladwords/associations/one_to_many.rb +19 -0
  30. data/lib/gladwords/associations/one_to_one.rb +10 -0
  31. data/lib/gladwords/associations/one_to_one_through.rb +8 -0
  32. data/lib/gladwords/commands.rb +7 -0
  33. data/lib/gladwords/commands/core.rb +76 -0
  34. data/lib/gladwords/commands/create.rb +18 -0
  35. data/lib/gladwords/commands/delete.rb +22 -0
  36. data/lib/gladwords/commands/error_wrapper.rb +25 -0
  37. data/lib/gladwords/commands/update.rb +17 -0
  38. data/lib/gladwords/errors.rb +7 -0
  39. data/lib/gladwords/gateway.rb +48 -0
  40. data/lib/gladwords/inflector.rb +20 -0
  41. data/lib/gladwords/relation.rb +197 -0
  42. data/lib/gladwords/relation/association_methods.rb +29 -0
  43. data/lib/gladwords/relation/joined_relation.rb +52 -0
  44. data/lib/gladwords/schema.rb +26 -0
  45. data/lib/gladwords/schema/attributes_inferrer.rb +171 -0
  46. data/lib/gladwords/schema/dsl.rb +28 -0
  47. data/lib/gladwords/schema/inferrer.rb +19 -0
  48. data/lib/gladwords/selector_fields_db.rb +30 -0
  49. data/lib/gladwords/selector_fields_db/v201806.json +3882 -0
  50. data/lib/gladwords/selector_fields_db/v201809.json +4026 -0
  51. data/lib/gladwords/struct.rb +24 -0
  52. data/lib/gladwords/types.rb +27 -0
  53. data/lib/gladwords/version.rb +5 -0
  54. data/rakelib/generate_selector_fields_db.rake +72 -0
  55. data/spec/integration/commands/create_spec.rb +24 -0
  56. data/spec/integration/commands/delete_spec.rb +47 -0
  57. data/spec/integration/commands/update_spec.rb +24 -0
  58. data/spec/shared/campaigns.rb +56 -0
  59. data/spec/shared/labels.rb +17 -0
  60. data/spec/spec_helper.rb +33 -0
  61. data/spec/support/adwords_helpers.rb +41 -0
  62. data/spec/unit/commands/create_spec.rb +85 -0
  63. data/spec/unit/commands/delete_spec.rb +32 -0
  64. data/spec/unit/commands/update_spec.rb +96 -0
  65. data/spec/unit/inflector_spec.rb +11 -0
  66. data/spec/unit/relation/association_methods_spec.rb +91 -0
  67. data/spec/unit/relation_spec.rb +187 -0
  68. data/spec/unit/schema/attributes_inferrer_spec.rb +83 -0
  69. data/spec/unit/selector_fields_db_spec.rb +29 -0
  70. data/spec/unit/types_spec.rb +49 -0
  71. metadata +190 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4f2a9852c35674fa161a163009e312b1ea3d6835e4d8441fe41d93384b783be7
4
+ data.tar.gz: e58efe5a624a3bbd8eb316191221e16ebdc814d324ccb6ab74c2a378c9959fd8
5
+ SHA512:
6
+ metadata.gz: c883f6044bdaa4d1889ce60fff78945ad06f3bc373dc9b9d17f8a9287f597dad76209f8d2158a169b5bd5de6ccfd12703bf5a5f76ba2f3316d3daa741dcc85ef
7
+ data.tar.gz: 3aaec34c108fd24fd68911f7b6347d406ce6f4dcf79036bc76bedbae0fa29024d0f82696b4fa6dc68e33f55c898b727dab3afa92396a07e32fbd827c624dccc5
@@ -0,0 +1,34 @@
1
+ ---
2
+ version: 2
3
+ jobs:
4
+ build:
5
+ docker:
6
+ - image: circleci/ruby:2.6
7
+ environment:
8
+ BUNDLE_JOBS: "3"
9
+ BUNDLE_RETRY: "3"
10
+ BUNDLE_PATH: vendor/bundle
11
+ steps:
12
+ - checkout
13
+
14
+ - restore_cache:
15
+ keys:
16
+ - gladwords-bundle-v2-{{ checksum "Gemfile.lock" }}
17
+ - gladwords-bundle-v2-
18
+
19
+ - run:
20
+ name: Bundle Install
21
+ command: bundle check || bundle install --without local
22
+
23
+ - save_cache:
24
+ key: gladwords-bundle-v2-{{ checksum "Gemfile.lock" }}
25
+ paths:
26
+ - vendor/bundle
27
+
28
+ - run:
29
+ name: Run specs
30
+ command: bin/rake spec
31
+
32
+ - run:
33
+ name: Run lints
34
+ command: bin/rake lint
@@ -0,0 +1,4 @@
1
+ log
2
+ tmp
3
+ .yardoc
4
+ pkg
@@ -0,0 +1,5 @@
1
+ {
2
+ "lib/gladwords/*.rb": { "alternate": "spec/unit/{}_spec.rb" },
3
+ "spec/unit/*_spec.rb": { "alternate": "lib/gladwords/{}.rb" },
4
+ "spec/integration/*_spec.rb": { "alternate": "lib/gladwords/{}.rb" }
5
+ }
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,57 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - 'rubocop-performance'
5
+
6
+ #####################
7
+ # ALL
8
+ #####################
9
+
10
+ AllCops:
11
+ UseCache: true
12
+ CacheRootDirectory: './tmp'
13
+ MaxFilesInCache: 10000
14
+ Exclude:
15
+ - 'vendor/**/*'
16
+ - 'spec/fixtures/**/*'
17
+ - 'tmp/**/*'
18
+ - 'bin/*'
19
+ TargetRubyVersion: 2.5
20
+ DisplayCopNames: true
21
+
22
+ #####################
23
+ # STYLE
24
+ #####################
25
+
26
+ Style/BlockDelimiters:
27
+ Enabled: false
28
+
29
+ Style/ClassAndModuleChildren:
30
+ Exclude:
31
+ - 'spec/**/*_spec.rb'
32
+
33
+ Style/Documentation:
34
+ Enabled: false
35
+
36
+ Style/LambdaCall:
37
+ Enabled: false
38
+
39
+ Style/Lambda:
40
+ Enabled: false
41
+
42
+ Style/SymbolArray:
43
+ Enabled: false
44
+
45
+ #####################
46
+ # METRICS
47
+ #####################
48
+
49
+ Metrics/BlockLength:
50
+ Exclude:
51
+ - 'Rakefile'
52
+ - '**/*.rake'
53
+ - 'spec/**/*'
54
+
55
+ Metrics/ModuleLength:
56
+ Exclude:
57
+ - 'spec/**/*_spec.rb'
@@ -0,0 +1,32 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-11-27 14:38:28 -0500 using RuboCop version 0.77.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: 2
10
+ Metrics/AbcSize:
11
+ Max: 17
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 122
17
+
18
+ # Offense count: 4
19
+ # Cop supports --auto-correct.
20
+ Style/IfUnlessModifier:
21
+ Exclude:
22
+ - 'lib/gladwords/relation.rb'
23
+ - 'lib/gladwords/selector_fields_db.rb'
24
+ - 'rakelib/generate_selector_fields_db.rake'
25
+ - 'spec/support/adwords_helpers.rb'
26
+
27
+ # Offense count: 27
28
+ # Cop supports --auto-correct.
29
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
30
+ # URISchemes: http, https
31
+ Metrics/LineLength:
32
+ Max: 106
@@ -0,0 +1,12 @@
1
+ {
2
+ "solargraph.commandPath": "./bin/solargraph",
3
+ "coc.preferences.formatOnSaveFiletypes": [
4
+ "ruby"
5
+ ],
6
+ "solargraph.autoformat": true,
7
+ "solargraph.formatting": true,
8
+ "solargraph.diagnostics": true,
9
+ "suggest.autoTrigger": "always",
10
+ "suggest.minTriggerInputLength": 2,
11
+ "suggest.triggerAfterInsertEnter": true
12
+ }
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -ex
4
+
5
+ setup_coc() {
6
+ # for neovim
7
+ mkdir -p ~/.local/share/nvim/site/pack/coc/start
8
+ pushd ~/.local/share/nvim/site/pack/coc/start
9
+ curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv -
10
+ popd
11
+ }
12
+
13
+ install_coc_extensions() {
14
+ # Install extensions
15
+ mkdir -p ~/.config/coc/extensions
16
+ pushd ~/.config/coc/extensions
17
+ if [ ! -f package.json ]; then
18
+ echo '{"dependencies":{}}'> package.json
19
+ fi
20
+
21
+ # COC plugins
22
+ npm install --global-style --ignore-scripts --no-bin-links --no-package-lock --only=prod \
23
+ coc-solargraph \
24
+ coc-tag \
25
+ coc-diagnostic
26
+ popd
27
+ }
28
+
29
+
30
+ setup_solargraph() {
31
+ # Solargraph docs
32
+ bundle exec solargraph download-core
33
+ bundle exec yard gems
34
+ }
35
+
36
+ setup_coc
37
+ install_coc_extensions
38
+ setup_solargraph
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "RSpec - active spec file only",
6
+ "request": "launch",
7
+ "cwd": "${workspaceRoot}",
8
+ "program": "${workspaceRoot}/bin/rspec",
9
+ "args": ["${file}:${lineNumber}"],
10
+ "type": "Ruby"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "editor.tabSize": 2,
3
+ "editor.formatOnSave": true,
4
+ "editor.formatOnSaveTimeout": 2000,
5
+ "ruby.format": "rubocop",
6
+ "ruby.lint": {
7
+ "rubocop": true
8
+ }
9
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "runner": "terminal",
4
+ "tasks": [
5
+ {
6
+ "label": "rspec - current line",
7
+ "type": "shell",
8
+ "command": "${workspaceRoot}/bin/rspec ${relativeFile}:${lineNumber}"
9
+ },
10
+ {
11
+ "label": "rspec - current file",
12
+ "type": "shell",
13
+ "command": "${workspaceRoot}/bin/rspec ${relativeFile}"
14
+ },
15
+ {
16
+ "label": "rspec - whole suite",
17
+ "type": "shell",
18
+ "command": "${workspaceRoot}/bin/rspec"
19
+ }
20
+ ]
21
+ }
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ group :test do
8
+ gem 'google-adwords-api', github: 'ianks/google-api-ads-ruby', branch: 'enums-generated'
9
+ gem 'pry-byebug'
10
+ gem 'rspec'
11
+ end
12
+
13
+ group :development, :test do
14
+ gem 'rubocop'
15
+ gem 'rubocop-performance'
16
+ end
17
+
18
+ group :local do
19
+ gem 'solargraph'
20
+ end
@@ -0,0 +1,200 @@
1
+ GIT
2
+ remote: git://github.com/ianks/google-api-ads-ruby.git
3
+ revision: 7ce9b566b45b89882c412ceddc5491d0e8a6fa0a
4
+ branch: enums-generated
5
+ specs:
6
+ google-ads-common (1.0.2)
7
+ google-ads-savon (~> 1.0, >= 1.0.2)
8
+ httpclient (~> 2.7)
9
+ httpi (~> 2.3)
10
+ signet (~> 0.7)
11
+ google-ads-savon (1.0.3)
12
+ akami (~> 1.2)
13
+ builder (~> 3.0)
14
+ gyoku (~> 1.2)
15
+ httpi (~> 2.3)
16
+ nokogiri (~> 1.6)
17
+ nori (~> 2.6)
18
+ wasabi (~> 3.4)
19
+ google-adwords-api (1.4.0)
20
+ google-ads-common (~> 1.0.2)
21
+ nori (~> 2.6)
22
+
23
+ PATH
24
+ remote: .
25
+ specs:
26
+ gladwords (1.0.1)
27
+ google-adwords-api
28
+ rom (~> 4.2.0)
29
+
30
+ GEM
31
+ remote: https://rubygems.org/
32
+ specs:
33
+ addressable (2.6.0)
34
+ public_suffix (>= 2.0.2, < 4.0)
35
+ akami (1.3.1)
36
+ gyoku (>= 0.4.0)
37
+ nokogiri
38
+ ast (2.4.0)
39
+ backport (0.3.0)
40
+ builder (3.2.3)
41
+ byebug (10.0.2)
42
+ coderay (1.1.2)
43
+ concurrent-ruby (1.1.5)
44
+ diff-lcs (1.3)
45
+ dry-configurable (0.9.0)
46
+ concurrent-ruby (~> 1.0)
47
+ dry-core (~> 0.4, >= 0.4.7)
48
+ dry-container (0.7.2)
49
+ concurrent-ruby (~> 1.0)
50
+ dry-configurable (~> 0.1, >= 0.1.3)
51
+ dry-core (0.4.9)
52
+ concurrent-ruby (~> 1.0)
53
+ dry-equalizer (0.3.0)
54
+ dry-inflector (0.2.0)
55
+ dry-initializer (2.5.0)
56
+ dry-logic (0.6.1)
57
+ concurrent-ruby (~> 1.0)
58
+ dry-core (~> 0.2)
59
+ dry-equalizer (~> 0.2)
60
+ dry-struct (0.4.0)
61
+ dry-core (~> 0.4, >= 0.4.1)
62
+ dry-equalizer (~> 0.2)
63
+ dry-types (~> 0.12, >= 0.12.2)
64
+ ice_nine (~> 0.11)
65
+ dry-types (0.12.3)
66
+ concurrent-ruby (~> 1.0)
67
+ dry-configurable (~> 0.1)
68
+ dry-container (~> 0.3)
69
+ dry-core (~> 0.2, >= 0.2.1)
70
+ dry-equalizer (~> 0.2)
71
+ dry-logic (~> 0.4, >= 0.4.2)
72
+ inflecto (~> 0.0.0, >= 0.0.2)
73
+ faraday (0.15.4)
74
+ multipart-post (>= 1.2, < 3)
75
+ gyoku (1.3.1)
76
+ builder (>= 2.1.2)
77
+ htmlentities (4.3.4)
78
+ httpclient (2.8.3)
79
+ httpi (2.4.4)
80
+ rack
81
+ socksify
82
+ ice_nine (0.11.2)
83
+ inflecto (0.0.2)
84
+ jaro_winkler (1.5.4)
85
+ jwt (2.1.0)
86
+ kramdown (1.17.0)
87
+ method_source (0.9.0)
88
+ mini_portile2 (2.4.0)
89
+ multi_json (1.13.1)
90
+ multipart-post (2.0.0)
91
+ nokogiri (1.10.5)
92
+ mini_portile2 (~> 2.4.0)
93
+ nori (2.6.0)
94
+ parallel (1.19.1)
95
+ parser (2.6.5.0)
96
+ ast (~> 2.4.0)
97
+ pry (0.11.3)
98
+ coderay (~> 1.1.0)
99
+ method_source (~> 0.9.0)
100
+ pry-byebug (3.6.0)
101
+ byebug (~> 10.0)
102
+ pry (~> 0.10)
103
+ public_suffix (3.0.3)
104
+ rack (2.0.6)
105
+ rainbow (3.0.0)
106
+ rake (10.5.0)
107
+ reverse_markdown (1.3.0)
108
+ nokogiri
109
+ rom (4.2.1)
110
+ rom-changeset (~> 1.0, >= 1.0.2)
111
+ rom-core (~> 4.2, >= 4.2.1)
112
+ rom-repository (~> 2.0, >= 2.0.2)
113
+ rom-changeset (1.0.2)
114
+ dry-core (~> 0.3, >= 0.3.1)
115
+ rom-core (~> 4.0)
116
+ transproc (~> 1.0)
117
+ rom-core (4.2.1)
118
+ concurrent-ruby (~> 1.0)
119
+ dry-container (~> 0.6)
120
+ dry-core (~> 0.3)
121
+ dry-equalizer (~> 0.2)
122
+ dry-inflector (~> 0.1)
123
+ dry-initializer (~> 2.0)
124
+ dry-types (~> 0.12.1)
125
+ rom-mapper (~> 1.2, >= 1.2.1)
126
+ rom-mapper (1.2.1)
127
+ dry-core (~> 0.3, >= 0.3.1)
128
+ dry-equalizer (~> 0.2)
129
+ dry-struct (~> 0.4.0)
130
+ dry-types (~> 0.12.1)
131
+ transproc (~> 1.0)
132
+ rom-repository (2.0.2)
133
+ dry-core (~> 0.3)
134
+ dry-initializer (~> 2.0)
135
+ rom-core (~> 4.0)
136
+ rspec (3.7.0)
137
+ rspec-core (~> 3.7.0)
138
+ rspec-expectations (~> 3.7.0)
139
+ rspec-mocks (~> 3.7.0)
140
+ rspec-core (3.7.1)
141
+ rspec-support (~> 3.7.0)
142
+ rspec-expectations (3.7.0)
143
+ diff-lcs (>= 1.2.0, < 2.0)
144
+ rspec-support (~> 3.7.0)
145
+ rspec-mocks (3.7.0)
146
+ diff-lcs (>= 1.2.0, < 2.0)
147
+ rspec-support (~> 3.7.0)
148
+ rspec-support (3.7.1)
149
+ rubocop (0.77.0)
150
+ jaro_winkler (~> 1.5.1)
151
+ parallel (~> 1.10)
152
+ parser (>= 2.6)
153
+ rainbow (>= 2.2.2, < 4.0)
154
+ ruby-progressbar (~> 1.7)
155
+ unicode-display_width (>= 1.4.0, < 1.7)
156
+ rubocop-performance (1.5.1)
157
+ rubocop (>= 0.71.0)
158
+ ruby-progressbar (1.10.1)
159
+ signet (0.11.0)
160
+ addressable (~> 2.3)
161
+ faraday (~> 0.9)
162
+ jwt (>= 1.5, < 3.0)
163
+ multi_json (~> 1.10)
164
+ socksify (1.7.1)
165
+ solargraph (0.31.3)
166
+ backport (~> 0.3)
167
+ htmlentities (~> 4.3, >= 4.3.4)
168
+ jaro_winkler (~> 1.5)
169
+ kramdown (~> 1.16)
170
+ parser (~> 2.3)
171
+ reverse_markdown (~> 1.0, >= 1.0.5)
172
+ rubocop (~> 0.52)
173
+ thor (~> 0.19, >= 0.19.4)
174
+ tilt (~> 2.0)
175
+ yard (~> 0.9)
176
+ thor (0.20.3)
177
+ tilt (2.0.10)
178
+ transproc (1.1.0)
179
+ unicode-display_width (1.6.0)
180
+ wasabi (3.5.0)
181
+ httpi (~> 2.0)
182
+ nokogiri (>= 1.4.2)
183
+ yard (0.9.20)
184
+
185
+ PLATFORMS
186
+ ruby
187
+
188
+ DEPENDENCIES
189
+ bundler
190
+ gladwords!
191
+ google-adwords-api!
192
+ pry-byebug
193
+ rake (~> 10.0)
194
+ rspec
195
+ rubocop
196
+ rubocop-performance
197
+ solargraph
198
+
199
+ BUNDLED WITH
200
+ 1.17.2