messagebird-rest 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/messagebird/base.rb +2 -0
- data/lib/messagebird/callflow.rb +5 -4
- data/lib/messagebird/client.rb +6 -3
- data/lib/messagebird/conversation_client.rb +3 -3
- data/lib/messagebird/error.rb +8 -0
- data/lib/messagebird/http_client.rb +1 -1
- data/lib/messagebird/list.rb +16 -14
- data/lib/messagebird/message.rb +1 -1
- data/lib/messagebird/request_validator.rb +1 -1
- data/lib/messagebird/version.rb +1 -1
- data/lib/messagebird/voice/call_leg_recording.rb +1 -0
- data/lib/messagebird/voice/list.rb +1 -0
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7b235894410103a5ae0cddb620fb84e1e713c022a8f974ab54d114d69fe1d0
|
4
|
+
data.tar.gz: 95411be3e97854eb9696c0b2f24092fdbd0f41deab6949be4656566312520e01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13e721d025a6e85b5f503770fe04a09a60048358ca9c76556a42903a7d59134f9290b2b736a6504bbfab559997bd29d53c8fd76b74b861544dd80d7de3d502d3
|
7
|
+
data.tar.gz: 26762318e8db116c1ddff86d49b64434328b0569815ab84f247c255978d7e60773e0d87f6ab589441bbcd1ab4460815734b1c42944b4425dbc998a7d11da6f23
|
data/lib/messagebird/base.rb
CHANGED
@@ -7,6 +7,8 @@ module MessageBird
|
|
7
7
|
class Base
|
8
8
|
# takes each element from the given hash and apply it to ourselves through an assignment method
|
9
9
|
def map_hash_elements_to_self(hash)
|
10
|
+
return if hash.nil?
|
11
|
+
|
10
12
|
hash.each do |key, value|
|
11
13
|
method_name = key.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase # convert came case to snake case
|
12
14
|
method_name += '='
|
data/lib/messagebird/callflow.rb
CHANGED
@@ -26,7 +26,8 @@ module MessageBird
|
|
26
26
|
end
|
27
27
|
|
28
28
|
class CallFlowList < List
|
29
|
-
attr_accessor :
|
29
|
+
attr_accessor :per_page, :current_page, :page_count, :total_count
|
30
|
+
|
30
31
|
PER_PAGE = 20
|
31
32
|
CURRENT_PAGE = 1
|
32
33
|
|
@@ -53,8 +54,8 @@ module MessageBird
|
|
53
54
|
|
54
55
|
class CallFlowStepOption < MessageBird::Base
|
55
56
|
attr_accessor :destination, :payload, :language, :voice, :repeat,
|
56
|
-
:media, :length, :
|
57
|
-
:
|
58
|
-
:
|
57
|
+
:media, :length, :max_length, :timeout, :finish_on_key, :transcribe,
|
58
|
+
:transcribe_language, :record, :url, :if_machine, :machine_timeout,
|
59
|
+
:on_finish, :mask
|
59
60
|
end
|
60
61
|
end
|
data/lib/messagebird/client.rb
CHANGED
@@ -30,14 +30,16 @@ require 'messagebird/voice/call'
|
|
30
30
|
require 'messagebird/voice/call_leg'
|
31
31
|
require 'messagebird/voice/call_leg_recording'
|
32
32
|
require 'messagebird/voice/transcription'
|
33
|
-
require 'messagebird/voice/list'
|
34
33
|
|
35
34
|
module MessageBird
|
36
35
|
class ErrorException < StandardError
|
37
36
|
attr_reader :errors
|
38
37
|
|
39
38
|
def initialize(errors)
|
39
|
+
super()
|
40
40
|
@errors = errors
|
41
|
+
message = errors.map(&:message).join(', ')
|
42
|
+
super(message)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -47,7 +49,8 @@ module MessageBird
|
|
47
49
|
class Client
|
48
50
|
attr_reader :access_key, :http_client, :conversation_client, :voice_client
|
49
51
|
|
50
|
-
def initialize(access_key = nil, http_client = nil, conversation_client = nil, voice_client = nil)
|
52
|
+
def initialize(access_key = nil, http_client = nil, conversation_client = nil, voice_client = nil) # rubocop:disable Metrics/ParameterLists
|
53
|
+
super()
|
51
54
|
@access_key = access_key || ENV['MESSAGEBIRD_ACCESS_KEY']
|
52
55
|
@http_client = http_client || HttpClient.new(@access_key)
|
53
56
|
@conversation_client = conversation_client || ConversationClient.new(@access_key)
|
@@ -490,7 +493,7 @@ module MessageBird
|
|
490
493
|
# JSON by default. See also:
|
491
494
|
# https://developers.messagebird.com/docs/alternatives.
|
492
495
|
|
493
|
-
|
496
|
+
contact_ids.map { |id| "ids[]=#{id}" }.join('&').prepend('_method=PUT&')
|
494
497
|
end
|
495
498
|
|
496
499
|
def add_querystring(path, params)
|
data/lib/messagebird/error.rb
CHANGED
@@ -5,5 +5,13 @@ require 'messagebird/base'
|
|
5
5
|
module MessageBird
|
6
6
|
class Error < MessageBird::Base
|
7
7
|
attr_accessor :code, :description, :parameter
|
8
|
+
|
9
|
+
def message
|
10
|
+
if parameter
|
11
|
+
"#{description} (error code: #{code}, parameter: #{parameter})"
|
12
|
+
else
|
13
|
+
"#{description} (error code: #{code})"
|
14
|
+
end
|
15
|
+
end
|
8
16
|
end
|
9
17
|
end
|
@@ -33,7 +33,7 @@ module MessageBird
|
|
33
33
|
http
|
34
34
|
end
|
35
35
|
|
36
|
-
def request(method, path, params = {}, check_json
|
36
|
+
def request(method, path, params = {}, check_json: true)
|
37
37
|
uri = URI.join(endpoint, path)
|
38
38
|
http = build_http_client(uri)
|
39
39
|
request = build_request(method, uri, params)
|
data/lib/messagebird/list.rb
CHANGED
@@ -2,23 +2,25 @@
|
|
2
2
|
|
3
3
|
require 'messagebird/base'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
module MessageBird
|
6
|
+
class List < MessageBird::Base
|
7
|
+
attr_accessor :offset, :limit, :count, :total_count, :links
|
8
|
+
attr_reader :items
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
# type will be used to create objects for the items, e.g.
|
11
|
+
# List.new(Contact, {}).
|
12
|
+
def initialize(type, json)
|
13
|
+
@type = type
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
super(json)
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def items=(value)
|
19
|
+
@items = value.map { |i| @type.new i }
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def [](index)
|
23
|
+
@items[index]
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
data/lib/messagebird/message.rb
CHANGED
@@ -6,7 +6,7 @@ require 'messagebird/recipient'
|
|
6
6
|
module MessageBird
|
7
7
|
class Message < MessageBird::Base
|
8
8
|
attr_accessor :id, :href, :direction, :type, :originator, :body, :reference,
|
9
|
-
:validity, :gateway, :
|
9
|
+
:validity, :gateway, :type_details, :datacoding, :mclass
|
10
10
|
attr_reader :scheduled_date_time, :created_datetime, :recipients
|
11
11
|
|
12
12
|
def scheduled_date_time=(value)
|
@@ -20,7 +20,7 @@ module MessageBird
|
|
20
20
|
#
|
21
21
|
# @param [string] signature_key customer signature key. Can be retrieved through <a href="https://dashboard.messagebird.com/developers/settings">Developer Settings</a>. This is NOT your API key.
|
22
22
|
# @param [bool] skip_url_validation whether url_hash claim validation should be skipped. Note that when true, no query parameters should be trusted.
|
23
|
-
def initialize(signature_key, skip_url_validation
|
23
|
+
def initialize(signature_key, skip_url_validation: false)
|
24
24
|
@signature_key = signature_key
|
25
25
|
@skip_url_validation = skip_url_validation
|
26
26
|
end
|
data/lib/messagebird/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagebird-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maurice Nonnekes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.11.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: 3.11.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.26.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.26.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.14.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
68
|
+
version: 3.14.0
|
69
69
|
description: A simple REST API for MessageBird in Ruby
|
70
70
|
email: maurice@messagebird.com
|
71
71
|
executables: []
|
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '3.0'
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - ">="
|