whatsapp 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/whats/client.rb +1 -3
- data/lib/whats/errors/request_error.rb +2 -2
- data/lib/whats/version.rb +1 -1
- data/lib/whatsapp.rb +1 -0
- metadata +112 -24
- data/.gitignore +0 -12
- data/.travis.yml +0 -5
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -53
- data/LICENSE.txt +0 -21
- data/README.md +0 -69
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/whatsapp.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 808a27c8890c47345aa50e239ad975b1db47bb8f2d9d5a822eb87770ce84b14f
|
4
|
+
data.tar.gz: 6461f0d239a754e3206bcc1aff0b66dd4d4c2b4e31aaeb1b9073c7df88a8f06a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c015553c2ee4a9a81852da69835a2c2234a4b8dfd8a0e66f1f788a1220fe1056ee935e42444c28d5575c9dd784059c49b1aa6dcfeb23c3fd1e8181e569de4a5c
|
7
|
+
data.tar.gz: bea6121459e99f652650c5e3115524153269750c652fd51d5c5adf5786c6371d4443e23b6a8d3d1da00d1faacc8d5a02356a5becbaadaaf946c6f016b3168c76
|
data/lib/whats/client.rb
CHANGED
@@ -15,9 +15,7 @@ module Whats
|
|
15
15
|
body: payload.to_json
|
16
16
|
)
|
17
17
|
|
18
|
-
|
19
|
-
raise Whats::Errors::RequestError.new("API request error.", response)
|
20
|
-
end
|
18
|
+
raise Whats::Errors::RequestError.new("API request error.", response) if response.failure?
|
21
19
|
|
22
20
|
JSON.parse(response.response_body)
|
23
21
|
end
|
data/lib/whats/version.rb
CHANGED
data/lib/whatsapp.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatsapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Soares
|
8
8
|
- GetNinjas
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-03-
|
12
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: typhoeus
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.3'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.3'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: bundler
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,6 +39,34 @@ dependencies:
|
|
25
39
|
- - "~>"
|
26
40
|
- !ruby/object:Gem::Version
|
27
41
|
version: '1.16'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: codeclimate-test-reporter
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: pry-byebug
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.6'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.6'
|
28
70
|
- !ruby/object:Gem::Dependency
|
29
71
|
name: rake
|
30
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,33 +96,89 @@ dependencies:
|
|
54
96
|
- !ruby/object:Gem::Version
|
55
97
|
version: '3.0'
|
56
98
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
99
|
+
name: rubocop
|
58
100
|
requirement: !ruby/object:Gem::Requirement
|
59
101
|
requirements:
|
60
|
-
- - "
|
102
|
+
- - "~>"
|
61
103
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
104
|
+
version: '0.53'
|
63
105
|
type: :development
|
64
106
|
prerelease: false
|
65
107
|
version_requirements: !ruby/object:Gem::Requirement
|
66
108
|
requirements:
|
67
|
-
- - "
|
109
|
+
- - "~>"
|
68
110
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
111
|
+
version: '0.53'
|
70
112
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
113
|
+
name: rubocop-github
|
72
114
|
requirement: !ruby/object:Gem::Requirement
|
73
115
|
requirements:
|
74
|
-
- - "
|
116
|
+
- - "~>"
|
75
117
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :
|
118
|
+
version: '0.10'
|
119
|
+
type: :development
|
78
120
|
prerelease: false
|
79
121
|
version_requirements: !ruby/object:Gem::Requirement
|
80
122
|
requirements:
|
81
|
-
- - "
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.10'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop-rspec
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '1.24'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.24'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: simplecov
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.16'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0.16'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: simplecov-console
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0.4'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0.4'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: webmock
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - "~>"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '3.3'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
82
180
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
181
|
+
version: '3.3'
|
84
182
|
description: An interface to WhatsApp Enterprise API.
|
85
183
|
email:
|
86
184
|
- bruno@bsoares.com
|
@@ -89,15 +187,6 @@ executables: []
|
|
89
187
|
extensions: []
|
90
188
|
extra_rdoc_files: []
|
91
189
|
files:
|
92
|
-
- ".gitignore"
|
93
|
-
- ".travis.yml"
|
94
|
-
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
|
-
- LICENSE.txt
|
97
|
-
- README.md
|
98
|
-
- Rakefile
|
99
|
-
- bin/console
|
100
|
-
- bin/setup
|
101
190
|
- lib/whats/actions/check_contacts.rb
|
102
191
|
- lib/whats/actions/send_hsm_message.rb
|
103
192
|
- lib/whats/actions/send_message.rb
|
@@ -106,7 +195,6 @@ files:
|
|
106
195
|
- lib/whats/errors/request_error.rb
|
107
196
|
- lib/whats/version.rb
|
108
197
|
- lib/whatsapp.rb
|
109
|
-
- whatsapp.gemspec
|
110
198
|
homepage: https://github.com/getninjas/whatsapp
|
111
199
|
licenses:
|
112
200
|
- MIT
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
whatsapp (0.1.0)
|
5
|
-
typhoeus
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.5.2)
|
11
|
-
public_suffix (>= 2.0.2, < 4.0)
|
12
|
-
crack (0.4.3)
|
13
|
-
safe_yaml (~> 1.0.0)
|
14
|
-
diff-lcs (1.3)
|
15
|
-
ethon (0.11.0)
|
16
|
-
ffi (>= 1.3.0)
|
17
|
-
ffi (1.9.23)
|
18
|
-
hashdiff (0.3.7)
|
19
|
-
public_suffix (3.0.2)
|
20
|
-
rake (10.5.0)
|
21
|
-
rspec (3.7.0)
|
22
|
-
rspec-core (~> 3.7.0)
|
23
|
-
rspec-expectations (~> 3.7.0)
|
24
|
-
rspec-mocks (~> 3.7.0)
|
25
|
-
rspec-core (3.7.1)
|
26
|
-
rspec-support (~> 3.7.0)
|
27
|
-
rspec-expectations (3.7.0)
|
28
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.7.0)
|
30
|
-
rspec-mocks (3.7.0)
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.7.0)
|
33
|
-
rspec-support (3.7.1)
|
34
|
-
safe_yaml (1.0.4)
|
35
|
-
typhoeus (1.3.0)
|
36
|
-
ethon (>= 0.9.0)
|
37
|
-
webmock (3.3.0)
|
38
|
-
addressable (>= 2.3.6)
|
39
|
-
crack (>= 0.3.2)
|
40
|
-
hashdiff
|
41
|
-
|
42
|
-
PLATFORMS
|
43
|
-
ruby
|
44
|
-
|
45
|
-
DEPENDENCIES
|
46
|
-
bundler (~> 1.16)
|
47
|
-
rake (~> 10.0)
|
48
|
-
rspec (~> 3.0)
|
49
|
-
webmock
|
50
|
-
whatsapp!
|
51
|
-
|
52
|
-
BUNDLED WITH
|
53
|
-
1.16.1
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2018 Bruno Soares
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all 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
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# WhatsApp
|
2
|
-
|
3
|
-
An ruby interface to WhatsApp Enterprise API.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem "whatsapp"
|
11
|
-
```
|
12
|
-
|
13
|
-
## Usage
|
14
|
-
|
15
|
-
### Instantiation
|
16
|
-
|
17
|
-
Create an instance of the API client passing the base path of your endpoint:
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
whats = Whats::Api.new("https://my-whatsapp-endpoint.com")
|
21
|
-
```
|
22
|
-
|
23
|
-
### Check Contacts
|
24
|
-
|
25
|
-
Take a look [here](https://developers.facebook.com/docs/whatsapp/check-contacts) (WhatsApp Check Contacts doc) for more information.
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
whats.check_contacts(["+5511942424242"])
|
29
|
-
|
30
|
-
# output:
|
31
|
-
{
|
32
|
-
"meta" => {
|
33
|
-
"waent version" => "2.18.4"
|
34
|
-
},
|
35
|
-
"payload" => {
|
36
|
-
"results" => [
|
37
|
-
{
|
38
|
-
"input_number" => "+5511942424242",
|
39
|
-
"wa_exists" => true,
|
40
|
-
"wa_username" => "5511942424242"
|
41
|
-
}
|
42
|
-
],
|
43
|
-
"total" => 1
|
44
|
-
},
|
45
|
-
"error" => false
|
46
|
-
}
|
47
|
-
```
|
48
|
-
|
49
|
-
### Send Message
|
50
|
-
|
51
|
-
Take a look [here](https://developers.facebook.com/docs/whatsapp/send-api) (WhatsApp Send Message doc) for more information.
|
52
|
-
|
53
|
-
*The first parameter is the WhatsApp **username**!*
|
54
|
-
|
55
|
-
```ruby
|
56
|
-
whats.send_message("5511942424242", "Message goes here.")
|
57
|
-
|
58
|
-
# output:
|
59
|
-
|
60
|
-
{
|
61
|
-
"meta" => {
|
62
|
-
"waent version" => "2.18.4"
|
63
|
-
},
|
64
|
-
"payload" => {
|
65
|
-
"message_id" => "BAEC4D1D7549842627"
|
66
|
-
},
|
67
|
-
"error" => false
|
68
|
-
}
|
69
|
-
```
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "whatsapp"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/whatsapp.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
-
|
7
|
-
require "whats/version"
|
8
|
-
|
9
|
-
Gem::Specification.new do |spec|
|
10
|
-
spec.name = "whatsapp"
|
11
|
-
spec.version = Whats::VERSION
|
12
|
-
spec.authors = ["Bruno Soares", "GetNinjas"]
|
13
|
-
spec.email = ["bruno@bsoares.com", "tech@getninjas.com.br"]
|
14
|
-
|
15
|
-
spec.description = spec.summary = "An interface to WhatsApp Enterprise API."
|
16
|
-
spec.homepage = "https://github.com/getninjas/whatsapp"
|
17
|
-
spec.license = "MIT"
|
18
|
-
|
19
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
|
-
f.match(%r{^(test|spec|features)/})
|
21
|
-
end
|
22
|
-
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
-
spec.require_paths = ["lib"]
|
25
|
-
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
27
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
-
spec.add_development_dependency "webmock"
|
30
|
-
|
31
|
-
spec.add_dependency "typhoeus"
|
32
|
-
end
|