ones-ruby-msm 0.3.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 (53) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +42 -0
  3. data/.editorconfig +14 -0
  4. data/.gitignore +17 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +182 -0
  7. data/CODEOWNERS +1 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +14 -0
  10. data/Gemfile.lock +87 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +226 -0
  13. data/Rakefile +8 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/fixtures/vcr_cassettes/os-csv-export.yml +135 -0
  17. data/fixtures/vcr_cassettes/os-fetch-noti.yml +76 -0
  18. data/fixtures/vcr_cassettes/os-fetch-notifications.yml +237 -0
  19. data/fixtures/vcr_cassettes/os-fetch-player.yml +72 -0
  20. data/fixtures/vcr_cassettes/os-fetch-players.yml +72 -0
  21. data/fixtures/vcr_cassettes/os-send-noti.yml +145 -0
  22. data/lib/onesignal.rb +85 -0
  23. data/lib/onesignal/attachments.rb +27 -0
  24. data/lib/onesignal/auto_map.rb +13 -0
  25. data/lib/onesignal/autoloader.rb +7 -0
  26. data/lib/onesignal/buttons.rb +17 -0
  27. data/lib/onesignal/client.rb +87 -0
  28. data/lib/onesignal/commands.rb +7 -0
  29. data/lib/onesignal/commands/autoloader.rb +7 -0
  30. data/lib/onesignal/commands/base_command.rb +23 -0
  31. data/lib/onesignal/commands/create_notification.rb +15 -0
  32. data/lib/onesignal/commands/csv_export.rb +15 -0
  33. data/lib/onesignal/commands/fetch_notification.rb +15 -0
  34. data/lib/onesignal/commands/fetch_notifications.rb +17 -0
  35. data/lib/onesignal/commands/fetch_player.rb +15 -0
  36. data/lib/onesignal/commands/fetch_players.rb +11 -0
  37. data/lib/onesignal/configuration.rb +19 -0
  38. data/lib/onesignal/filter.rb +140 -0
  39. data/lib/onesignal/included_targets.rb +47 -0
  40. data/lib/onesignal/notification.rb +39 -0
  41. data/lib/onesignal/notification/contents.rb +17 -0
  42. data/lib/onesignal/notification/headings.rb +17 -0
  43. data/lib/onesignal/responses.rb +7 -0
  44. data/lib/onesignal/responses/autoloader.rb +7 -0
  45. data/lib/onesignal/responses/base_response.rb +18 -0
  46. data/lib/onesignal/responses/csv_export.rb +18 -0
  47. data/lib/onesignal/responses/notification.rb +45 -0
  48. data/lib/onesignal/responses/player.rb +21 -0
  49. data/lib/onesignal/segment.rb +23 -0
  50. data/lib/onesignal/sounds.rb +39 -0
  51. data/lib/onesignal/version.rb +6 -0
  52. data/onesignal-ruby.gemspec +48 -0
  53. metadata +268 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d17a16a963fbe170b5b2f2e71dda23b07794d656bc608cc2d5af311746a8f7d6
4
+ data.tar.gz: 520227f0a5c09211569b8cf29068bc530241f1b75ff12e89c3a5cf7305c18a36
5
+ SHA512:
6
+ metadata.gz: 3d32a2b7e2179999e4bacc50e918665fd26d6596cde1cb8c3774781bd8fc7395946377ad59a106efbab1eb5f06c2b3d34737103d7f020d3fef8565fb83667820
7
+ data.tar.gz: 7979d3b9b25fdb2a716784224ad76d41fcb5d4de12a94757547754f09bcbf5c61248b771ff0d4eec22b980725ed01976a8accd4c89066d096977e5ca2408fa18
@@ -0,0 +1,42 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: circleci/ruby:2.6.0
6
+ environment:
7
+ working_directory: ~/repo
8
+
9
+ steps:
10
+ - checkout
11
+ - restore_cache:
12
+ name: Restore Bundle cache
13
+ keys:
14
+ - bundle-{{ checksum "Gemfile.lock" }}
15
+ - bundle-
16
+ - run:
17
+ name: Install dependencies
18
+ command: |
19
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
20
+ - save_cache:
21
+ name: Save Bundle cache
22
+ paths:
23
+ - ./vendor/bundle
24
+ key: bundle-{{ checksum "Gemfile.lock" }}
25
+
26
+ - run:
27
+ name: Run tests
28
+ command: |
29
+ mkdir /tmp/test-results
30
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
31
+
32
+ bundle exec rspec --format progress \
33
+ --format RspecJunitFormatter \
34
+ --out /tmp/test-results/rspec.xml \
35
+ --format progress \
36
+ $TEST_FILES
37
+
38
+ - store_test_results:
39
+ path: /tmp/test-results
40
+ - store_artifacts:
41
+ path: /tmp/test-results
42
+ destination: test-results
@@ -0,0 +1,14 @@
1
+ # editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+ end_of_line = lf
10
+ indent_style = space
11
+ indent_size = 2
12
+
13
+ [*.md]
14
+ trim_trailing_whitespace = false
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ .idea/
14
+ *.iml
15
+ .env
16
+ .env.*
17
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,182 @@
1
+ AllCops:
2
+ # Cop names are not displayed in offense messages by default. Change behavior
3
+ # by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
4
+ # option.
5
+ DisplayCopNames: true
6
+
7
+ # Style guide URLs are not displayed in offense messages by default. Change
8
+ # behavior by overriding `DisplayStyleGuide`, or by giving the
9
+ # `-S/--display-style-guide` option.
10
+ DisplayStyleGuide: true
11
+
12
+ # Extra details are not displayed in offense messages by default. Change
13
+ # behavior by overriding ExtraDetails, or by giving the
14
+ # `-E/--extra-details` option.
15
+ ExtraDetails: true
16
+
17
+ # What MRI version of the Ruby interpreter is the inspected code intended to
18
+ # run on? (If there is more than one, set this to the lowest version.)
19
+ # If a value is specified for TargetRubyVersion then it is used.
20
+ # Else if .ruby-version exists and it contains an MRI version it is used.
21
+ # Otherwise we fallback to the oldest officially supported Ruby version (2.1).
22
+ TargetRubyVersion: 2.4
23
+
24
+ # Align the elements of a hash literal if they span more than one line.
25
+ Layout/AlignHash:
26
+ # Alignment of entries using hash rocket as separator. Valid values are:
27
+ #
28
+ # key - left alignment of keys
29
+ # 'a' => 2
30
+ # 'bb' => 3
31
+ # separator - alignment of hash rockets, keys are right aligned
32
+ # 'a' => 2
33
+ # 'bb' => 3
34
+ # table - left alignment of keys, hash rockets, and values
35
+ # 'a' => 2
36
+ # 'bb' => 3
37
+ EnforcedHashRocketStyle: table
38
+ SupportedHashRocketStyles:
39
+ - key
40
+ - separator
41
+ - table
42
+ # Alignment of entries using colon as separator. Valid values are:
43
+ #
44
+ # key - left alignment of keys
45
+ # a: 0
46
+ # bb: 1
47
+ # separator - alignment of colons, keys are right aligned
48
+ # a: 0
49
+ # bb: 1
50
+ # table - left alignment of keys and values
51
+ # a: 0
52
+ # bb: 1
53
+ EnforcedColonStyle: table
54
+ SupportedColonStyles:
55
+ - key
56
+ - separator
57
+ - table
58
+ # Select whether hashes that are the last argument in a method call should be
59
+ # inspected? Valid values are:
60
+ #
61
+ # always_inspect - Inspect both implicit and explicit hashes.
62
+ # Registers an offense for:
63
+ # function(a: 1,
64
+ # b: 2)
65
+ # Registers an offense for:
66
+ # function({a: 1,
67
+ # b: 2})
68
+ # always_ignore - Ignore both implicit and explicit hashes.
69
+ # Accepts:
70
+ # function(a: 1,
71
+ # b: 2)
72
+ # Accepts:
73
+ # function({a: 1,
74
+ # b: 2})
75
+ # ignore_implicit - Ignore only implicit hashes.
76
+ # Accepts:
77
+ # function(a: 1,
78
+ # b: 2)
79
+ # Registers an offense for:
80
+ # function({a: 1,
81
+ # b: 2})
82
+ # ignore_explicit - Ignore only explicit hashes.
83
+ # Accepts:
84
+ # function({a: 1,
85
+ # b: 2})
86
+ # Registers an offense for:
87
+ # function(a: 1,
88
+ # b: 2)
89
+ EnforcedLastArgumentHashStyle: ignore_implicit
90
+ SupportedLastArgumentHashStyles:
91
+ - always_inspect
92
+ - always_ignore
93
+ - ignore_implicit
94
+ - ignore_explicit
95
+
96
+ Layout/EndOfLine:
97
+ # The `native` style means that CR+LF (Carriage Return + Line Feed) is
98
+ # enforced on Windows, and LF is enforced on other platforms. The other styles
99
+ # mean LF and CR+LF, respectively.
100
+ EnforcedStyle: lf
101
+ SupportedStyles:
102
+ - native
103
+ - lf
104
+ - crlf
105
+
106
+ Style/BlockDelimiters:
107
+ EnforcedStyle: braces_for_chaining
108
+ SupportedStyles:
109
+ # The `line_count_based` style enforces braces around single line blocks and
110
+ # do..end around multi-line blocks.
111
+ - line_count_based
112
+ # The `semantic` style enforces braces around functional blocks, where the
113
+ # primary purpose of the block is to return a value and do..end for
114
+ # procedural blocks, where the primary purpose of the block is its
115
+ # side-effects.
116
+ #
117
+ # This looks at the usage of a block's method to determine its type (e.g. is
118
+ # the result of a `map` assigned to a variable or passed to another
119
+ # method) but exceptions are permitted in the `ProceduralMethods`,
120
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
121
+ - semantic
122
+ # The `braces_for_chaining` style enforces braces around single line blocks
123
+ # and do..end around multi-line blocks, except for multi-line blocks whose
124
+ # return value is being chained with another method (in which case braces
125
+ # are enforced).
126
+ - braces_for_chaining
127
+
128
+ Style/Documentation:
129
+ Enabled: false
130
+
131
+ Style/MethodDefParentheses:
132
+ EnforcedStyle: require_no_parentheses
133
+ SupportedStyles:
134
+ - require_parentheses
135
+ - require_no_parentheses
136
+ - require_no_parentheses_except_multiline
137
+
138
+ Style/RedundantReturn:
139
+ # When `true` allows code like `return x, y`.
140
+ AllowMultipleReturnValues: true
141
+
142
+ Style/Semicolon:
143
+ # Allow `;` to separate several expressions on the same line.
144
+ AllowAsExpressionSeparator: true
145
+
146
+ Metrics/BlockLength:
147
+ Exclude:
148
+ - "**/*_spec.rb"
149
+
150
+ Metrics/LineLength:
151
+ Max: 100
152
+ # To make it possible to copy or click on URIs in the code, we allow lines
153
+ # containing a URI to be longer than Max.
154
+ AllowHeredoc: true
155
+ AllowURI: true
156
+ URISchemes:
157
+ - http
158
+ - https
159
+ - ftp
160
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
161
+ # directives like '# rubocop: enable ...' when calculating a line's length.
162
+ IgnoreCopDirectives: false
163
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
164
+ # elements. Strings will be converted to Regexp objects. A line that matches
165
+ # any regular expression listed in this option will be ignored by LineLength.
166
+ IgnoredPatterns: []
167
+
168
+ # Align ends correctly.
169
+ Lint/EndAlignment:
170
+ # The value `keyword` means that `end` should be aligned with the matching
171
+ # keyword (`if`, `while`, etc.).
172
+ # The value `variable` means that in assignments, `end` should be aligned
173
+ # with the start of the variable on the left hand side of `=`. In all other
174
+ # situations, `end` should still be aligned with the keyword.
175
+ # The value `start_of_line` means that `end` should be aligned with the start
176
+ # of the line which the matching keyword appears on.
177
+ EnforcedStyleAlignWith: variable
178
+ SupportedStylesAlignWith:
179
+ - keyword
180
+ - variable
181
+ - start_of_line
182
+ AutoCorrect: false
@@ -0,0 +1 @@
1
+ * @MatteoJoliveau @bernardini687
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at matteo.joliveau@mikamai.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in onesignal-ruby.gemspec
8
+ gemspec
9
+
10
+ # gem 'faraday', '~>1.1.0'
11
+
12
+ group :test do
13
+ gem 'faker', git: 'https://github.com/stympy/faker.git', branch: 'master'
14
+ end
@@ -0,0 +1,87 @@
1
+ GIT
2
+ remote: https://github.com/stympy/faker.git
3
+ revision: 14599cc0f7a8bdf7b842714f776477061abda6e4
4
+ branch: master
5
+ specs:
6
+ faker (1.9.1)
7
+ i18n (>= 0.7)
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ onesignal-ruby (0.3.0)
13
+ activesupport (>= 5.0.0, < 7)
14
+ faraday (~> 1.1.0)
15
+ simple_command (~> 0, >= 0.0.9)
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ activesupport (5.2.2)
21
+ concurrent-ruby (~> 1.0, >= 1.0.2)
22
+ i18n (>= 0.7, < 2)
23
+ minitest (~> 5.1)
24
+ tzinfo (~> 1.1)
25
+ addressable (2.5.2)
26
+ public_suffix (>= 2.0.2, < 4.0)
27
+ concurrent-ruby (1.1.4)
28
+ crack (0.4.3)
29
+ safe_yaml (~> 1.0.0)
30
+ diff-lcs (1.3)
31
+ dotenv (2.6.0)
32
+ factory_bot (4.11.1)
33
+ activesupport (>= 3.0.0)
34
+ faraday (1.1.0)
35
+ multipart-post (>= 1.2, < 3)
36
+ ruby2_keywords
37
+ hashdiff (0.3.8)
38
+ i18n (1.5.1)
39
+ concurrent-ruby (~> 1.0)
40
+ minitest (5.11.3)
41
+ multipart-post (2.1.1)
42
+ public_suffix (3.0.3)
43
+ rake (13.0.1)
44
+ rspec (3.8.0)
45
+ rspec-core (~> 3.8.0)
46
+ rspec-expectations (~> 3.8.0)
47
+ rspec-mocks (~> 3.8.0)
48
+ rspec-core (3.8.0)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-expectations (3.8.2)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.8.0)
53
+ rspec-mocks (3.8.0)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-support (3.8.0)
57
+ rspec_junit_formatter (0.4.1)
58
+ rspec-core (>= 2, < 4, != 2.12.0)
59
+ ruby2_keywords (0.0.2)
60
+ safe_yaml (1.0.4)
61
+ simple_command (0.1.0)
62
+ thread_safe (0.3.6)
63
+ tzinfo (1.2.5)
64
+ thread_safe (~> 0.1)
65
+ vcr (4.0.0)
66
+ webmock (3.5.1)
67
+ addressable (>= 2.3.6)
68
+ crack (>= 0.3.2)
69
+ hashdiff
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ bundler (~> 1.16)
76
+ dotenv (~> 2.5)
77
+ factory_bot (~> 4.11)
78
+ faker!
79
+ onesignal-ruby!
80
+ rake (~> 13.0)
81
+ rspec (~> 3.0)
82
+ rspec_junit_formatter (~> 0.4)
83
+ vcr (~> 4.0, >= 4.0.0)
84
+ webmock (~> 3.4)
85
+
86
+ BUNDLED WITH
87
+ 1.17.3