gupshup-rb 0.1.8.3 → 0.1.9
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 +4 -4
- data/.gitignore +8 -17
- data/.rubocop.yml +8 -54
- data/CODE_OF_CONDUCT.md +60 -38
- data/README.md +1 -1
- data/Rakefile +6 -8
- data/bin/setup +1 -0
- data/gupshup-rb.gemspec +3 -5
- data/lib/gupshup-rb/framework/request.rb +28 -29
- data/lib/gupshup-rb/rest/api.rb +11 -216
- data/lib/gupshup-rb/rest/client.rb +1 -541
- data/lib/gupshup-rb/version.rb +1 -1
- data/lib/gupshup-rb.rb +0 -7
- metadata +7 -15
- data/LICENSE +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c85ca7254d2d5d8d68703723f1898018bc883371d54c819fa1b64b104c4b2e3
|
4
|
+
data.tar.gz: 3167ef6a4cc750fa4f836fdd5d7707eae43d2b8db3ca0f78fe8b2767814a909e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d6a604607b3edb65a107bd014131fd3e3be3d735554080a5df563769d43feac0150f7d7e3ca24735c585615d42b974d8c3b7b11fc34414e122527be2bbc0d4
|
7
|
+
data.tar.gz: f5131059df910e6fa3acec9a22578aad92aac894d0cb0d1fdcdcdda85c9ac9e6ca0ea9bc33cae41e2318febc344414ae1477161012051a1364b6783d5e483053
|
data/.gitignore
CHANGED
@@ -1,17 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
pkg
|
7
|
-
|
8
|
-
|
9
|
-
*.gem
|
10
|
-
docs/_build
|
11
|
-
*.bak
|
12
|
-
*.iml
|
13
|
-
.bundle
|
14
|
-
.rakeTasks
|
15
|
-
.yardoc
|
16
|
-
|
17
|
-
coverage
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
data/.rubocop.yml
CHANGED
@@ -1,59 +1,13 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
1
|
AllCops:
|
4
|
-
TargetRubyVersion: 2.
|
5
|
-
Exclude:
|
6
|
-
- 'lib/gupshup-rb/rest/**/*'
|
7
|
-
- 'spec/integration/**/*'
|
8
|
-
- 'lib/gupshup-rb/version.rb'
|
9
|
-
- 'lib/gupshup-rb/twiml/**/*'
|
10
|
-
- 'lib/gupshup-rb/util/configuration.rb'
|
11
|
-
- 'vendor/**/*'
|
12
|
-
|
13
|
-
Layout/LineLength:
|
14
|
-
Max: 120
|
15
|
-
Exclude:
|
16
|
-
- 'spec/**/*'
|
17
|
-
|
18
|
-
Style/BlockDelimiters:
|
19
|
-
Exclude:
|
20
|
-
- 'spec/**/*'
|
21
|
-
|
22
|
-
Lint/AmbiguousBlockAssociation:
|
23
|
-
Exclude:
|
24
|
-
- 'spec/**/*'
|
25
|
-
|
26
|
-
Metrics/BlockLength:
|
27
|
-
Exclude:
|
28
|
-
- 'spec/**/*'
|
29
|
-
- gupshup-rb.gemspec
|
30
|
-
|
31
|
-
Layout/HeredocIndentation:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Metrics/ClassLength:
|
35
|
-
Max: 175
|
2
|
+
TargetRubyVersion: 2.6
|
36
3
|
|
37
|
-
|
38
|
-
Max: 25
|
39
|
-
|
40
|
-
Metrics/ParameterLists:
|
41
|
-
Max: 20
|
42
|
-
|
43
|
-
Metrics/AbcSize:
|
44
|
-
Enabled: false
|
45
|
-
|
46
|
-
Metrics/PerceivedComplexity:
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
Metrics/CyclomaticComplexity:
|
50
|
-
Enabled: false
|
51
|
-
|
52
|
-
Style/HashEachMethods:
|
4
|
+
Style/StringLiterals:
|
53
5
|
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
54
7
|
|
55
|
-
Style/
|
56
|
-
Enabled:
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
57
11
|
|
58
|
-
|
59
|
-
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 120
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -2,61 +2,83 @@
|
|
2
2
|
|
3
3
|
## Our Pledge
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
-
level of experience, education, socio-economic status, nationality, personal
|
10
|
-
appearance, race, religion, or sexual identity and orientation.
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
11
8
|
|
12
9
|
## Our Standards
|
13
10
|
|
14
|
-
Examples of behavior that contributes to
|
15
|
-
include:
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
22
18
|
|
23
|
-
Examples of unacceptable behavior
|
19
|
+
Examples of unacceptable behavior include:
|
24
20
|
|
25
|
-
|
26
|
-
advances
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
address, without explicit permission
|
31
|
-
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
28
|
professional setting
|
33
29
|
|
34
|
-
##
|
30
|
+
## Enforcement Responsibilities
|
35
31
|
|
36
|
-
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
39
33
|
|
40
|
-
|
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.
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
45
35
|
|
46
36
|
## Scope
|
47
37
|
|
48
|
-
This Code of Conduct applies
|
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.
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
54
39
|
|
55
40
|
## Enforcement
|
56
41
|
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
57
74
|
## Attribution
|
58
75
|
|
59
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version
|
60
|
-
available at https://www.contributor-covenant.org/version/
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
61
80
|
|
62
81
|
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/README.md
CHANGED
@@ -35,4 +35,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
35
35
|
|
36
36
|
## Code of Conduct
|
37
37
|
|
38
|
-
Everyone interacting in the Gupshup::Rb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/raimartinsb/gupshup-rb/blob/master/CODE_OF_CONDUCT.md).
|
38
|
+
Everyone interacting in the Gupshup::Rb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/raimartinsb/gupshup-rb/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
Bundler.setup
|
3
|
-
Bundler::GemHelper.install_tasks
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
require
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rubocop/rake_task"
|
8
5
|
|
9
|
-
|
10
|
-
|
6
|
+
RuboCop::RakeTask.new
|
7
|
+
|
8
|
+
task default: :rubocop
|
data/bin/setup
CHANGED
data/gupshup-rb.gemspec
CHANGED
@@ -12,15 +12,13 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'Communication with Chatwoot - Not Completed! Still does not work!'
|
13
13
|
spec.homepage = 'https://github.com/raimartinsb/gupshup-rb'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.
|
15
|
+
spec.required_ruby_version = '>= 2.6.0'
|
16
16
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = 'https://github.com/raimartinsb/gupshup-rb'
|
17
19
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match?(%r{^(spec)/}) }
|
18
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
21
|
spec.require_paths = ['lib']
|
21
|
-
spec.required_ruby_version = '>= 2.0.0'
|
22
|
-
spec.extra_rdoc_files = ['README.md', 'LICENSE']
|
23
|
-
spec.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'gupshup-rb', '--main', 'README.md']
|
24
22
|
|
25
23
|
spec.add_dependency('jwt', '>= 1.5', '< 3.0')
|
26
24
|
spec.add_dependency('nokogiri', '>= 1.6', '< 2.0')
|
@@ -2,40 +2,39 @@
|
|
2
2
|
|
3
3
|
module Gupshup
|
4
4
|
class Request
|
5
|
-
|
5
|
+
attr_reader :host, :port, :method, :url, :params, :data, :headers, :auth, :timeout
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def to_s
|
20
|
-
auth = @auth.nil? ? '' : '(' + @auth.join(',') + ')'
|
7
|
+
def initialize(host, port, method, url, params = {}, data = {}, headers = {}, auth = nil, timeout = nil)
|
8
|
+
@host = host
|
9
|
+
@port = port
|
10
|
+
@url = url
|
11
|
+
@method = method
|
12
|
+
@params = params
|
13
|
+
@data = data
|
14
|
+
@headers = headers
|
15
|
+
@auth = auth
|
16
|
+
@timeout = timeout
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
params = '?' + @params.each.map { |key, value| "#{CGI.escape(key)}=#{CGI.escape(value)}" }.join('&')
|
25
|
-
end
|
19
|
+
def to_s
|
20
|
+
auth = @auth.nil? ? '' : '(' + @auth.join(',') + ')'
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
params = ''
|
23
|
+
unless @params.nil? || @params.empty?
|
24
|
+
params = '?' + @params.each.map { |key, value| "#{CGI.escape(key)}=#{CGI.escape(value)}" }.join('&')
|
25
|
+
end
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
27
|
+
headers = ''
|
28
|
+
unless @headers.nil? || @headers.empty?
|
29
|
+
headers = "\n" + @headers.each.map { |key, value| "-H \"#{key}\": \"#{value}\"" }.join("\n")
|
30
|
+
end
|
37
31
|
|
38
|
-
|
32
|
+
data = ''
|
33
|
+
unless @data.nil? || @data.empty?
|
34
|
+
data = @method.equal?('GET') ? "\n -G" : "\n"
|
35
|
+
data += @data.each.map { |key, value| "-d \"#{key}\"=\"#{value}\"" }.join("\n")
|
39
36
|
end
|
37
|
+
"#{auth} #{@method} #{@url}#{params}#{data}#{headers}"
|
38
|
+
end
|
40
39
|
end
|
41
40
|
end
|
data/lib/gupshup-rb/rest/api.rb
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# \ / _ _ _| _ _
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
-
# / /
|
6
|
-
#
|
7
|
-
# frozen_string_literal: true
|
8
|
-
|
9
1
|
module Gupshup
|
10
2
|
module REST
|
11
3
|
class Api < Domain
|
@@ -14,225 +6,28 @@ module Gupshup
|
|
14
6
|
def initialize(gupshup)
|
15
7
|
super
|
16
8
|
|
9
|
+
#@base_url = 'https://api.gupshup.com'
|
10
|
+
#@host = 'api.gupshup.com'
|
11
|
+
#@port = 443
|
17
12
|
@uri = "https://api.gupshup.io/sm/api/v1/msg"
|
18
13
|
|
19
14
|
# Versions
|
20
|
-
@
|
21
|
-
end
|
22
|
-
|
23
|
-
##
|
24
|
-
# Version v2010 of api
|
25
|
-
def v2010
|
26
|
-
@v2010 ||= V2010.new self
|
27
|
-
end
|
28
|
-
|
29
|
-
##
|
30
|
-
# Account provided as the authenticating account
|
31
|
-
def account
|
32
|
-
self.v2010.account
|
33
|
-
end
|
34
|
-
|
35
|
-
##
|
36
|
-
# @param [String] sid A 34 character string that uniquely identifies this
|
37
|
-
# resource.
|
38
|
-
# @return [Gupshup::REST::Api::V2010::AccountInstance] if sid was passed.
|
39
|
-
# @return [Gupshup::REST::Api::V2010::AccountList]
|
40
|
-
def accounts(sid=:unset)
|
41
|
-
self.v2010.accounts(sid)
|
42
|
-
end
|
43
|
-
|
44
|
-
##
|
45
|
-
# @param [String] sid The unique string that that we created to identify the
|
46
|
-
# Address resource.
|
47
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AddressInstance] if sid was passed.
|
48
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AddressList]
|
49
|
-
def addresses(sid=:unset)
|
50
|
-
self.account.addresses(sid)
|
51
|
-
end
|
52
|
-
|
53
|
-
##
|
54
|
-
# @param [String] sid The unique string that that we created to identify the
|
55
|
-
# Application resource.
|
56
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ApplicationInstance] if sid was passed.
|
57
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ApplicationList]
|
58
|
-
def applications(sid=:unset)
|
59
|
-
self.account.applications(sid)
|
60
|
-
end
|
61
|
-
|
62
|
-
##
|
63
|
-
# @param [String] connect_app_sid The SID that we assigned to the Connect App.
|
64
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AuthorizedConnectAppInstance] if connect_app_sid was passed.
|
65
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AuthorizedConnectAppList]
|
66
|
-
def authorized_connect_apps(connect_app_sid=:unset)
|
67
|
-
self.account.authorized_connect_apps(connect_app_sid)
|
15
|
+
@v1 = nil
|
68
16
|
end
|
69
17
|
|
70
18
|
##
|
71
|
-
#
|
72
|
-
|
73
|
-
|
74
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryInstance] if country_code was passed.
|
75
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryList]
|
76
|
-
def available_phone_numbers(country_code=:unset)
|
77
|
-
self.account.available_phone_numbers(country_code)
|
19
|
+
# Version v1 of api
|
20
|
+
def v1
|
21
|
+
@v1 ||= V1.new self
|
78
22
|
end
|
79
|
-
|
80
|
-
##
|
81
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::BalanceInstance]
|
82
|
-
def balance
|
83
|
-
self.account.balance()
|
84
|
-
end
|
85
|
-
|
86
|
-
##
|
87
|
-
# @param [String] sid The unique string that we created to identify this Call
|
88
|
-
# resource.
|
89
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::CallInstance] if sid was passed.
|
90
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::CallList]
|
91
|
-
def calls(sid=:unset)
|
92
|
-
self.account.calls(sid)
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
# @param [String] sid The unique string that that we created to identify this
|
97
|
-
# Conference resource.
|
98
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConferenceInstance] if sid was passed.
|
99
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConferenceList]
|
100
|
-
def conferences(sid=:unset)
|
101
|
-
self.account.conferences(sid)
|
102
|
-
end
|
103
|
-
|
104
|
-
##
|
105
|
-
# @param [String] sid The unique string that that we created to identify the
|
106
|
-
# ConnectApp resource.
|
107
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConnectAppInstance] if sid was passed.
|
108
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConnectAppList]
|
109
|
-
def connect_apps(sid=:unset)
|
110
|
-
self.account.connect_apps(sid)
|
111
|
-
end
|
112
|
-
|
113
|
-
##
|
114
|
-
# @param [String] sid The unique string that that we created to identify this
|
115
|
-
# IncomingPhoneNumber resource.
|
116
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::IncomingPhoneNumberInstance] if sid was passed.
|
117
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::IncomingPhoneNumberList]
|
118
|
-
def incoming_phone_numbers(sid=:unset)
|
119
|
-
self.account.incoming_phone_numbers(sid)
|
120
|
-
end
|
121
|
-
|
122
|
-
##
|
123
|
-
# @param [String] sid The unique string that that we created to identify the Key
|
124
|
-
# resource.
|
125
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::KeyInstance] if sid was passed.
|
126
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::KeyList]
|
127
|
-
def keys(sid=:unset)
|
128
|
-
self.account.keys(sid)
|
129
|
-
end
|
130
|
-
|
23
|
+
|
131
24
|
##
|
132
25
|
# @param [String] sid The unique string that that we created to identify the
|
133
26
|
# Message resource.
|
134
|
-
# @return [Gupshup::REST::Api::
|
135
|
-
# @return [Gupshup::REST::Api::
|
27
|
+
# @return [Gupshup::REST::Api::V1::AccountContext::MessageInstance] if sid was passed.
|
28
|
+
# @return [Gupshup::REST::Api::V1::AccountContext::MessageList]
|
136
29
|
def messages(sid=:unset)
|
137
|
-
self.
|
138
|
-
end
|
139
|
-
|
140
|
-
##
|
141
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NewKeyInstance]
|
142
|
-
def new_keys
|
143
|
-
self.account.new_keys()
|
144
|
-
end
|
145
|
-
|
146
|
-
##
|
147
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NewSigningKeyInstance]
|
148
|
-
def new_signing_keys
|
149
|
-
self.account.new_signing_keys()
|
150
|
-
end
|
151
|
-
|
152
|
-
##
|
153
|
-
# @param [String] sid The unique string that that we created to identify the
|
154
|
-
# Notification resource.
|
155
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NotificationInstance] if sid was passed.
|
156
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NotificationList]
|
157
|
-
def notifications(sid=:unset)
|
158
|
-
self.account.notifications(sid)
|
159
|
-
end
|
160
|
-
|
161
|
-
##
|
162
|
-
# @param [String] sid The unique string that that we created to identify the
|
163
|
-
# OutgoingCallerId resource.
|
164
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::OutgoingCallerIdInstance] if sid was passed.
|
165
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::OutgoingCallerIdList]
|
166
|
-
def outgoing_caller_ids(sid=:unset)
|
167
|
-
self.account.outgoing_caller_ids(sid)
|
168
|
-
end
|
169
|
-
|
170
|
-
##
|
171
|
-
# @param [String] sid The unique string that that we created to identify this
|
172
|
-
# Queue resource.
|
173
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::QueueInstance] if sid was passed.
|
174
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::QueueList]
|
175
|
-
def queues(sid=:unset)
|
176
|
-
self.account.queues(sid)
|
177
|
-
end
|
178
|
-
|
179
|
-
##
|
180
|
-
# @param [String] sid The unique string that that we created to identify the
|
181
|
-
# Recording resource.
|
182
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::RecordingInstance] if sid was passed.
|
183
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::RecordingList]
|
184
|
-
def recordings(sid=:unset)
|
185
|
-
self.account.recordings(sid)
|
186
|
-
end
|
187
|
-
|
188
|
-
##
|
189
|
-
# @param [String] sid The sid
|
190
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::SigningKeyInstance] if sid was passed.
|
191
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::SigningKeyList]
|
192
|
-
def signing_keys(sid=:unset)
|
193
|
-
self.account.signing_keys(sid)
|
194
|
-
end
|
195
|
-
|
196
|
-
##
|
197
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::SipInstance]
|
198
|
-
def sip
|
199
|
-
self.account.sip()
|
200
|
-
end
|
201
|
-
|
202
|
-
##
|
203
|
-
# @param [String] sid The unique string that that we created to identify this
|
204
|
-
# ShortCode resource.
|
205
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ShortCodeInstance] if sid was passed.
|
206
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ShortCodeList]
|
207
|
-
def short_codes(sid=:unset)
|
208
|
-
self.account.short_codes(sid)
|
209
|
-
end
|
210
|
-
|
211
|
-
##
|
212
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::TokenInstance]
|
213
|
-
def tokens
|
214
|
-
self.account.tokens()
|
215
|
-
end
|
216
|
-
|
217
|
-
##
|
218
|
-
# @param [String] sid The unique string that that we created to identify the
|
219
|
-
# Transcription resource.
|
220
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::TranscriptionInstance] if sid was passed.
|
221
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::TranscriptionList]
|
222
|
-
def transcriptions(sid=:unset)
|
223
|
-
self.account.transcriptions(sid)
|
224
|
-
end
|
225
|
-
|
226
|
-
##
|
227
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::UsageInstance]
|
228
|
-
def usage
|
229
|
-
self.account.usage()
|
230
|
-
end
|
231
|
-
|
232
|
-
##
|
233
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ValidationRequestInstance]
|
234
|
-
def validation_requests
|
235
|
-
self.account.validation_requests()
|
30
|
+
self.messages(sid)
|
236
31
|
end
|
237
32
|
|
238
33
|
##
|
@@ -1,9 +1,3 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# \ / _ _ _| _ _
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
-
# / /
|
6
|
-
#
|
7
1
|
# frozen_string_literal: true
|
8
2
|
|
9
3
|
module Gupshup
|
@@ -18,13 +12,6 @@ module Gupshup
|
|
18
12
|
##
|
19
13
|
# Initializes the Gupshup Client
|
20
14
|
def initialize(username=nil, password=nil, src_name=nil, region=nil, http_client=nil, logger=nil, user_agent_extensions=nil)
|
21
|
-
puts 'Gupshup'
|
22
|
-
puts Gupshup
|
23
|
-
|
24
|
-
binding.local_variables.each do |var_name|
|
25
|
-
var_value = binding.local_variable_get(var_name)
|
26
|
-
puts "#{var_name}: #{var_value}"
|
27
|
-
end
|
28
15
|
@src_name = src_name || Gupshup.src_name
|
29
16
|
@api_key = password || Gupshup.api_key
|
30
17
|
@auth = [@src_name, @api_key]
|
@@ -41,541 +28,14 @@ module Gupshup
|
|
41
28
|
@video = nil
|
42
29
|
end
|
43
30
|
|
44
|
-
##
|
45
|
-
# Makes a request to the Gupshup API using the configured http client
|
46
|
-
# Authentication information is automatically added if none is provided
|
47
|
-
def request(host, port, method, uri, params={}, data={}, headers={}, auth=nil, timeout=nil)
|
48
|
-
auth ||= @auth
|
49
|
-
|
50
|
-
ruby_config = RbConfig::CONFIG
|
51
|
-
headers['User-Agent'] = "gupshup-rb/#{Gupshup::VERSION} (#{ruby_config["host_os"]} #{ruby_config["host_cpu"]}) Ruby/#{RUBY_VERSION}"
|
52
|
-
headers['Accept-Charset'] = 'utf-8'
|
53
|
-
|
54
|
-
user_agent_extensions.each { |extension| headers['User-Agent'] += " #{extension}" }
|
55
|
-
|
56
|
-
if method == 'POST' && !headers['Content-Type']
|
57
|
-
headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
58
|
-
end
|
59
|
-
|
60
|
-
unless headers['Accept']
|
61
|
-
headers['Accept'] = 'application/json'
|
62
|
-
end
|
63
|
-
|
64
|
-
uri = build_uri(uri)
|
65
|
-
|
66
|
-
if @logger
|
67
|
-
@logger.debug("--BEGIN Gupshup API Request--")
|
68
|
-
@logger.debug("Request Method: <#{method}>")
|
69
|
-
|
70
|
-
headers.each do |key, value|
|
71
|
-
unless key.downcase == 'authorization'
|
72
|
-
@logger.debug("#{key}:#{value}")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
url = URI(uri)
|
77
|
-
@logger.debug("Host:#{url.host}")
|
78
|
-
@logger.debug("Path:#{url.path}")
|
79
|
-
@logger.debug("Query:#{url.query}")
|
80
|
-
@logger.debug("Request Params:#{params}")
|
81
|
-
end
|
82
|
-
|
83
|
-
response = @http_client.request(
|
84
|
-
host,
|
85
|
-
port,
|
86
|
-
method,
|
87
|
-
uri,
|
88
|
-
params,
|
89
|
-
data,
|
90
|
-
headers,
|
91
|
-
auth,
|
92
|
-
timeout
|
93
|
-
)
|
94
|
-
|
95
|
-
if @logger
|
96
|
-
@logger.debug("Response Status Code:#{response.status_code}")
|
97
|
-
@logger.debug("Response Headers:#{response.headers}")
|
98
|
-
@logger.debug("--END GUPSHUP API REQUEST--")
|
99
|
-
end
|
100
|
-
|
101
|
-
response
|
102
|
-
end
|
103
|
-
|
104
|
-
##
|
105
|
-
# Build the final request uri
|
106
|
-
def build_uri(uri)
|
107
|
-
if @region.nil? and @edge.nil?
|
108
|
-
return uri
|
109
|
-
end
|
110
|
-
|
111
|
-
parsed_url = URI(uri)
|
112
|
-
pieces = parsed_url.host.split('.')
|
113
|
-
product = pieces[0]
|
114
|
-
domain = pieces[-2, 2]
|
115
|
-
new_edge = @edge
|
116
|
-
new_region = @region
|
117
|
-
|
118
|
-
if pieces.length == 4
|
119
|
-
new_region ||= pieces[1]
|
120
|
-
elsif pieces.length == 5
|
121
|
-
new_edge ||= pieces[1]
|
122
|
-
new_region ||= pieces[2]
|
123
|
-
end
|
124
|
-
|
125
|
-
if !new_edge.nil? && new_region.nil?
|
126
|
-
new_region = @@default_region
|
127
|
-
end
|
128
|
-
|
129
|
-
parsed_url.host = [product, new_edge, new_region, domain].select {|item| !item.nil?}.join('.')
|
130
|
-
parsed_url.to_s
|
131
|
-
end
|
132
|
-
|
133
|
-
##
|
134
|
-
# Validate the new SSL certificate for the Gupshup API
|
135
|
-
def validate_ssl_certificate
|
136
|
-
response = request('api.gupshup.com', '8443', 'GET', 'https://api.gupshup.com:8443/.json')
|
137
|
-
if response.status_code < 200 || response.status_code >= 300
|
138
|
-
raise RestError.new 'Unexpected response from certificate endpoint', response
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
##
|
143
|
-
# Access the Accounts Gupshup Domain
|
144
|
-
def accounts
|
145
|
-
@accounts ||= Accounts.new self
|
146
|
-
end
|
147
|
-
|
148
|
-
##
|
149
|
-
# Access the Api Gupshup Domain
|
150
|
-
def api
|
151
|
-
@api ||= Api.new self
|
152
|
-
end
|
153
|
-
|
154
|
-
##
|
155
|
-
# Access the Autopilot Gupshup Domain
|
156
|
-
def autopilot
|
157
|
-
@autopilot ||= Autopilot.new self
|
158
|
-
end
|
159
|
-
|
160
|
-
##
|
161
|
-
# Access the Chat Gupshup Domain
|
162
|
-
def chat
|
163
|
-
@chat ||= Chat.new self
|
164
|
-
end
|
165
|
-
|
166
|
-
##
|
167
|
-
# Access the Content Gupshup Domain
|
168
|
-
def content
|
169
|
-
@content ||= Content.new self
|
170
|
-
end
|
171
|
-
|
172
|
-
##
|
173
|
-
# Access the Conversations Gupshup Domain
|
174
|
-
def conversations
|
175
|
-
@conversations ||= Conversations.new self
|
176
|
-
end
|
177
|
-
|
178
|
-
##
|
179
|
-
# Access the Events Gupshup Domain
|
180
|
-
def events
|
181
|
-
@events ||= Events.new self
|
182
|
-
end
|
183
|
-
|
184
|
-
##
|
185
|
-
# Access the FlexApi Gupshup Domain
|
186
|
-
def flex_api
|
187
|
-
@flex_api ||= FlexApi.new self
|
188
|
-
end
|
189
|
-
|
190
|
-
##
|
191
|
-
# Access the FrontlineApi Gupshup Domain
|
192
|
-
def frontline_api
|
193
|
-
@frontline_api ||= FrontlineApi.new self
|
194
|
-
end
|
195
|
-
|
196
|
-
##
|
197
|
-
# Access the Insights Gupshup Domain
|
198
|
-
def insights
|
199
|
-
@insights ||= Insights.new self
|
200
|
-
end
|
201
|
-
|
202
|
-
##
|
203
|
-
# Access the IpMessaging Gupshup Domain
|
204
|
-
def ip_messaging
|
205
|
-
@ip_messaging ||= IpMessaging.new self
|
206
|
-
end
|
207
|
-
|
208
|
-
##
|
209
|
-
# Access the Lookups Gupshup Domain
|
210
|
-
def lookups
|
211
|
-
@lookups ||= Lookups.new self
|
212
|
-
end
|
213
|
-
|
214
|
-
##
|
215
|
-
# Access the Media Gupshup Domain
|
216
|
-
def media
|
217
|
-
@media ||= Media.new self
|
218
|
-
end
|
219
|
-
|
220
|
-
##
|
221
|
-
# Access the Messaging Gupshup Domain
|
222
|
-
def messaging
|
223
|
-
@messaging ||= Messaging.new self
|
224
|
-
end
|
225
|
-
|
226
|
-
##
|
227
|
-
# Access the Monitor Gupshup Domain
|
228
|
-
def monitor
|
229
|
-
@monitor ||= Monitor.new self
|
230
|
-
end
|
231
|
-
|
232
|
-
##
|
233
|
-
# Access the Notify Gupshup Domain
|
234
|
-
def notify
|
235
|
-
@notify ||= Notify.new self
|
236
|
-
end
|
237
|
-
|
238
|
-
##
|
239
|
-
# Access the Numbers Gupshup Domain
|
240
|
-
def numbers
|
241
|
-
@numbers ||= Numbers.new self
|
242
|
-
end
|
243
|
-
|
244
|
-
##
|
245
|
-
# Access the Oauth Gupshup Domain
|
246
|
-
def oauth
|
247
|
-
@oauth ||= Oauth.new self
|
248
|
-
end
|
249
|
-
|
250
|
-
##
|
251
|
-
# Access the Preview Gupshup Domain
|
252
|
-
def preview
|
253
|
-
@preview ||= Preview.new self
|
254
|
-
end
|
255
|
-
|
256
|
-
##
|
257
|
-
# Access the Pricing Gupshup Domain
|
258
|
-
def pricing
|
259
|
-
@pricing ||= Pricing.new self
|
260
|
-
end
|
261
|
-
|
262
|
-
##
|
263
|
-
# Access the Proxy Gupshup Domain
|
264
|
-
def proxy
|
265
|
-
@proxy ||= Proxy.new self
|
266
|
-
end
|
267
|
-
|
268
|
-
##
|
269
|
-
# Access the Routes Gupshup Domain
|
270
|
-
def routes
|
271
|
-
@routes ||= Routes.new self
|
272
|
-
end
|
273
|
-
|
274
|
-
##
|
275
|
-
# Access the Serverless Gupshup Domain
|
276
|
-
def serverless
|
277
|
-
@serverless ||= Serverless.new self
|
278
|
-
end
|
279
|
-
|
280
|
-
##
|
281
|
-
# Access the Studio Gupshup Domain
|
282
|
-
def studio
|
283
|
-
@studio ||= Studio.new self
|
284
|
-
end
|
285
|
-
|
286
|
-
##
|
287
|
-
# Access the Sync Gupshup Domain
|
288
|
-
def sync
|
289
|
-
@sync ||= Sync.new self
|
290
|
-
end
|
291
|
-
|
292
|
-
##
|
293
|
-
# Access the Taskrouter Gupshup Domain
|
294
|
-
def taskrouter
|
295
|
-
@taskrouter ||= Taskrouter.new self
|
296
|
-
end
|
297
|
-
|
298
|
-
##
|
299
|
-
# Access the Trunking Gupshup Domain
|
300
|
-
def trunking
|
301
|
-
@trunking ||= Trunking.new self
|
302
|
-
end
|
303
|
-
|
304
|
-
##
|
305
|
-
# Access the Trusthub Gupshup Domain
|
306
|
-
def trusthub
|
307
|
-
@trusthub ||= Trusthub.new self
|
308
|
-
end
|
309
|
-
|
310
|
-
##
|
311
|
-
# Access the Verify Gupshup Domain
|
312
|
-
def verify
|
313
|
-
@verify ||= Verify.new self
|
314
|
-
end
|
315
|
-
|
316
|
-
##
|
317
|
-
# Access the Video Gupshup Domain
|
318
|
-
def video
|
319
|
-
@video ||= Video.new self
|
320
|
-
end
|
321
|
-
|
322
|
-
##
|
323
|
-
# Access the Voice Gupshup Domain
|
324
|
-
def voice
|
325
|
-
@voice ||= Voice.new self
|
326
|
-
end
|
327
|
-
|
328
|
-
##
|
329
|
-
# Access the Wireless Gupshup Domain
|
330
|
-
def wireless
|
331
|
-
@wireless ||= Wireless.new self
|
332
|
-
end
|
333
|
-
|
334
|
-
##
|
335
|
-
# Access the Supersim Gupshup Domain
|
336
|
-
def supersim
|
337
|
-
@supersim ||= Supersim.new self
|
338
|
-
end
|
339
|
-
|
340
|
-
##
|
341
|
-
# Access the Bulkexports Gupshup Domain
|
342
|
-
def bulkexports
|
343
|
-
@bulkexports ||= Bulkexports.new self
|
344
|
-
end
|
345
|
-
|
346
|
-
##
|
347
|
-
# Access the Microvisor Gupshup Domain
|
348
|
-
def microvisor
|
349
|
-
@microvisor ||= Microvisor.new self
|
350
|
-
end
|
351
|
-
|
352
|
-
##
|
353
|
-
# @param [String] sid The unique string that that we created to identify the
|
354
|
-
# Address resource.
|
355
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AddressInstance] if sid was passed.
|
356
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AddressList]
|
357
|
-
def addresses(sid=:unset)
|
358
|
-
self.api.v2010.account.addresses(sid)
|
359
|
-
end
|
360
|
-
|
361
|
-
##
|
362
|
-
# @param [String] sid The unique string that that we created to identify the
|
363
|
-
# Application resource.
|
364
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ApplicationInstance] if sid was passed.
|
365
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ApplicationList]
|
366
|
-
def applications(sid=:unset)
|
367
|
-
self.api.v2010.account.applications(sid)
|
368
|
-
end
|
369
|
-
|
370
|
-
##
|
371
|
-
# @param [String] connect_app_sid The SID that we assigned to the Connect App.
|
372
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AuthorizedConnectAppInstance] if connect_app_sid was passed.
|
373
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AuthorizedConnectAppList]
|
374
|
-
def authorized_connect_apps(connect_app_sid=:unset)
|
375
|
-
self.api.v2010.account.authorized_connect_apps(connect_app_sid)
|
376
|
-
end
|
377
|
-
|
378
|
-
##
|
379
|
-
# @param [String] country_code The
|
380
|
-
# {ISO-3166-1}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] country code of
|
381
|
-
# the country.
|
382
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryInstance] if country_code was passed.
|
383
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryList]
|
384
|
-
def available_phone_numbers(country_code=:unset)
|
385
|
-
self.api.v2010.account.available_phone_numbers(country_code)
|
386
|
-
end
|
387
|
-
|
388
|
-
##
|
389
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::BalanceInstance]
|
390
|
-
def balance
|
391
|
-
self.api.v2010.account.balance
|
392
|
-
end
|
393
|
-
|
394
|
-
##
|
395
|
-
# @param [String] sid The unique string that we created to identify this Call
|
396
|
-
# resource.
|
397
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::CallInstance] if sid was passed.
|
398
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::CallList]
|
399
|
-
def calls(sid=:unset)
|
400
|
-
self.api.v2010.account.calls(sid)
|
401
|
-
end
|
402
|
-
|
403
|
-
##
|
404
|
-
# @param [String] sid The unique string that that we created to identify this
|
405
|
-
# Conference resource.
|
406
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConferenceInstance] if sid was passed.
|
407
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConferenceList]
|
408
|
-
def conferences(sid=:unset)
|
409
|
-
self.api.v2010.account.conferences(sid)
|
410
|
-
end
|
411
|
-
|
412
|
-
##
|
413
|
-
# @param [String] sid The unique string that that we created to identify the
|
414
|
-
# ConnectApp resource.
|
415
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConnectAppInstance] if sid was passed.
|
416
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ConnectAppList]
|
417
|
-
def connect_apps(sid=:unset)
|
418
|
-
self.api.v2010.account.connect_apps(sid)
|
419
|
-
end
|
420
|
-
|
421
|
-
##
|
422
|
-
# @param [String] sid The unique string that that we created to identify this
|
423
|
-
# IncomingPhoneNumber resource.
|
424
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::IncomingPhoneNumberInstance] if sid was passed.
|
425
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::IncomingPhoneNumberList]
|
426
|
-
def incoming_phone_numbers(sid=:unset)
|
427
|
-
self.api.v2010.account.incoming_phone_numbers(sid)
|
428
|
-
end
|
429
|
-
|
430
|
-
##
|
431
|
-
# @param [String] sid The unique string that that we created to identify the Key
|
432
|
-
# resource.
|
433
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::KeyInstance] if sid was passed.
|
434
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::KeyList]
|
435
|
-
def keys(sid=:unset)
|
436
|
-
self.api.v2010.account.keys(sid)
|
437
|
-
end
|
438
|
-
|
439
|
-
##
|
440
|
-
# @param [String] sid The unique string that that we created to identify the
|
441
|
-
# Message resource.
|
442
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::MessageInstance] if sid was passed.
|
443
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::MessageList]
|
444
31
|
def messages(sid=:unset)
|
445
|
-
self.api.
|
32
|
+
self.api.v1.messages(sid)
|
446
33
|
end
|
447
|
-
|
448
|
-
##
|
449
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NewKeyInstance]
|
450
|
-
def new_keys
|
451
|
-
self.api.v2010.account.new_keys
|
452
|
-
end
|
453
|
-
|
454
|
-
##
|
455
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NewSigningKeyInstance]
|
456
|
-
def new_signing_keys
|
457
|
-
self.api.v2010.account.new_signing_keys
|
458
|
-
end
|
459
|
-
|
460
|
-
##
|
461
|
-
# @param [String] sid The unique string that that we created to identify the
|
462
|
-
# Notification resource.
|
463
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NotificationInstance] if sid was passed.
|
464
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::NotificationList]
|
465
|
-
def notifications(sid=:unset)
|
466
|
-
self.api.v2010.account.notifications(sid)
|
467
|
-
end
|
468
|
-
|
469
|
-
##
|
470
|
-
# @param [String] sid The unique string that that we created to identify the
|
471
|
-
# OutgoingCallerId resource.
|
472
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::OutgoingCallerIdInstance] if sid was passed.
|
473
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::OutgoingCallerIdList]
|
474
|
-
def outgoing_caller_ids(sid=:unset)
|
475
|
-
self.api.v2010.account.outgoing_caller_ids(sid)
|
476
|
-
end
|
477
|
-
|
478
|
-
##
|
479
|
-
# @param [String] sid The unique string that that we created to identify this
|
480
|
-
# Queue resource.
|
481
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::QueueInstance] if sid was passed.
|
482
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::QueueList]
|
483
|
-
def queues(sid=:unset)
|
484
|
-
self.api.v2010.account.queues(sid)
|
485
|
-
end
|
486
|
-
|
487
|
-
##
|
488
|
-
# @param [String] sid The unique string that that we created to identify the
|
489
|
-
# Recording resource.
|
490
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::RecordingInstance] if sid was passed.
|
491
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::RecordingList]
|
492
|
-
def recordings(sid=:unset)
|
493
|
-
self.api.v2010.account.recordings(sid)
|
494
|
-
end
|
495
|
-
|
496
|
-
##
|
497
|
-
# @param [String] sid The sid
|
498
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::SigningKeyInstance] if sid was passed.
|
499
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::SigningKeyList]
|
500
|
-
def signing_keys(sid=:unset)
|
501
|
-
self.api.v2010.account.signing_keys(sid)
|
502
|
-
end
|
503
|
-
|
504
|
-
##
|
505
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::SipInstance]
|
506
|
-
def sip
|
507
|
-
self.api.v2010.account.sip
|
508
|
-
end
|
509
|
-
|
510
|
-
##
|
511
|
-
# @param [String] sid The unique string that that we created to identify this
|
512
|
-
# ShortCode resource.
|
513
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ShortCodeInstance] if sid was passed.
|
514
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ShortCodeList]
|
515
|
-
def short_codes(sid=:unset)
|
516
|
-
self.api.v2010.account.short_codes(sid)
|
517
|
-
end
|
518
|
-
|
519
|
-
##
|
520
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::TokenInstance]
|
521
|
-
def tokens
|
522
|
-
self.api.v2010.account.tokens
|
523
|
-
end
|
524
|
-
|
525
|
-
##
|
526
|
-
# @param [String] sid The unique string that that we created to identify the
|
527
|
-
# Transcription resource.
|
528
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::TranscriptionInstance] if sid was passed.
|
529
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::TranscriptionList]
|
530
|
-
def transcriptions(sid=:unset)
|
531
|
-
self.api.v2010.account.transcriptions(sid)
|
532
|
-
end
|
533
|
-
|
534
|
-
##
|
535
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::UsageInstance]
|
536
|
-
def usage
|
537
|
-
self.api.v2010.account.usage
|
538
|
-
end
|
539
|
-
|
540
|
-
##
|
541
|
-
# @return [Gupshup::REST::Api::V2010::AccountContext::ValidationRequestInstance]
|
542
|
-
def validation_requests
|
543
|
-
self.api.v2010.account.validation_requests
|
544
|
-
end
|
545
|
-
|
546
34
|
##
|
547
35
|
# Provide a user friendly representation
|
548
36
|
def to_s
|
549
37
|
"#<Gupshup::REST::Client #{@src_name}>"
|
550
38
|
end
|
551
39
|
end
|
552
|
-
|
553
|
-
##
|
554
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
555
|
-
class BaseClient < ObsoleteClient; end
|
556
|
-
|
557
|
-
##
|
558
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
559
|
-
class IpMessagingClient < ObsoleteClient; end
|
560
|
-
|
561
|
-
##
|
562
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
563
|
-
class LookupsClient < ObsoleteClient; end
|
564
|
-
|
565
|
-
##
|
566
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
567
|
-
class MonitorClient < ObsoleteClient; end
|
568
|
-
|
569
|
-
##
|
570
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
571
|
-
class PricingClient < ObsoleteClient; end
|
572
|
-
|
573
|
-
##
|
574
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
575
|
-
class TaskRouterClient < ObsoleteClient; end
|
576
|
-
|
577
|
-
##
|
578
|
-
# Dummy client which provides no functionality. Please use Gupshup::REST::Client instead.
|
579
|
-
class TrunkingClient < ObsoleteClient; end
|
580
40
|
end
|
581
41
|
end
|
data/lib/gupshup-rb/version.rb
CHANGED
data/lib/gupshup-rb.rb
CHANGED
@@ -10,11 +10,7 @@ require 'time'
|
|
10
10
|
require 'json'
|
11
11
|
|
12
12
|
require 'gupshup-rb/version' unless defined?(Gupshup::VERSION)
|
13
|
-
# require 'rack/gupshup_webhook_authentication' if defined?(Rack) && defined?(Rack::MediaType)
|
14
|
-
|
15
|
-
# require 'gupshup-rb/util'
|
16
13
|
require 'gupshup-rb/util/configuration'
|
17
|
-
# require 'gupshup-rb/security/request_validator'
|
18
14
|
|
19
15
|
Dir[File.join(__dir__, 'gupshup-rb/framework/*.rb')].sort.each do |file|
|
20
16
|
require file
|
@@ -23,13 +19,10 @@ end
|
|
23
19
|
module Gupshup
|
24
20
|
extend SingleForwardable
|
25
21
|
|
26
|
-
autoload :JWT, File.join(__dir__, 'gupshup-rb', 'jwt', 'jwt.rb')
|
27
|
-
autoload :TwiML, File.join(__dir__, 'gupshup-rb', 'twiml', 'twiml.rb')
|
28
22
|
autoload :HTTP, File.join(__dir__, 'gupshup-rb', 'http.rb')
|
29
23
|
autoload :REST, File.join(__dir__, 'gupshup-rb', 'rest.rb')
|
30
24
|
|
31
25
|
def_delegators :configuration, :src_name, :api_key, :http_client, :region, :edge, :logger
|
32
|
-
|
33
26
|
##
|
34
27
|
# Pre-configure with account SID and auth token so that you don't need to
|
35
28
|
# pass them to various initializers each time.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gupshup-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimundo Martins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -194,16 +194,13 @@ executables:
|
|
194
194
|
- console
|
195
195
|
- setup
|
196
196
|
extensions: []
|
197
|
-
extra_rdoc_files:
|
198
|
-
- README.md
|
199
|
-
- LICENSE
|
197
|
+
extra_rdoc_files: []
|
200
198
|
files:
|
201
199
|
- ".gitignore"
|
202
200
|
- ".rubocop.yml"
|
203
201
|
- CHANGELOG.md
|
204
202
|
- CODE_OF_CONDUCT.md
|
205
203
|
- Gemfile
|
206
|
-
- LICENSE
|
207
204
|
- LICENSE.txt
|
208
205
|
- README.md
|
209
206
|
- Rakefile
|
@@ -243,22 +240,17 @@ homepage: https://github.com/raimartinsb/gupshup-rb
|
|
243
240
|
licenses:
|
244
241
|
- MIT
|
245
242
|
metadata:
|
246
|
-
|
243
|
+
homepage_uri: https://github.com/raimartinsb/gupshup-rb
|
244
|
+
source_code_uri: https://github.com/raimartinsb/gupshup-rb
|
247
245
|
post_install_message:
|
248
|
-
rdoc_options:
|
249
|
-
- "--line-numbers"
|
250
|
-
- "--inline-source"
|
251
|
-
- "--title"
|
252
|
-
- gupshup-rb
|
253
|
-
- "--main"
|
254
|
-
- README.md
|
246
|
+
rdoc_options: []
|
255
247
|
require_paths:
|
256
248
|
- lib
|
257
249
|
required_ruby_version: !ruby/object:Gem::Requirement
|
258
250
|
requirements:
|
259
251
|
- - ">="
|
260
252
|
- !ruby/object:Gem::Version
|
261
|
-
version: 2.
|
253
|
+
version: 2.6.0
|
262
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
255
|
requirements:
|
264
256
|
- - ">="
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (C) 2023
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
7
|
-
the Software without restriction, including without limitation the rights to
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
-
so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|