whatsapp_sdk 0.5.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +6 -6
- data/README.md +8 -4
- data/example.rb +7 -9
- data/lib/whatsapp_sdk/api/response.rb +4 -0
- data/lib/whatsapp_sdk/version.rb +1 -3
- data/whatsapp_sdk.gemspec +4 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d70f3c946148d4935fa447fae876defaea2a086f944ff94b3838c306c925752
|
4
|
+
data.tar.gz: afd71dd8d1fc23fd4000ed7263f868724db24a120c247c8e5a1ac1dc41a86d56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aed5dd70fb476006f5d0d68089549eb646fddb761b1521e16b65ded7b4d1150354618d0bb6fd63f45478236af5369bdb4c9fe9ac512ab6bd957c1dc6d667b7a4
|
7
|
+
data.tar.gz: de335d17ff40f47625a99636923b0053718ebca4d21c0dc24066a87570bb30385ec7f2dd3d8aa0c69c4c2afa0c6068bd7fb5b17f80a17df69de5ac77553ae906
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# v 0.6.1
|
2
|
+
Add raw_response to response [#47](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/46)
|
3
|
+
|
4
|
+
# v 0.6.0
|
5
|
+
Fix issue on Linux when files are not sorted [#45](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/45)
|
6
|
+
|
1
7
|
# v 0.5.1
|
2
8
|
Remove warnings [#41](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/41)
|
3
9
|
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
whatsapp_sdk (0.
|
5
|
-
faraday (
|
4
|
+
whatsapp_sdk (0.6.1)
|
5
|
+
faraday (>= 2.3.0)
|
6
6
|
faraday-multipart (~> 1.0.4)
|
7
7
|
oj (~> 3.13.13)
|
8
8
|
sorbet
|
@@ -15,12 +15,12 @@ GEM
|
|
15
15
|
ast (2.4.2)
|
16
16
|
coderay (1.1.3)
|
17
17
|
diff-lcs (1.5.0)
|
18
|
-
faraday (2.
|
19
|
-
faraday-net_http (
|
18
|
+
faraday (2.5.2)
|
19
|
+
faraday-net_http (>= 2.0, < 3.1)
|
20
20
|
ruby2_keywords (>= 0.0.4)
|
21
21
|
faraday-multipart (1.0.4)
|
22
22
|
multipart-post (~> 2)
|
23
|
-
faraday-net_http (
|
23
|
+
faraday-net_http (3.0.0)
|
24
24
|
method_source (1.0.0)
|
25
25
|
minitest (5.16.1)
|
26
26
|
mocha (1.14.0)
|
@@ -120,4 +120,4 @@ DEPENDENCIES
|
|
120
120
|
zeitwerk (>= 2.6.0)
|
121
121
|
|
122
122
|
BUNDLED WITH
|
123
|
-
2.3.
|
123
|
+
2.3.22
|
data/README.md
CHANGED
@@ -324,21 +324,25 @@ Visit [the example file](/example.rb) with examples to call the API in a single
|
|
324
324
|
- Ensure your Meta App uses an API version greater than or equal to `v.14`.
|
325
325
|
- Ensure that the Panel in the Facebook dashboard doesn't display any error.
|
326
326
|
|
327
|
+
Note: Sometimes the messages are delayed, see [Meta documentation](https://developers.facebook.com/docs/whatsapp/on-premises/guides/send-message-performance#delays).
|
328
|
+
|
327
329
|
## Development
|
328
330
|
|
329
331
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
330
332
|
|
331
333
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
332
334
|
|
333
|
-
## Contributing
|
334
|
-
|
335
|
-
Bug reports and pull requests are welcome on GitHub at [https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk) This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
336
|
-
|
337
335
|
### Run all the tests
|
338
336
|
- **Unit tests:** Run `rake test`
|
339
337
|
- **Sorbet Typecheck:** run `srb tc`
|
340
338
|
- **Linters:** `bundle exec rubocop`
|
341
339
|
|
340
|
+
## Contributing
|
341
|
+
|
342
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk) This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
343
|
+
|
344
|
+
If you want a feature to be implemented in the gem, please, open an issue and we will take a look as soon as we can.
|
345
|
+
|
342
346
|
## License
|
343
347
|
|
344
348
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/example.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
# 1) Copy this code into a file and save it `example.rb`
|
@@ -12,7 +11,7 @@ gemfile(true) do
|
|
12
11
|
|
13
12
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
14
13
|
|
15
|
-
gem "whatsapp_sdk"
|
14
|
+
gem "whatsapp_sdk"
|
16
15
|
gem "pry"
|
17
16
|
gem "pry-nav"
|
18
17
|
end
|
@@ -22,12 +21,12 @@ require "pry"
|
|
22
21
|
require "pry-nav"
|
23
22
|
|
24
23
|
################# UPDATE CONSTANTS #################
|
25
|
-
ACCESS_TOKEN = "EAAZAvvr0DZBs0BAHyg1bIPxEVV8dfI6woMaCxGNdjEEWYbZAkrMDuSqJcwXuIX10AmUW5TQLMEQCHM07dYzpGW5rTbZCZAoDt0aixPyZBB2nKFCTGhd3OnyZCZCzAxEdZBbZC4IY9uYkYbC9KCSLfOpAdgBU1dLGCTR2brwAvpWZAosgjXwgQZBLwrOSEpblsMVTGDkNaxAbi8zZBLijYRi6gsaSK" # replace this with a valid access_token # TODO replace
|
26
|
-
BUSINESS_ID = 102261539298487
|
27
|
-
SENDER_ID = 111591145018464
|
28
|
-
RECIPIENT_NUMBER = 13437772910
|
29
24
|
|
30
|
-
|
25
|
+
ACCESS_TOKEN = "<TODO replace>"
|
26
|
+
SENDER_ID = "<TODO replace>"
|
27
|
+
RECIPIENT_NUMBER = "<TODO replace>"
|
28
|
+
BUSINESS_ID = "<TODO replace>"
|
29
|
+
IMAGE_LINK = "<TODO replace>"
|
31
30
|
|
32
31
|
################# Initialize Client #################
|
33
32
|
WhatsappSdk.configure do |config|
|
@@ -47,7 +46,6 @@ end
|
|
47
46
|
medias_api = WhatsappSdk::Api::Medias.new
|
48
47
|
messages_api = WhatsappSdk::Api::Messages.new
|
49
48
|
phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new
|
50
|
-
binding.pry
|
51
49
|
|
52
50
|
############################## Phone Numbers API ##############################
|
53
51
|
registered_number = phone_numbers_api.registered_number(SENDER_ID)
|
@@ -90,7 +88,7 @@ print_message_sent(location_sent)
|
|
90
88
|
######### SEND AN IMAGE
|
91
89
|
# Send an image with a link
|
92
90
|
image_sent = messages_api.send_image(
|
93
|
-
sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: media.url, caption: "
|
91
|
+
sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: media.url, caption: "Ignacio Chiazzo Profile"
|
94
92
|
)
|
95
93
|
print_message_sent(image_sent)
|
96
94
|
|
@@ -18,6 +18,9 @@ module WhatsappSdk
|
|
18
18
|
sig { returns(T.nilable(WhatsappSdk::Api::Responses::DataResponse)) }
|
19
19
|
attr_accessor :data
|
20
20
|
|
21
|
+
sig { returns(T::Hash[T.untyped, T.untyped]) }
|
22
|
+
attr_accessor :raw_response
|
23
|
+
|
21
24
|
sig do
|
22
25
|
params(
|
23
26
|
response: T::Hash[T.untyped, T.untyped],
|
@@ -26,6 +29,7 @@ module WhatsappSdk
|
|
26
29
|
).void
|
27
30
|
end
|
28
31
|
def initialize(response:, data_class_type:, error_class_type: Responses::MessageErrorResponse)
|
32
|
+
@raw_response = response
|
29
33
|
@data = data_class_type.build_from_response(response: response)
|
30
34
|
@error = error_class_type.build_from_response(response: response)
|
31
35
|
end
|
data/lib/whatsapp_sdk/version.rb
CHANGED
data/whatsapp_sdk.gemspec
CHANGED
@@ -8,12 +8,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
8
8
|
|
9
9
|
Gem::Specification.new do |spec|
|
10
10
|
spec.name = "whatsapp_sdk"
|
11
|
-
spec.version = WhatsappSdk::
|
11
|
+
spec.version = WhatsappSdk::VERSION
|
12
12
|
spec.authors = ["ignacio-chiazzo"]
|
13
13
|
spec.email = ["ignaciochiazzo@gmail.com"]
|
14
|
-
spec.summary = "Use the Ruby Whatsapp SDK to
|
14
|
+
spec.summary = "Use the Ruby Whatsapp SDK to communicate with Whatsapp API using the Cloud API"
|
15
15
|
spec.description = <<-DESCRIPTION
|
16
|
-
Use the Ruby Whatsapp SDK to
|
16
|
+
Use the Ruby Whatsapp SDK to communicate with Whatsapp API using the Cloud API.
|
17
17
|
Create bots to send and receive messages using the Whatsapp SDK in a few minutes.
|
18
18
|
DESCRIPTION
|
19
19
|
spec.homepage = "https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk"
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_dependency('sorbet')
|
47
47
|
spec.add_dependency('sorbet-runtime')
|
48
48
|
|
49
|
-
spec.add_dependency("faraday", "
|
49
|
+
spec.add_dependency("faraday", ">= 2.3.0")
|
50
50
|
spec.add_dependency("faraday-multipart", "~> 1.0.4")
|
51
51
|
spec.add_dependency("oj", "~> 3.13.13")
|
52
52
|
spec.add_dependency("zeitwerk", "~> 2.6.0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatsapp_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ignacio-chiazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,14 +84,14 @@ dependencies:
|
|
84
84
|
name: faraday
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 2.3.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 2.3.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.6.0
|
139
139
|
description: |2
|
140
|
-
Use the Ruby Whatsapp SDK to
|
140
|
+
Use the Ruby Whatsapp SDK to communicate with Whatsapp API using the Cloud API.
|
141
141
|
Create bots to send and receive messages using the Whatsapp SDK in a few minutes.
|
142
142
|
email:
|
143
143
|
- ignaciochiazzo@gmail.com
|
@@ -243,9 +243,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
246
|
+
rubygems_version: 3.3.3
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
|
-
summary: Use the Ruby Whatsapp SDK to
|
249
|
+
summary: Use the Ruby Whatsapp SDK to communicate with Whatsapp API using the Cloud
|
250
250
|
API
|
251
251
|
test_files: []
|