bleepy 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/lib/bleepy/client/messages.rb +28 -0
- data/lib/bleepy/client.rb +17 -0
- data/lib/bleepy/request.rb +49 -0
- data/lib/bleepy/version.rb +3 -0
- data/lib/bleepy.rb +27 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82881bff4b8474e1d4843473b248993418c7392b
|
4
|
+
data.tar.gz: 4a80369267a5a2e5da8a700aeeeb59193b262104
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2da3cfb662e6da4e3a6771682dc5ced8a9cf808b364c994406d79af4fe42d6c840264c71584d7c4898b7c2787e833112db1fc04f3fc59a227b0869b7271d495
|
7
|
+
data.tar.gz: 8e3d6ddeae323cca5971aa466d2cec72340c08ea42562a86d41b08bef3cbe185277bb2f4e350dda96ea7a425c0e8ecaec24f20726b3743342c87b0574e068382
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 rodmachado
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Bleepy
|
2
|
+
|
3
|
+
Bleepy is a ruby client for take.net API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'bleepy'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install bleepy
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
For Rails applications add bleepy.rb configuration file to config/initializers
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
|
27
|
+
Bleepy.configure do |config|
|
28
|
+
config.consumer_key = 'consumer_key'
|
29
|
+
config.consumer_secret = 'consumer_secret'
|
30
|
+
config.token_key = 'token_key'
|
31
|
+
config.token_secret = 'token_secret'
|
32
|
+
config.callback_url = 'http://app_url/controller'
|
33
|
+
end
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it ( https://github.com/raisesistemas/bleepy/fork )
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Bleepy
|
2
|
+
class Client
|
3
|
+
|
4
|
+
module Messages
|
5
|
+
def messages
|
6
|
+
get('messages')
|
7
|
+
end
|
8
|
+
|
9
|
+
def send_message(options = {})
|
10
|
+
post('messages', body(options))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def body(options)
|
16
|
+
{
|
17
|
+
'entry' => {
|
18
|
+
'recipients' => [{'value' => "tel:+55#{options.fetch(:recipient)}"}],
|
19
|
+
'body' => options.fetch(:body),
|
20
|
+
'type' => 'sms',
|
21
|
+
'ackUri' => Bleepy.callback_url
|
22
|
+
}
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'bleepy/client/messages'
|
3
|
+
|
4
|
+
module Bleepy
|
5
|
+
class Client
|
6
|
+
|
7
|
+
include Bleepy::Client::Messages
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@request = Bleepy::Request.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def_delegators :@request, :get, :post
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Bleepy
|
2
|
+
class Request
|
3
|
+
|
4
|
+
BASE_URL = 'http://api.take.io/rest/1.0/'
|
5
|
+
|
6
|
+
def get(url)
|
7
|
+
connection.get do |request|
|
8
|
+
request.url url
|
9
|
+
request.headers = headers
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def post(url, body)
|
14
|
+
connection.post do |request|
|
15
|
+
request.url url
|
16
|
+
request.headers = headers
|
17
|
+
request.body = body
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def connection
|
24
|
+
Faraday.new BASE_URL do |conn|
|
25
|
+
conn.request :oauth, oauth_params
|
26
|
+
conn.request :json
|
27
|
+
conn.response :json, content_type: /\bjson$/
|
28
|
+
conn.adapter Faraday.default_adapter
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def headers
|
33
|
+
{
|
34
|
+
'User-Agent' => "Bleepy-#{Bleepy::VERSION}",
|
35
|
+
'Content-Type' => 'application/json'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def oauth_params
|
40
|
+
{
|
41
|
+
consumer_key: Bleepy.consumer_key,
|
42
|
+
consumer_secret: Bleepy.consumer_secret,
|
43
|
+
token: Bleepy.token_key,
|
44
|
+
token_secret: Bleepy.token_secret
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/bleepy.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'simple_oauth'
|
4
|
+
|
5
|
+
module Bleepy
|
6
|
+
class << self
|
7
|
+
|
8
|
+
attr_accessor(
|
9
|
+
:consumer_key,
|
10
|
+
:consumer_secret,
|
11
|
+
:token_key,
|
12
|
+
:token_secret,
|
13
|
+
:callback_url
|
14
|
+
)
|
15
|
+
|
16
|
+
def configure
|
17
|
+
yield self
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
autoload :Client, 'bleepy/client'
|
24
|
+
autoload :Request, 'bleepy/request'
|
25
|
+
autoload :Version, 'bleepy/version'
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bleepy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rodrigo Machado
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.21.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.21.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.9.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday_middleware
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simple_oauth
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Bleeply is a ruby interface for the take.net RESTFUL API.
|
112
|
+
email:
|
113
|
+
- rodmac98@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- LICENSE.txt
|
119
|
+
- README.md
|
120
|
+
- lib/bleepy.rb
|
121
|
+
- lib/bleepy/client.rb
|
122
|
+
- lib/bleepy/client/messages.rb
|
123
|
+
- lib/bleepy/request.rb
|
124
|
+
- lib/bleepy/version.rb
|
125
|
+
homepage: ''
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.4.5
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Ruby interface for the take.net API.
|
149
|
+
test_files: []
|