whatsapp 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89b533451c7af42acf1d5a50f8a2c13b150757345e56c2ca34ac8a362469f285
4
- data.tar.gz: db56b832e65be757837b4811a70a3a8597ec6747e56cc43045253eef5f614464
3
+ metadata.gz: 808a27c8890c47345aa50e239ad975b1db47bb8f2d9d5a822eb87770ce84b14f
4
+ data.tar.gz: 6461f0d239a754e3206bcc1aff0b66dd4d4c2b4e31aaeb1b9073c7df88a8f06a
5
5
  SHA512:
6
- metadata.gz: be074ca0f5b6c90443654a9b5687aff3f351a38c6dea09e3d716d139f2652c040824b863da374b8c7b3f1c8dd160393682bf442ad626a7413802db6c20a43f03
7
- data.tar.gz: c3644ff4f4b94091a07d675dff8615c5cd9a16746af6ccc7b7ad13f975704bb29d05675778c0cb4935ac74793eba41dcac38ef032c376b820a37dda34c1aab68
6
+ metadata.gz: c015553c2ee4a9a81852da69835a2c2234a4b8dfd8a0e66f1f788a1220fe1056ee935e42444c28d5575c9dd784059c49b1aa6dcfeb23c3fd1e8181e569de4a5c
7
+ data.tar.gz: bea6121459e99f652650c5e3115524153269750c652fd51d5c5adf5786c6371d4443e23b6a8d3d1da00d1faacc8d5a02356a5becbaadaaf946c6f016b3168c76
@@ -15,9 +15,7 @@ module Whats
15
15
  body: payload.to_json
16
16
  )
17
17
 
18
- unless response.success?
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
@@ -6,9 +6,9 @@ module Whats
6
6
  attr_reader :response
7
7
 
8
8
  def initialize(message, response)
9
- @response = response
10
-
11
9
  super message
10
+
11
+ @response = response
12
12
  end
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Whats
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Dependencies
4
+ require "json"
4
5
  require "typhoeus"
5
6
 
6
7
  # Source
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.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: exe
10
+ bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-14 00:00:00.000000000 Z
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: webmock
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: typhoeus
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: :runtime
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: '0'
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
@@ -1,12 +0,0 @@
1
- *.gem
2
- /.bundle/
3
- /.yardoc
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in whatsapp.gemspec
6
- gemspec
@@ -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
@@ -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
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -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