Skip to content

Commit 5ef9ed8

Browse files
author
marcel corso gonzalez
authored
Merge branch 'master' into master
2 parents 9a72f49 + d7ae2fe commit 5ef9ed8

File tree

126 files changed

+5033
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+5033
-545
lines changed

.github/workflows/gh-release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Github Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
create-release:
9+
name: Create Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Setup git
15+
run: |
16+
git config user.email "[email protected]"
17+
git config user.name "MessageBird CI"
18+
- name: Prepare description
19+
run: |
20+
csplit -s CHANGELOG.md "/##/" {1}
21+
cat xx01 > CHANGELOG.tmp
22+
- name: Prepare tag
23+
run: |
24+
export TAG=$(head -1 CHANGELOG.tmp | cut -d' ' -f2)
25+
echo "TAG=$TAG" >> $GITHUB_ENV
26+
- name: Create Release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
tag_name: ${{ env.TAG }}
32+
release_name: ${{ env.TAG }}
33+
body_path: CHANGELOG.tmp
34+
draft: false
35+
prerelease: false

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: RubyGems release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v1
13+
14+
- name: Publish gem
15+
uses: dawidd6/action-publish-gem@v1
16+
with:
17+
api_key: ${{secrets.RUBYGEMS_API_KEY}}

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [ labeled ]
6+
branches:
7+
- master
8+
9+
jobs:
10+
prepare-release:
11+
name: Prepare release
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set major release
16+
if: ${{ github.event.label.name == 'release-major' }}
17+
run: echo "RELEASE=major" >> $GITHUB_ENV
18+
- name: Set minor release
19+
if: ${{ github.event.label.name == 'release-minor' }}
20+
run: echo "RELEASE=minor" >> $GITHUB_ENV
21+
- name: Set patch release
22+
if: ${{ github.event.label.name == 'release-patch' }}
23+
run: echo "RELEASE=patch" >> $GITHUB_ENV
24+
- name: Check release env
25+
run: |
26+
if [[ -z "${{ env.RELEASE }}" ]];
27+
then
28+
echo "You need to set a release label on PRs to the main branch"
29+
exit 1
30+
else
31+
exit 0
32+
fi
33+
- name: Install semver-tool
34+
run: |
35+
export DIR=$(mktemp -d)
36+
cd $DIR
37+
curl https://github.com/fsaintjacques/semver-tool/archive/3.2.0.tar.gz -L -o semver.tar.gz
38+
tar -xvf semver.tar.gz
39+
sudo cp semver-tool-3.2.0/src/semver /usr/local/bin
40+
- name: Bump version
41+
run: |
42+
export CURRENT=$(gem info messagebird-rest --remote --exact | grep -o "messagebird-rest ([0-9]*\.[0-9]*\.[0-9]*)" | awk -F '[()]' '{print $2}')
43+
export NEW_VERSION=$(semver bump ${{ env.RELEASE }} $CURRENT)
44+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
45+
- name: Checkout code
46+
uses: actions/checkout@v2
47+
- name: Setup git
48+
run: |
49+
git config user.email "[email protected]"
50+
git config user.name "MessageBird CI"
51+
git fetch
52+
git checkout ${{ github.event.pull_request.head.ref }}
53+
- name: Prepare CHANGELOG
54+
run: |
55+
echo "${{ github.event.pull_request.body }}" | csplit -s - "/##/"
56+
echo "# Changelog
57+
## ${{ env.VERSION }}
58+
" >> CHANGELOG.tmp
59+
grep "^*" xx01 >> CHANGELOG.tmp
60+
grep -v "^# " CHANGELOG.md >> CHANGELOG.tmp
61+
cp CHANGELOG.tmp CHANGELOG.md
62+
- name: Prepare version.rb
63+
run: |
64+
sed -i "s|STRING = '[^']*'|STRING = '${{ env.VERSION }}'|" lib/messagebird/version.rb
65+
- name: Commit changes
66+
run: |
67+
git add CHANGELOG.md lib/messagebird/version.rb
68+
git commit -m "Bump to version ${{ env.VERSION }}"
69+
- name: Push
70+
run: git push

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master, main]
7+
8+
jobs:
9+
ci:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
ruby-version: [ "2.7.3", "3.0.1" ]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up Ruby ${{ matrix.ruby-version }}
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: ${{ matrix.ruby-version }}
23+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24+
25+
- name: Lint ${{ matrix.ruby-version }}
26+
run: bundle exec rubocop
27+
28+
- name: Test ${{ matrix.ruby-version }}
29+
run: bundle exec rspec

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
.DS_Store
12
*.gem
3+
/Gemfile.lock
4+
.rbenv-gemsets
5+
.ruby-version
6+
.byebug_history

.rubocop.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
AllCops:
2+
TargetRubyVersion: 2.6.7
3+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
4+
# to ignore them, so only the ones explicitly set in this file are enabled.
5+
# DisabledByDefault: true
6+
Exclude:
7+
- Gemfile
8+
- "*.gemspec"
9+
- "vendor/**/*"
10+
Metrics/ClassLength:
11+
Enabled: false
12+
Metrics/MethodLength:
13+
Enabled: false
14+
Metrics/LineLength:
15+
Enabled: false
16+
Metrics/AbcSize:
17+
Enabled: false
18+
Metrics/CyclomaticComplexity:
19+
Enabled: false
20+
Metrics/BlockLength:
21+
Enabled: false
22+
Style/Documentation:
23+
Enabled: false
24+
Style/GuardClause:
25+
Enabled: false
26+
Style/ConditionalAssignment:
27+
Enabled: false
28+
Style/IfUnlessModifier:
29+
Enabled: false
30+
Style/WordArray:
31+
Enabled: false
32+
Layout/ClosingParenthesisIndentation:
33+
Enabled: false
34+
Style/PercentLiteralDelimiters:
35+
Enabled: false
36+
Style/SymbolArray:
37+
Enabled: false
38+
Style/BracesAroundHashParameters:
39+
Enabled: false

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
## 3.1.1
3+
4+
* [ADDED] Add release tagging workflow.
5+
6+
## 3.1.0
7+
8+
* [CHANGED] Deprecate old signed request validation.
9+
* [ADDED] New request validator with JWT webhook signature.
10+
* [ADDED] Add release and publish GitHub actions.

Gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
# Declare your gem's dependencies in messagebird-rest.gemspec.
5+
# Bundler will treat runtime dependencies like base dependencies, and
6+
# development dependencies will be added by default to the :development group.
7+
gemspec
8+
9+
# Declare any dependencies that are still in development here instead of in
10+
# your gemspec. These might include edge Rails or gems from your path or
11+
# Git. Remember to move these dependencies to your gemspec before releasing
12+
# your gem to rubygems.org.
13+
14+
# To use a debugger
15+
# gem 'byebug', group: [:development, :test]

README.md

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ MessageBird's REST API for Ruby
22
===============================
33
This repository contains the open source Ruby client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com/
44

5-
[![Build Status](https://travis-ci.org/messagebird/ruby-rest-api.svg?branch=master)](https://travis-ci.org/messagebird/ruby-rest-api)
5+
[![Build Status](https://github.com/messagebird/ruby-rest-api/actions/workflows/ruby_ci.yml/badge.svg)](https://github.com/messagebird/ruby-rest-api/actions)
66

77
Requirements
88
------------
@@ -58,7 +58,7 @@ pp client.message_create('FromMe', '31612345678', 'Hello World', :reference => '
5858

5959
#<MessageBird::Message:0x007f8d5b883520
6060
@body="Hello World",
61-
@createdDatetime=2014-07-07 12:20:30 +0200,
61+
@created_datetime=2014-07-07 12:20:30 +0200,
6262
@datacoding="plain",
6363
@direction="mt",
6464
@gateway=239,
@@ -68,7 +68,7 @@ pp client.message_create('FromMe', '31612345678', 'Hello World', :reference => '
6868
@mclass=1,
6969
@originator="FromMe",
7070
@recipient=
71-
{"totalCount"=>1,
71+
{"total_count"=>1,
7272
"totalSentCount"=>1,
7373
"totalDeliveredCount"=>0,
7474
"totalDeliveryFailedCount"=>0,
@@ -78,9 +78,9 @@ pp client.message_create('FromMe', '31612345678', 'Hello World', :reference => '
7878
@status="sent",
7979
@statusDatetime=2014-07-07 12:20:30 +0200>]},
8080
@reference="MyReference",
81-
@scheduledDatetime=nil,
81+
@scheduled_datetime=nil,
8282
@type="sms",
83-
@typeDetails={},
83+
@type_details={},
8484
@validity=nil>
8585
```
8686

@@ -97,7 +97,7 @@ To perform HLR lookups we have created the **hlr_create** method, which takes a
9797
pp client.hlr_create('31612345678', 'MyReference')
9898

9999
#<MessageBird::HLR:0x007f8d5b8dafc8
100-
@createdDatetime=2014-07-07 12:20:05 +0200,
100+
@created_datetime=2014-07-07 12:20:05 +0200,
101101
@href="https://rest.messagebird.com/hlr/4933bed0453ba7455031712h16830892",
102102
@id="4933bed0453ba7455031712h16830892",
103103
@msisdn=31612345678,
@@ -126,7 +126,7 @@ client.verify_create(31612345678, {:reference => "YourReference"})
126126
@reference="YourReference",
127127
@status="sent",
128128
@href={"message"=>"https://rest.messagebird.com/messages/67d42f004555213679416f0b13254392"},
129-
@createdDatetime=2015-05-12 16:51:19 +0200,
129+
@created_datetime=2015-05-12 16:51:19 +0200,
130130
@validUntilDatetime=2015-05-12 16:51:49 +0200>
131131
```
132132

@@ -147,14 +147,14 @@ pp client.voice_message_create('31612345678', 'Hello World', :reference => 'MyRe
147147

148148
#<MessageBird::VoiceMessage:0x000001030101b8
149149
@body="Hello World",
150-
@createdDatetime=2014-07-09 12:17:50 +0200,
150+
@created_datetime=2014-07-09 12:17:50 +0200,
151151
@href=
152152
"https://rest.messagebird.com/voicemessages/a08e51a0353bd16cea7f298a37405850",
153153
@id="a08e51a0353bd16cea7f298a37405850",
154154
@ifMachine="continue",
155155
@language="en-gb",
156156
@recipients=
157-
{"totalCount"=>1,
157+
{"total_count"=>1,
158158
"totalSentCount"=>1,
159159
"totalDeliveredCount"=>0,
160160
"totalDeliveryFailedCount"=>0,
@@ -175,6 +175,54 @@ Similar to regular messaging and HLR lookups, there is a method available to fet
175175
client.voice_message('a08e51a0353bd16cea7f298a37405850')
176176
```
177177

178+
##### Numbers
179+
There is also a Numbers API that allow you to search for and purchase number subscriptions to use as originator in other services.
180+
181+
```ruby
182+
pp client.number_search("NL", {:limit=>5})
183+
184+
#<List:0x00007fa405130618
185+
@count=5,
186+
@items=
187+
[#<MessageBird::Number:0x00007fa405130528
188+
@country="NL",
189+
@features=["voice"],
190+
@locality="Rotterdam",
191+
@number="31102005108",
192+
@region="",
193+
@type="unknown">,
194+
#<MessageBird::Number:0x00007fa4051303c0
195+
@country="NL",
196+
@features=["voice"],
197+
@locality="Rotterdam",
198+
@number="31102005143",
199+
@region="",
200+
@type="unknown">,
201+
#<MessageBird::Number:0x00007fa405130208
202+
@country="NL",
203+
@features=["voice"],
204+
@locality="Rotterdam",
205+
@number="31102005145",
206+
@region="",
207+
@type="unknown">,
208+
#<MessageBird::Number:0x00007fa4051300c8
209+
@country="NL",
210+
@features=["voice"],
211+
@locality="Rotterdam",
212+
@number="31102005147",
213+
@region="",
214+
@type="unknown">,
215+
#<MessageBird::Number:0x00007fa405131c48
216+
@country="NL",
217+
@features=["voice"],
218+
@locality="Rotterdam",
219+
@number="31102005148",
220+
@region="",
221+
@type="unknown">],
222+
@limit=5,
223+
@type=MessageBird::Number>
224+
````
225+
178226
Documentation
179227
-------------
180228
Complete documentation, instructions, and examples are available at:

0 commit comments

Comments
 (0)