gladwords 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Gladwords do
4
+ describe '.selector_fields_db' do
5
+ %i[v201806 v201809].each do |version|
6
+ let(:db) { described_class.selector_fields_db(version) }
7
+
8
+ let(:field_entries) { db.values.map(&:values).flatten }
9
+
10
+ it 'has the correct number of services' do
11
+ expect(db.keys.length).to be >= 43
12
+ end
13
+
14
+ it 'keys services by method' do
15
+ expect(db[:campaigns]).to have_key(:get)
16
+ end
17
+
18
+ it 'includes the field name for each item' do
19
+ field_entries = db.values.map(&:values).flatten
20
+
21
+ expect(field_entries).to all have_key(:field)
22
+ end
23
+
24
+ it 'includes the filterable key for each item' do
25
+ expect(field_entries).to all have_key(:filterable)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gladwords
4
+ RSpec.describe Types do
5
+ describe Types::Date do
6
+ describe '#read' do
7
+ subject(:read_type) { described_class.meta[:read] }
8
+
9
+ let(:format) { described_class.meta[:format] }
10
+ let(:date_string) { '20181231' }
11
+
12
+ it 'parses to a Ruby Date instance' do
13
+ expect(read_type[date_string]).to be_a ::Date
14
+ end
15
+
16
+ it 'includes the correct format in the metadata' do
17
+ expect(read_type[date_string].strftime(format)).to eq date_string
18
+ end
19
+ end
20
+ end
21
+
22
+ describe Types::Statuses do
23
+ subject(:statuses) { described_class.type }
24
+
25
+ it 'disallows invalid strings' do
26
+ expect { statuses['ITYPOED'] }.to raise_error Dry::Types::ConstraintError
27
+ end
28
+
29
+ %w[
30
+ UNKNOWN
31
+ ENABLED
32
+ PAUSED
33
+ REMOVED
34
+ ].each do |status|
35
+ it "allows the \"#{status}\" status" do
36
+ expect(statuses[status]).to eq status
37
+ end
38
+ end
39
+ end
40
+
41
+ describe Types::ID do
42
+ subject(:id) { described_class }
43
+
44
+ it 'maps to an Integer primitive' do
45
+ expect(id.primitive).to be Integer
46
+ end
47
+ end
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gladwords
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ian Ker-Seymer
8
+ - Patrick Sparrow
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2019-11-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: google-adwords-api
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rom
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 4.2.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 4.2.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '10.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '10.0'
70
+ description: AdWords support for ROM.rb
71
+ email:
72
+ - ian@tryadhawk.com
73
+ - patrick@tryadhawk.com
74
+ executables:
75
+ - rake
76
+ - rspec
77
+ - solargraph
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - ".circleci/config.yml"
82
+ - ".gitignore"
83
+ - ".projections.json"
84
+ - ".rspec"
85
+ - ".rubocop.yml"
86
+ - ".rubocop_todo.yml"
87
+ - ".vim/coc-settings.json"
88
+ - ".vim/install.sh"
89
+ - ".vscode/launch.json"
90
+ - ".vscode/settings.json"
91
+ - ".vscode/tasks.json"
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/rake
98
+ - bin/rspec
99
+ - bin/solargraph
100
+ - config/environment.rb
101
+ - gladwords.code-workspace
102
+ - gladwords.gemspec
103
+ - lib/ext/rom/inflector.rb
104
+ - lib/gladwords.rb
105
+ - lib/gladwords/associations.rb
106
+ - lib/gladwords/associations/many_to_many.rb
107
+ - lib/gladwords/associations/many_to_one.rb
108
+ - lib/gladwords/associations/one_to_many.rb
109
+ - lib/gladwords/associations/one_to_one.rb
110
+ - lib/gladwords/associations/one_to_one_through.rb
111
+ - lib/gladwords/commands.rb
112
+ - lib/gladwords/commands/core.rb
113
+ - lib/gladwords/commands/create.rb
114
+ - lib/gladwords/commands/delete.rb
115
+ - lib/gladwords/commands/error_wrapper.rb
116
+ - lib/gladwords/commands/update.rb
117
+ - lib/gladwords/errors.rb
118
+ - lib/gladwords/gateway.rb
119
+ - lib/gladwords/inflector.rb
120
+ - lib/gladwords/relation.rb
121
+ - lib/gladwords/relation/association_methods.rb
122
+ - lib/gladwords/relation/joined_relation.rb
123
+ - lib/gladwords/schema.rb
124
+ - lib/gladwords/schema/attributes_inferrer.rb
125
+ - lib/gladwords/schema/dsl.rb
126
+ - lib/gladwords/schema/inferrer.rb
127
+ - lib/gladwords/selector_fields_db.rb
128
+ - lib/gladwords/selector_fields_db/v201806.json
129
+ - lib/gladwords/selector_fields_db/v201809.json
130
+ - lib/gladwords/struct.rb
131
+ - lib/gladwords/types.rb
132
+ - lib/gladwords/version.rb
133
+ - rakelib/generate_selector_fields_db.rake
134
+ - spec/integration/commands/create_spec.rb
135
+ - spec/integration/commands/delete_spec.rb
136
+ - spec/integration/commands/update_spec.rb
137
+ - spec/shared/campaigns.rb
138
+ - spec/shared/labels.rb
139
+ - spec/spec_helper.rb
140
+ - spec/support/adwords_helpers.rb
141
+ - spec/unit/commands/create_spec.rb
142
+ - spec/unit/commands/delete_spec.rb
143
+ - spec/unit/commands/update_spec.rb
144
+ - spec/unit/inflector_spec.rb
145
+ - spec/unit/relation/association_methods_spec.rb
146
+ - spec/unit/relation_spec.rb
147
+ - spec/unit/schema/attributes_inferrer_spec.rb
148
+ - spec/unit/selector_fields_db_spec.rb
149
+ - spec/unit/types_spec.rb
150
+ homepage: https://github.com/adHawk/gladwords
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.7.8
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: AdWords support for ROM.rb
174
+ test_files:
175
+ - spec/integration/commands/create_spec.rb
176
+ - spec/integration/commands/delete_spec.rb
177
+ - spec/integration/commands/update_spec.rb
178
+ - spec/shared/campaigns.rb
179
+ - spec/shared/labels.rb
180
+ - spec/spec_helper.rb
181
+ - spec/support/adwords_helpers.rb
182
+ - spec/unit/commands/create_spec.rb
183
+ - spec/unit/commands/delete_spec.rb
184
+ - spec/unit/commands/update_spec.rb
185
+ - spec/unit/inflector_spec.rb
186
+ - spec/unit/relation/association_methods_spec.rb
187
+ - spec/unit/relation_spec.rb
188
+ - spec/unit/schema/attributes_inferrer_spec.rb
189
+ - spec/unit/selector_fields_db_spec.rb
190
+ - spec/unit/types_spec.rb