stealth-bandwidth 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7819293192d202d15f7d9bdfc5f9bcda6f9a4316f929e6d6a96b8e08286a8530
4
- data.tar.gz: 23828c62352610ac0c52947150f2b1e4790070ee09d4cfdeec27eef11d68fc8a
3
+ metadata.gz: 565292b84eb7d1e445ce2b19e005fff01054433a5baf2ea68f0541c33880952c
4
+ data.tar.gz: c4b39e0c8f2f97661f36ef81e04bd01e7df0e07be1a75960509d92aa84ef21f9
5
5
  SHA512:
6
- metadata.gz: b425eb611f44cbb026e01b3fa6a68c54f47d8f8be29303b6069dd15de4fe64f25ae4bfa71b17d09e28f011b7421467c912a76d63a32373321b8b1dadba289ed3
7
- data.tar.gz: 6b06a35322e10a7e9303ff68b446db8c1e54ddaa8086d7cf334e09816a99c48e6caef689d8fb7472a5e6079f8972e467a241864e5d20fdb5a4dcd5cfb606428e
6
+ metadata.gz: 5598611b534f85ebc5dafbb6c3e12c70c8a72b8cba0bafb9419c0d6af4798142adb0ca945127147dd64f562686a60d9b6d5ec7f2cb6ef3dcea862b6ac86fdca7
7
+ data.tar.gz: 18f80889909dc586159f4f1746936041abe71257d1f409847e7c24513c66ffe6ad96f43f12f4dc0ed5046338f12e96115319c50c0ce025aea7a9076da51c15ab
@@ -0,0 +1,13 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+
5
+ jobs:
6
+ release:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v3
10
+ - uses: ruby/setup-ruby@v1
11
+ with:
12
+ ruby-version: 2.7
13
+ bundler-cache: true
@@ -0,0 +1,29 @@
1
+ name: Release Gem
2
+ on:
3
+ # Triggers the workflow on push with a tag prefixed with v*
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ # Allows you to run this workflow manually from the Actions tab
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.7
19
+ bundler-cache: true
20
+ - name: Publish gem
21
+ env:
22
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stealth-bandwidth (1.0.0)
4
+ stealth-bandwidth (1.1.0)
5
5
  http (~> 4.1)
6
6
  oj (~> 3.11)
7
7
  stealth (>= 2.0.0.beta6)
@@ -43,7 +43,7 @@ GEM
43
43
  mustermann (2.0.2)
44
44
  ruby2_keywords (~> 0.0.1)
45
45
  nio4r (2.5.8)
46
- oj (3.13.21)
46
+ oj (3.13.23)
47
47
  public_suffix (5.0.0)
48
48
  puma (5.6.5)
49
49
  nio4r (~> 2.0)
@@ -106,4 +106,4 @@ DEPENDENCIES
106
106
  stealth-bandwidth!
107
107
 
108
108
  BUNDLED WITH
109
- 1.17.3
109
+ 2.2.32
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -31,7 +31,7 @@ module Stealth
31
31
  @service_message = ServiceMessage.new(service: 'bandwidth')
32
32
 
33
33
  service_message.sender_id = params.dig('message', 'from')
34
- service_message.target_id = params.dig('message', 'to').first
34
+ service_message.target_id = params.dig('message', 'to')
35
35
  service_message.message = params.dig('message', 'text')
36
36
  service_message.timestamp = params.dig('message', 'time')
37
37
  params.dig('message', 'media')&.each do |attachment_url|
@@ -8,7 +8,7 @@ module Stealth
8
8
 
9
9
  ALPHA_ORDINALS = ('A'..'Z').to_a.freeze
10
10
 
11
- attr_reader :recipient_id, :reply
11
+ attr_reader :recipient_id, :reply, :translated_reply
12
12
 
13
13
  def initialize(recipient_id: nil, reply: nil)
14
14
  @recipient_id = recipient_id
@@ -18,20 +18,20 @@ module Stealth
18
18
  def text
19
19
  check_text_length
20
20
 
21
- translated_reply = reply['text']
21
+ @translated_reply = reply['text']
22
22
 
23
23
  suggestions = generate_suggestions(suggestions: reply['suggestions'])
24
24
  buttons = generate_buttons(buttons: reply['buttons'])
25
25
 
26
26
  if suggestions.present?
27
- translated_reply = [
28
- translated_reply,
27
+ @translated_reply = [
28
+ @translated_reply,
29
29
  'Reply with:'
30
30
  ].join("\n\n")
31
31
 
32
32
  suggestions.each_with_index do |suggestion, i|
33
- translated_reply = [
34
- translated_reply,
33
+ @translated_reply = [
34
+ @translated_reply,
35
35
  "\"#{ALPHA_ORDINALS[i]}\" for #{suggestion}"
36
36
  ].join("\n")
37
37
  end
@@ -39,14 +39,14 @@ module Stealth
39
39
 
40
40
  if buttons.present?
41
41
  buttons.each do |button|
42
- translated_reply = [
43
- translated_reply,
42
+ @translated_reply = [
43
+ @translated_reply,
44
44
  button
45
45
  ].join("\n\n")
46
46
  end
47
47
  end
48
48
 
49
- format_response({ text: translated_reply })
49
+ format_response({ text: @translated_reply })
50
50
  end
51
51
 
52
52
  def image
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stealth-bandwidth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Gomes
8
8
  - Emilie Morissette
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-09-23 00:00:00.000000000 Z
12
+ date: 2022-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: stealth
@@ -103,7 +103,8 @@ executables: []
103
103
  extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
- - ".circleci/config.yml"
106
+ - ".github/workflows/ci.yml"
107
+ - ".github/workflows/release.yml"
107
108
  - ".gitignore"
108
109
  - Gemfile
109
110
  - Gemfile.lock
@@ -123,7 +124,7 @@ homepage: https://github.com/hellostealth/stealth-bandwidth
123
124
  licenses:
124
125
  - MIT
125
126
  metadata: {}
126
- post_install_message:
127
+ post_install_message:
127
128
  rdoc_options: []
128
129
  require_paths:
129
130
  - lib
@@ -138,10 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
139
  - !ruby/object:Gem::Version
139
140
  version: '0'
140
141
  requirements: []
141
- rubygems_version: 3.0.8
142
- signing_key:
142
+ rubygems_version: 3.1.6
143
+ signing_key:
143
144
  specification_version: 4
144
145
  summary: Stealth Bandwidth SMS driver
145
- test_files:
146
- - spec/spec_helper.rb
147
- - spec/version_spec.rb
146
+ test_files: []
data/.circleci/config.yml DELETED
@@ -1,60 +0,0 @@
1
- # Ruby CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
- #
5
- version: 2
6
- jobs:
7
- build:
8
- docker:
9
- # specify the version you desire here
10
- - image: circleci/ruby:2.4.1-node-browsers
11
- environment:
12
- STEALTH_ENV: test
13
-
14
- # Specify service dependencies here if necessary
15
- # CircleCI maintains a library of pre-built images
16
- # documented at https://circleci.com/docs/2.0/circleci-images/
17
- # - image: circleci/postgres:9.4
18
-
19
- working_directory: ~/repo
20
-
21
- steps:
22
- - checkout
23
-
24
- # Download and cache dependencies
25
- - restore_cache:
26
- keys:
27
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
28
- # fallback to using the latest cache if no exact match is found
29
- - v1-dependencies-
30
-
31
- - run:
32
- name: install dependencies
33
- command: |
34
- bundle install --jobs=4 --retry=3 --path vendor/bundle
35
-
36
- - save_cache:
37
- paths:
38
- - ./vendor/bundle
39
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
40
-
41
- # run tests!
42
- - run:
43
- name: run tests
44
- command: |
45
- mkdir /tmp/test-results
46
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
47
-
48
- bundle exec rspec --format progress \
49
- --format RspecJunitFormatter \
50
- --out /tmp/test-results/rspec.xml \
51
- --format progress \
52
- -- \
53
- $TEST_FILES
54
-
55
- # collect reports
56
- - store_test_results:
57
- path: /tmp/test-results
58
- - store_artifacts:
59
- path: /tmp/test-results
60
- destination: test-results