washbullet 0.3.0
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 +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +65 -0
- data/Rakefile +1 -0
- data/lib/washbullet/api/contacts.rb +13 -0
- data/lib/washbullet/api/devices.rb +13 -0
- data/lib/washbullet/api/me.rb +9 -0
- data/lib/washbullet/api/pushes.rb +71 -0
- data/lib/washbullet/api.rb +13 -0
- data/lib/washbullet/basic_authentication.rb +11 -0
- data/lib/washbullet/client.rb +52 -0
- data/lib/washbullet/http_exception.rb +29 -0
- data/lib/washbullet/parse_json.rb +13 -0
- data/lib/washbullet/request.rb +25 -0
- data/lib/washbullet/version.rb +3 -0
- data/lib/washbullet.rb +4 -0
- data/spec/fixtures/contacts.json +16 -0
- data/spec/fixtures/devices.json +19 -0
- data/spec/fixtures/push.json +18 -0
- data/spec/fixtures/pushes.json +24 -0
- data/spec/fixtures/upload_request.json +14 -0
- data/spec/fixtures/users.json +31 -0
- data/spec/spec_helper.rb +82 -0
- data/spec/washbullet/client_spec.rb +9 -0
- data/washbullet.gemspec +27 -0
- metadata +155 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4ea84b945d73747a9ab71da1f613e39fe015c761
|
|
4
|
+
data.tar.gz: db84dbc953bc67522362406b47f5a5f0a698200e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d3ac0e1c8a5ef8d20413d98ecab86fb555c2de676212445921208f3f3ce3eb3d5572f017e937f8774b006f97791f84ee9c749c3f0134fa8d69423c59f4092d8a
|
|
7
|
+
data.tar.gz: 4f8dff1c4e40fcfe0476213351ade9e0373425e8dea3a7a557ba592675144023dea91100c7d190fcf3a542680b6a1f1deb3209c23cb2179d7e223bf61c586398
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Hiroshi Yoshida
|
|
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,65 @@
|
|
|
1
|
+
# Washbullet
|
|
2
|
+
|
|
3
|
+
Ruby client of [Pushbullet](https://www.pushbullet.com/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ gem install washbullet
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
#### Setup Client
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
client = Washbullet::Client.new('YOUR_API_KEY')
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Push to own device
|
|
20
|
+
|
|
21
|
+
You can send following list:
|
|
22
|
+
- note
|
|
23
|
+
- link
|
|
24
|
+
- address
|
|
25
|
+
- list
|
|
26
|
+
- file
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
# Get own device list
|
|
30
|
+
client.devices
|
|
31
|
+
|
|
32
|
+
# note
|
|
33
|
+
client.push_note(device_iden, 'Title of note', 'A note\'s content')
|
|
34
|
+
|
|
35
|
+
# link
|
|
36
|
+
client.push_link(device_iden, 'Title of link', 'https://www.pushbullet.com', 'This website is awesome.')
|
|
37
|
+
|
|
38
|
+
# address
|
|
39
|
+
client.push_address(device_iden, 'Name of address', 'Addrss of place')
|
|
40
|
+
|
|
41
|
+
# list
|
|
42
|
+
client.push_list(device_iden, 'Title of lists', [{text: 'Buy milk', checked: true}, {text: 'Buy Soy milk', checked: false}])
|
|
43
|
+
|
|
44
|
+
# file
|
|
45
|
+
client.push_file(device_iden, 'File name', 'path/to/file', 'An optional message')
|
|
46
|
+
|
|
47
|
+
# Get friend list of Pushbullet
|
|
48
|
+
client.contacts
|
|
49
|
+
|
|
50
|
+
# Get self info
|
|
51
|
+
client.me
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## TODO
|
|
55
|
+
|
|
56
|
+
- push friend's device
|
|
57
|
+
- test...
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
1. Fork it ( http://github.com/hrysd/washbullet/fork )
|
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
65
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
module Washbullet
|
|
2
|
+
module API
|
|
3
|
+
module Pushes
|
|
4
|
+
def push_note(device_iden, title, body)
|
|
5
|
+
push :note, device_iden, title: title, body: body
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def push_link(device_iden, title, url, body)
|
|
9
|
+
push :link, device_iden, title: title, url: url, body: body
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def push_address(device_iden, name, address)
|
|
13
|
+
push :address, device_iden, name: name, address: address
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def push_list(device_iden, title, items)
|
|
17
|
+
push :list, device_iden, title: title, items: items
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def push_file(device_iden, file_name, file_path, body)
|
|
21
|
+
upload_file(file_name, file_path) do |data|
|
|
22
|
+
payload = {
|
|
23
|
+
file_name: data['file_name'],
|
|
24
|
+
file_type: data['file_type'],
|
|
25
|
+
file_url: data['file_url'],
|
|
26
|
+
body: body
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
push :file, device_iden, payload
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def pushes(modified_after = nil, cursor = nil)
|
|
34
|
+
params = {modified_after: modified_after, cursor: cursor}
|
|
35
|
+
|
|
36
|
+
params = params.values.all?(&:nil?) ? {} : params
|
|
37
|
+
|
|
38
|
+
get 'v2/pushes', params
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def delete_push(push_iden)
|
|
42
|
+
delete "/v2/pushes/#{push_iden}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def upload_file(file_name, file_path, &block)
|
|
48
|
+
mime_type = MIME::Types.type_for(file_path).first.to_s
|
|
49
|
+
|
|
50
|
+
data = upload_request(file_name, mime_type)
|
|
51
|
+
|
|
52
|
+
upload_url = data.body['upload_url']
|
|
53
|
+
payload = data.body['data']
|
|
54
|
+
|
|
55
|
+
io = Faraday::UploadIO.new(file_path, mime_type)
|
|
56
|
+
|
|
57
|
+
post upload_url, payload.merge(file: io)
|
|
58
|
+
|
|
59
|
+
yield data.body
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def upload_request(file_name, mime_type)
|
|
63
|
+
get '/v2/upload-request', file_name: file_name, file_type: mime_type
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def push(type, device_iden, payload)
|
|
67
|
+
post '/v2/pushes', payload.merge(device_iden: device_iden, type: type)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'faraday'
|
|
2
|
+
require 'mime/types'
|
|
3
|
+
|
|
4
|
+
require 'washbullet/api'
|
|
5
|
+
require 'washbullet/basic_authentication'
|
|
6
|
+
require 'washbullet/http_exception'
|
|
7
|
+
require 'washbullet/parse_json'
|
|
8
|
+
require 'washbullet/request'
|
|
9
|
+
|
|
10
|
+
module Washbullet
|
|
11
|
+
class Client
|
|
12
|
+
include Request
|
|
13
|
+
include API
|
|
14
|
+
|
|
15
|
+
ENDPOINT = 'https://api.pushbullet.com'
|
|
16
|
+
|
|
17
|
+
attr_reader :api_key
|
|
18
|
+
|
|
19
|
+
def initialize(api_key)
|
|
20
|
+
@api_key = api_key
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def middleware
|
|
24
|
+
@middleware ||= Faraday::RackBuilder.new do |f|
|
|
25
|
+
f.request :multipart
|
|
26
|
+
f.request :url_encoded
|
|
27
|
+
|
|
28
|
+
f.use Washbullet::BasicAuthentication, @api_key, ''
|
|
29
|
+
f.use Washbullet::ParseJSON
|
|
30
|
+
f.use Washbullet::HttpException
|
|
31
|
+
|
|
32
|
+
f.adapter :net_http
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def connection_options
|
|
37
|
+
@connection_options ||= {
|
|
38
|
+
:builder => middleware,
|
|
39
|
+
:headers => {
|
|
40
|
+
:accept => 'application/json',
|
|
41
|
+
:user_agent => "Washbullet Ruby Gem #{Washbullet::VERSION}",
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def connection
|
|
49
|
+
@connection ||= Faraday.new(ENDPOINT, connection_options)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Washbullet
|
|
2
|
+
class BadRequest < StandardError; end
|
|
3
|
+
class Unauthorized < StandardError; end
|
|
4
|
+
class RequestFailed < StandardError; end
|
|
5
|
+
class Forbidden < StandardError; end
|
|
6
|
+
class NotFound < StandardError; end
|
|
7
|
+
class ServerError < StandardError; end
|
|
8
|
+
|
|
9
|
+
class HttpException < Faraday::Response::Middleware
|
|
10
|
+
def call(env)
|
|
11
|
+
@app.call(env).on_complete do |response|
|
|
12
|
+
case response[:status].to_i
|
|
13
|
+
when 400
|
|
14
|
+
raise Washbullet::BadRequest, 'Often missing a required parameter'
|
|
15
|
+
when 401
|
|
16
|
+
raise Washbullet::Unauthorized, 'No valid API key provided'
|
|
17
|
+
when 402
|
|
18
|
+
raise Washbullet::RequestFailed, 'Parameters were valid but the request failed'
|
|
19
|
+
when 403
|
|
20
|
+
raise Washbullet::Forbidden, 'The API key is not valid for that request'
|
|
21
|
+
when 404
|
|
22
|
+
raise Washbullet::NotFound, 'The requested item doesn\'t exist'
|
|
23
|
+
when 500..505
|
|
24
|
+
raise Washbullet::ServerError, 'Something went wrong on PushBullet\'s side'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
module Washbullet
|
|
4
|
+
class ParseJSON < Faraday::Response::Middleware
|
|
5
|
+
def on_complete(env)
|
|
6
|
+
env[:body] = JSON.parse(env[:body]) unless unparsable_status_codes.include?(env.status)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def unparsable_status_codes
|
|
10
|
+
[204]
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Washbullet
|
|
2
|
+
module Request
|
|
3
|
+
def get(path, params = {})
|
|
4
|
+
request(:get, path, params)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def post(path, payload)
|
|
8
|
+
request(:post, path, payload)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def delete(path)
|
|
12
|
+
request(:delete, path)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def request(method, path, params = {})
|
|
18
|
+
response = connection.send(method) {|request|
|
|
19
|
+
request.url path
|
|
20
|
+
request.params = params if method == :get
|
|
21
|
+
request.body = params if method == :post
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/washbullet.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contacts":[
|
|
3
|
+
{
|
|
4
|
+
"iden": "ubdcjAfszs0Smi",
|
|
5
|
+
"status": "user",
|
|
6
|
+
"name": "Ryan Oldenburg",
|
|
7
|
+
"created": 1399011660.4298899,
|
|
8
|
+
"modified": 1399011660.42976,
|
|
9
|
+
"id": 5695496404336640,
|
|
10
|
+
"source": "user",
|
|
11
|
+
"email": "ryanjoldenburg@gmail.com"
|
|
12
|
+
"email_normalized": "ryanjoldenburg@gmail.com",
|
|
13
|
+
"active": true
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"devices":[
|
|
3
|
+
{
|
|
4
|
+
"iden":"u1qSJddxeKwOGuGW",
|
|
5
|
+
"push_token":"u1qSJddxeKwOGuGWu1qSJddxeKwOGuGWu1qSJddxeKwOGuGWu1qSJddxeK",
|
|
6
|
+
"app_version":74,
|
|
7
|
+
"android_sdk_version":"19",
|
|
8
|
+
"fingerprint":"",
|
|
9
|
+
"active":true,
|
|
10
|
+
"nickname":"Galaxy S4",
|
|
11
|
+
"manufacturer":"samsung",
|
|
12
|
+
"kind":"android",
|
|
13
|
+
"created":1394748080.0139201,
|
|
14
|
+
"modified":1399008037.8487799,
|
|
15
|
+
"android_version":"4.4.2",
|
|
16
|
+
"model":"SCH-I545"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"iden":"ubdpjxxxOK0sKG",
|
|
3
|
+
"type":"note",
|
|
4
|
+
"title":"Note title",
|
|
5
|
+
"body":"Note body",
|
|
6
|
+
"created":1399253701.9746201,
|
|
7
|
+
"modified":1399253701.9744401,
|
|
8
|
+
"active":true,
|
|
9
|
+
"dismissed":false,
|
|
10
|
+
"owner_iden":"ubd",
|
|
11
|
+
"target_device_iden":"ubddjAy95rgBxc",
|
|
12
|
+
"sender_iden":"ubd",
|
|
13
|
+
"sender_email":"ryan@pushbullet.com"
|
|
14
|
+
"sender_email_normalized":"ryan@pushbullet.com",
|
|
15
|
+
"receiver_iden":"ubd",
|
|
16
|
+
"receiver_email":"ryan@pushbullet.com",
|
|
17
|
+
"receiver_email_normalized":"ryan@pushbullet.com"
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pushes": [
|
|
3
|
+
{
|
|
4
|
+
"iden": "ubdpjAkaGXvUl2",
|
|
5
|
+
"type": "link",
|
|
6
|
+
"active": true,
|
|
7
|
+
"dismissed": false,
|
|
8
|
+
"created": 1.39934925E9,
|
|
9
|
+
"modified": 1.39934925E9,
|
|
10
|
+
"title": "Pushbullet",
|
|
11
|
+
"body": "Documenting our API",
|
|
12
|
+
"url": "http://docs.pushbullet.com",
|
|
13
|
+
"owner_iden": "ubd",
|
|
14
|
+
"target_device_iden": "ubddjAy95rgBxc",
|
|
15
|
+
"sender_iden": "ubd",
|
|
16
|
+
"sender_email": "ryan@pushbullet.com"
|
|
17
|
+
"sender_email_normalized": "ryan@pushbullet.com",
|
|
18
|
+
"receiver_iden": "ubd",
|
|
19
|
+
"receiver_email": "ryan@pushbullet.com",
|
|
20
|
+
"receiver_email_normalized": "ryan@pushbullet.com",
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"cursor": null
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"file_type":"image/png",
|
|
3
|
+
"file_name":"image.png",
|
|
4
|
+
"file_url":"https://s3.amazonaws.com/pushbullet-uploads/ubd-VWb1dP5XrZzvHReWHCycIwPyuAMp2R9I/image.png",
|
|
5
|
+
"upload_url":"https://s3.amazonaws.com/pushbullet-uploads",
|
|
6
|
+
"data":{
|
|
7
|
+
"awsaccesskeyid":"AKIAJJIUQPUDGPM4GD3W",
|
|
8
|
+
"acl":"public-read",
|
|
9
|
+
"key":"ubd-CWb1dP5XrZzvHReWHCycIwPyuAMp2R9I/image.png",
|
|
10
|
+
"signature":"UX5s1uIy1ov6+xlj58JY7rGFKcs=",
|
|
11
|
+
"policy":"eyKjb25kaXRpb25zIjogW3siYnVja2V0IjogInB1c2hidWxsZXQtdXBsb2FkcyJ9LCB7ImtleSI6ICJ1YmQtVldiMWRQNVhyWnp2SFJlV0hDeWNJd1B5dUFNcDJSOUkvaW1hZ2UucG5nIn0sIHsiYWNsIjogInB1YmxpYy1yZWFkIn0sIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAxLCAyNjIxNDQwMF0sIFsiZXEiLCAiJENvbnRlbnQtVHlwZSIsICJpbWFnZS9wbmciXV0sICJleHBpcmF0aW9uIjogIjIwMTQtMDUtMDVUMjI6NTE6MzcuMjM0MTMwWiJ9",
|
|
12
|
+
"content-type":"image/png"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"iden": "ubd",
|
|
3
|
+
"api_key": "",
|
|
4
|
+
"email": "",
|
|
5
|
+
"email_normalized": "",
|
|
6
|
+
"admin": true,
|
|
7
|
+
"created": 1357941753.8287899,
|
|
8
|
+
"modified": 1399325992.1842301,
|
|
9
|
+
"google_id": "110038027176632715601",
|
|
10
|
+
"google_userinfo": {
|
|
11
|
+
"family_name": "Oldenburg",
|
|
12
|
+
"name": "Ryan Oldenburg",
|
|
13
|
+
"picture": "",
|
|
14
|
+
"locale": "en",
|
|
15
|
+
"gender": "male",
|
|
16
|
+
"email": "",
|
|
17
|
+
"link": "",
|
|
18
|
+
"given_name": "Ryan",
|
|
19
|
+
"id": "110038027176632715601",
|
|
20
|
+
"hd": "",
|
|
21
|
+
"verified_email": true
|
|
22
|
+
},
|
|
23
|
+
"preferences": {
|
|
24
|
+
"onboarding": {
|
|
25
|
+
"app": false,
|
|
26
|
+
"friends": false,
|
|
27
|
+
"extension": false
|
|
28
|
+
},
|
|
29
|
+
"social": false
|
|
30
|
+
}
|
|
31
|
+
}
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
|
5
|
+
#
|
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
8
|
+
# (such as loading up an entire rails app) will add to the boot time of your
|
|
9
|
+
# test suite on EVERY test run, even for an individual file that may not need
|
|
10
|
+
# all of that loaded.
|
|
11
|
+
#
|
|
12
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
13
|
+
# users commonly want.
|
|
14
|
+
#
|
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
16
|
+
RSpec.configure do |config|
|
|
17
|
+
# The settings below are suggested to provide a good initial experience
|
|
18
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
19
|
+
=begin
|
|
20
|
+
# These two settings work together to allow you to limit a spec run
|
|
21
|
+
# to individual examples or groups you care about by tagging them with
|
|
22
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
23
|
+
# get run.
|
|
24
|
+
config.filter_run :focus
|
|
25
|
+
config.run_all_when_everything_filtered = true
|
|
26
|
+
|
|
27
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
28
|
+
# file, and it's useful to allow more verbose output when running an
|
|
29
|
+
# individual spec file.
|
|
30
|
+
if config.files_to_run.one?
|
|
31
|
+
# RSpec filters the backtrace by default so as not to be so noisy.
|
|
32
|
+
# This causes the full backtrace to be printed when running a single
|
|
33
|
+
# spec file (e.g. to troubleshoot a particular spec failure).
|
|
34
|
+
config.full_backtrace = true
|
|
35
|
+
|
|
36
|
+
# Use the documentation formatter for detailed output,
|
|
37
|
+
# unless a formatter has already been configured
|
|
38
|
+
# (e.g. via a command-line flag).
|
|
39
|
+
config.formatter = 'doc' if config.formatters.none?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Print the 10 slowest examples and example groups at the
|
|
43
|
+
# end of the spec run, to help surface which specs are running
|
|
44
|
+
# particularly slow.
|
|
45
|
+
config.profile_examples = 10
|
|
46
|
+
|
|
47
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
48
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
49
|
+
# the seed, which is printed after each run.
|
|
50
|
+
# --seed 1234
|
|
51
|
+
config.order = :random
|
|
52
|
+
|
|
53
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
54
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
55
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
56
|
+
# as the one that triggered the failure.
|
|
57
|
+
Kernel.srand config.seed
|
|
58
|
+
|
|
59
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
60
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
61
|
+
# assertions if you prefer.
|
|
62
|
+
config.expect_with :rspec do |expectations|
|
|
63
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
|
64
|
+
# For more details, see:
|
|
65
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
66
|
+
expectations.syntax = :expect
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
70
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
71
|
+
config.mock_with :rspec do |mocks|
|
|
72
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
|
73
|
+
# For more details, see:
|
|
74
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
75
|
+
mocks.syntax = :expect
|
|
76
|
+
|
|
77
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
78
|
+
# a real object. This is generally recommended.
|
|
79
|
+
mocks.verify_partial_doubles = true
|
|
80
|
+
end
|
|
81
|
+
=end
|
|
82
|
+
end
|
data/washbullet.gemspec
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'washbullet/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.name = 'washbullet'
|
|
7
|
+
gem.version = Washbullet::VERSION
|
|
8
|
+
gem.authors = ['Hiroshi Yoshida']
|
|
9
|
+
gem.email = ['hrysd22@gmail.com']
|
|
10
|
+
gem.summary = %q{Ruby client of Pushbullet API.}
|
|
11
|
+
gem.description = %q{Ruby client of Pushbullet API.}
|
|
12
|
+
gem.homepage = 'https://github.com/hrysd/washbullet'
|
|
13
|
+
gem.license = 'MIT'
|
|
14
|
+
|
|
15
|
+
gem.files = `git ls-files`.split($/)
|
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|gem|features)/})
|
|
18
|
+
gem.require_paths = ['lib']
|
|
19
|
+
|
|
20
|
+
gem.add_development_dependency 'bundler'
|
|
21
|
+
gem.add_development_dependency 'pry'
|
|
22
|
+
gem.add_development_dependency 'rake'
|
|
23
|
+
gem.add_development_dependency 'rspec', '~> 3.0.0.beta2'
|
|
24
|
+
|
|
25
|
+
gem.add_dependency 'faraday'
|
|
26
|
+
gem.add_dependency 'mime-types'
|
|
27
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: washbullet
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.3.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Hiroshi Yoshida
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-05-18 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: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pry
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ~>
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 3.0.0.beta2
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ~>
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 3.0.0.beta2
|
|
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'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - '>='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: mime-types
|
|
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
|
+
description: Ruby client of Pushbullet API.
|
|
98
|
+
email:
|
|
99
|
+
- hrysd22@gmail.com
|
|
100
|
+
executables: []
|
|
101
|
+
extensions: []
|
|
102
|
+
extra_rdoc_files: []
|
|
103
|
+
files:
|
|
104
|
+
- .gitignore
|
|
105
|
+
- .rspec
|
|
106
|
+
- Gemfile
|
|
107
|
+
- LICENSE.txt
|
|
108
|
+
- README.md
|
|
109
|
+
- Rakefile
|
|
110
|
+
- lib/washbullet.rb
|
|
111
|
+
- lib/washbullet/api.rb
|
|
112
|
+
- lib/washbullet/api/contacts.rb
|
|
113
|
+
- lib/washbullet/api/devices.rb
|
|
114
|
+
- lib/washbullet/api/me.rb
|
|
115
|
+
- lib/washbullet/api/pushes.rb
|
|
116
|
+
- lib/washbullet/basic_authentication.rb
|
|
117
|
+
- lib/washbullet/client.rb
|
|
118
|
+
- lib/washbullet/http_exception.rb
|
|
119
|
+
- lib/washbullet/parse_json.rb
|
|
120
|
+
- lib/washbullet/request.rb
|
|
121
|
+
- lib/washbullet/version.rb
|
|
122
|
+
- spec/fixtures/contacts.json
|
|
123
|
+
- spec/fixtures/devices.json
|
|
124
|
+
- spec/fixtures/push.json
|
|
125
|
+
- spec/fixtures/pushes.json
|
|
126
|
+
- spec/fixtures/upload_request.json
|
|
127
|
+
- spec/fixtures/users.json
|
|
128
|
+
- spec/spec_helper.rb
|
|
129
|
+
- spec/washbullet/client_spec.rb
|
|
130
|
+
- washbullet.gemspec
|
|
131
|
+
homepage: https://github.com/hrysd/washbullet
|
|
132
|
+
licenses:
|
|
133
|
+
- MIT
|
|
134
|
+
metadata: {}
|
|
135
|
+
post_install_message:
|
|
136
|
+
rdoc_options: []
|
|
137
|
+
require_paths:
|
|
138
|
+
- lib
|
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - '>='
|
|
142
|
+
- !ruby/object:Gem::Version
|
|
143
|
+
version: '0'
|
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
|
+
requirements:
|
|
146
|
+
- - '>='
|
|
147
|
+
- !ruby/object:Gem::Version
|
|
148
|
+
version: '0'
|
|
149
|
+
requirements: []
|
|
150
|
+
rubyforge_project:
|
|
151
|
+
rubygems_version: 2.0.3
|
|
152
|
+
signing_key:
|
|
153
|
+
specification_version: 4
|
|
154
|
+
summary: Ruby client of Pushbullet API.
|
|
155
|
+
test_files: []
|