onesignal-ruby-rails6 0.3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +14 -0
  3. data/.github/workflows/gempush.yml +41 -0
  4. data/.github/workflows/ruby.yml +20 -0
  5. data/.gitignore +17 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +182 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +12 -0
  10. data/Gemfile.lock +85 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +211 -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-player.yml +72 -0
  19. data/fixtures/vcr_cassettes/os-fetch-players.yml +72 -0
  20. data/fixtures/vcr_cassettes/os-send-noti.yml +145 -0
  21. data/lib/onesignal.rb +60 -0
  22. data/lib/onesignal/attachments.rb +27 -0
  23. data/lib/onesignal/auto_map.rb +13 -0
  24. data/lib/onesignal/autoloader.rb +7 -0
  25. data/lib/onesignal/client.rb +81 -0
  26. data/lib/onesignal/commands.rb +7 -0
  27. data/lib/onesignal/commands/autoloader.rb +7 -0
  28. data/lib/onesignal/commands/base_command.rb +23 -0
  29. data/lib/onesignal/commands/create_notification.rb +15 -0
  30. data/lib/onesignal/commands/csv_export.rb +15 -0
  31. data/lib/onesignal/commands/fetch_notification.rb +15 -0
  32. data/lib/onesignal/commands/fetch_player.rb +15 -0
  33. data/lib/onesignal/commands/fetch_players.rb +11 -0
  34. data/lib/onesignal/configuration.rb +19 -0
  35. data/lib/onesignal/filter.rb +140 -0
  36. data/lib/onesignal/included_targets.rb +47 -0
  37. data/lib/onesignal/notification.rb +37 -0
  38. data/lib/onesignal/notification/contents.rb +17 -0
  39. data/lib/onesignal/notification/headings.rb +17 -0
  40. data/lib/onesignal/responses.rb +7 -0
  41. data/lib/onesignal/responses/autoloader.rb +7 -0
  42. data/lib/onesignal/responses/base_response.rb +18 -0
  43. data/lib/onesignal/responses/csv_export.rb +18 -0
  44. data/lib/onesignal/responses/notification.rb +45 -0
  45. data/lib/onesignal/responses/player.rb +21 -0
  46. data/lib/onesignal/segment.rb +22 -0
  47. data/lib/onesignal/sounds.rb +39 -0
  48. data/lib/onesignal/version.rb +6 -0
  49. data/onesignal-ruby.gemspec +48 -0
  50. metadata +270 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d02b4f3494b8a9a785ee08b42d985630f3968145a8f835cc0a69b3640d0977b
4
+ data.tar.gz: a7a2afdacc7d60474926f6c01e9436121ecee7e66d6404a31fe6bef01096e379
5
+ SHA512:
6
+ metadata.gz: a579abe2a462504715ca2ef56bee21c4121b5c76c9d4c18ea65445ef15e3e0e8d186659c9b27a4df9a1ed7c0c0cfd2dee3ff84dc74dc8215cb3e027a0453961a
7
+ data.tar.gz: 9d71e9bc4cc4a7ce44b840281f6f389f8df0f3c85de73189ec6c35e86227ee0d7076ae564613943297271b21a97b909bc2201b5d574d46ddc7ea35ac4f34ced8
@@ -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,41 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'refs/tags/*'
7
+
8
+ jobs:
9
+ build:
10
+ name: Build + Publish
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@master
15
+ - name: Set up Ruby 2.6
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ version: 2.6.x
19
+
20
+ - name: Publish to GPR
21
+ run: |
22
+ mkdir -p $HOME/.gem
23
+ touch $HOME/.gem/credentials
24
+ chmod 0600 $HOME/.gem/credentials
25
+ printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
26
+ gem build *.gemspec
27
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
28
+ env:
29
+ GEM_HOST_API_KEY: ${{secrets.GPR_AUTH_TOKEN}}
30
+ OWNER: username
31
+
32
+ - name: Publish to RubyGems
33
+ run: |
34
+ mkdir -p $HOME/.gem
35
+ touch $HOME/.gem/credentials
36
+ chmod 0600 $HOME/.gem/credentials
37
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
38
+ gem build *.gemspec
39
+ gem push *.gem
40
+ env:
41
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,20 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Build and test with Rake
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs 4 --retry 3
20
+ bundle exec rake
@@ -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,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,12 @@
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
+ group :test do
11
+ gem 'faker', git: 'https://github.com/stympy/faker.git', branch: 'master'
12
+ end
@@ -0,0 +1,85 @@
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 (~> 0.15, >= 0.15.4)
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 (0.17.1)
35
+ multipart-post (>= 1.2, < 3)
36
+ hashdiff (0.3.8)
37
+ i18n (1.5.1)
38
+ concurrent-ruby (~> 1.0)
39
+ minitest (5.11.3)
40
+ multipart-post (2.1.1)
41
+ public_suffix (3.0.3)
42
+ rake (10.5.0)
43
+ rspec (3.8.0)
44
+ rspec-core (~> 3.8.0)
45
+ rspec-expectations (~> 3.8.0)
46
+ rspec-mocks (~> 3.8.0)
47
+ rspec-core (3.8.0)
48
+ rspec-support (~> 3.8.0)
49
+ rspec-expectations (3.8.2)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.8.0)
52
+ rspec-mocks (3.8.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.8.0)
55
+ rspec-support (3.8.0)
56
+ rspec_junit_formatter (0.4.1)
57
+ rspec-core (>= 2, < 4, != 2.12.0)
58
+ safe_yaml (1.0.4)
59
+ simple_command (0.1.0)
60
+ thread_safe (0.3.6)
61
+ tzinfo (1.2.5)
62
+ thread_safe (~> 0.1)
63
+ vcr (4.0.0)
64
+ webmock (3.5.1)
65
+ addressable (>= 2.3.6)
66
+ crack (>= 0.3.2)
67
+ hashdiff
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ bundler (~> 1.16)
74
+ dotenv (~> 2.5)
75
+ factory_bot (~> 4.11)
76
+ faker!
77
+ onesignal-ruby!
78
+ rake (~> 10.0)
79
+ rspec (~> 3.0)
80
+ rspec_junit_formatter (~> 0.4)
81
+ vcr (~> 4.0, >= 4.0.0)
82
+ webmock (~> 3.4)
83
+
84
+ BUNDLED WITH
85
+ 1.17.2