pushbullet 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,119 +1,126 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushbullet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - vajapravin
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-04-13 00:00:00.000000000 Z
12
+ date: 2014-05-23 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - '>='
18
20
  - !ruby/object:Gem::Version
19
- version: '1.5'
21
+ version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - '>='
25
28
  - !ruby/object:Gem::Version
26
- version: '1.5'
29
+ version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - "~>"
35
+ - - '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - "~>"
43
+ - - '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
- name: faraday
47
+ name: pry
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - "~>"
51
+ - - '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - "~>"
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: faraday
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '>='
53
76
  - !ruby/object:Gem::Version
54
77
  version: '0'
55
78
  - !ruby/object:Gem::Dependency
56
79
  name: mime-types
57
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
58
82
  requirements:
59
- - - "~>"
83
+ - - '>='
60
84
  - !ruby/object:Gem::Version
61
85
  version: '0'
62
- type: :development
86
+ type: :runtime
63
87
  prerelease: false
64
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
65
90
  requirements:
66
- - - "~>"
91
+ - - '>='
67
92
  - !ruby/object:Gem::Version
68
93
  version: '0'
69
- description: PushBullet's API enables developers to push to devices that have installed
70
- the PushBullet Android app. Authentication is provided by a user's API key, found
71
- in their Account Settings. By using an API key, users can allow third party software
72
- built on this API without needing to provide their Google account and password.
94
+ description: Ruby client of Pushbullet API.
73
95
  email:
74
96
  - vajapravin23@gmail.com
75
97
  executables: []
76
98
  extensions: []
77
99
  extra_rdoc_files: []
78
- files:
79
- - ".gitignore"
80
- - Gemfile
81
- - LICENSE.txt
82
- - README.md
83
- - Rakefile
84
- - lib/pushbullet.rb
85
- - lib/pushbullet/api.rb
86
- - lib/pushbullet/client.rb
87
- - lib/pushbullet/connection.rb
88
- - lib/pushbullet/http_exception.rb
89
- - lib/pushbullet/parse_json.rb
90
- - lib/pushbullet/request.rb
91
- - lib/pushbullet/secret_api.rb
92
- - lib/pushbullet/version.rb
93
- - pushbullet.gemspec
94
- homepage: https://github.com/vajapravin/pushbullet
100
+ files: []
101
+ homepage: http://vajapravin.com
95
102
  licenses:
96
103
  - MIT
97
- metadata: {}
98
104
  post_install_message:
99
105
  rdoc_options: []
100
106
  require_paths:
101
107
  - lib
102
108
  required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
103
110
  requirements:
104
- - - ">="
111
+ - - '>='
105
112
  - !ruby/object:Gem::Version
106
113
  version: '0'
107
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
108
116
  requirements:
109
- - - ">="
117
+ - - '>='
110
118
  - !ruby/object:Gem::Version
111
119
  version: '0'
112
120
  requirements: []
113
121
  rubyforge_project:
114
- rubygems_version: 2.2.2
122
+ rubygems_version: 1.8.25
115
123
  signing_key:
116
- specification_version: 4
117
- summary: PushBullet's API enables developers to push to devices that have installed
118
- the PushBullet Android app.
124
+ specification_version: 3
125
+ summary: Ruby client of Pushbullet API.
119
126
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: ca5dffc1d979f6492e41a045f313d5f4b207200f
4
- data.tar.gz: c5c6952bd980cbb7654a0bff3e9f31f4960cdcb9
5
- SHA512:
6
- metadata.gz: 2e09b88dcb69a6fbcf4123e7cbe870c722b511fa01111272391161a5e7ec7273d4271f927aec855d00f51e8b4947c28eb5d808c8d2b8298431b592d5f3d3f325
7
- data.tar.gz: 8d675ada929594ee2dc7a58c3a6a75bcbe30c9594ddf75d43d8e2868fc84fe359557455ce9996f4d20b96aad3ec9d1c9c3113f81efbe316b61d7b9ea5bda9145
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in pushbullet.gemspec
4
- gemspec
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Pravin Vaja
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 DELETED
@@ -1,68 +0,0 @@
1
- # Pushbullet
2
- PushBullet's API enables developers to push to devices that have installed the PushBullet Android app. Authentication is provided by a user's API key, found in their Account Settings. By using an API key, users can allow third party software built on this API without needing to provide their Google account and password.
3
-
4
- ## Installation
5
-
6
- Add this line to your application's Gemfile:
7
-
8
- gem 'pushbullet'
9
-
10
- And then execute:
11
-
12
- $ bundle
13
-
14
- Or install it yourself as:
15
-
16
- $ gem install pushbullet
17
-
18
- #### Setup Client
19
-
20
- copy following content and paste into config/initializers/pushbullet.rb
21
-
22
- PUSHBULLET_API_KEY = 'YOUR_PUSHBULLET_KEY_HERE'
23
-
24
- ## Usage
25
-
26
- client = Pushbullet::Client.new(PUSHBULLET_API_KEY)
27
-
28
- #### Push to own device
29
-
30
- You can send following list:
31
- - note
32
- - link
33
- - address
34
- - list
35
- - file
36
-
37
-
38
- ```ruby
39
- # get json about own device list
40
- client.devices
41
-
42
- client.push_note(DEVICE_ID, 'title', 'message')
43
- client.push_file(DEVICE_ID, 'File Name', 'path/to/file')
44
- ```
45
-
46
- #### Push to Friend's device
47
-
48
- You can send following list:
49
- - note
50
- - link
51
- - address
52
- - list
53
-
54
- ```ruby
55
- # get json about friend list of Pushbullet
56
- client.contacts
57
-
58
- client.push_note_to('a@b.c', 'title', 'full message')
59
- ```
60
- ## Contributing
61
-
62
- 1. Fork it ( http://github.com/vajapravin/pushbullet/fork )
63
- 2. Create your feature branch (`git checkout -b my-pushbullet`)
64
- 3. Commit your changes (`git commit -am 'Add some feature'`)
65
- 4. Push to the branch (`git push origin my-pushbullet`)
66
- 5. Create new Pull Request
67
-
68
- Don't hesitate to write problems [vajapravin23@gmail.com]
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,4 +0,0 @@
1
- require 'pushbullet/client.rb'
2
-
3
- module Pushbullet
4
- end
@@ -1,36 +0,0 @@
1
- module Pushbullet
2
- module API
3
- def devices
4
- get('/api/devices')
5
- end
6
-
7
- def push_note(device_id, title, body)
8
- push :note, device_id, title: title, body: body
9
- end
10
-
11
- def push_link(device_id, title, url)
12
- push :link, device_id, title: title, url: url
13
- end
14
-
15
- def push_address(device_id, title, address)
16
- push :address, device_id, title: title, address: address
17
- end
18
-
19
- def push_list(device_id, title, items)
20
- push :list, device_id, title: title, items: items
21
- end
22
-
23
- def push_file(device_id, file_path)
24
- mime_type = MIME::Types.type_for(file_path).first.to_s
25
- io = Faraday::UploadIO.new(file_path, mime_type)
26
-
27
- push :file, device_id, file: io
28
- end
29
-
30
- private
31
-
32
- def push(type, device_id, payload)
33
- post '/api/pushes', payload.merge(device_id: device_id, type: type)
34
- end
35
- end
36
- end
@@ -1,19 +0,0 @@
1
- require 'faraday'
2
- require 'mime/types'
3
- require 'pushbullet/request.rb'
4
- require 'pushbullet/api.rb'
5
- require 'pushbullet/secret_api.rb'
6
-
7
- module Pushbullet
8
- class Client
9
- include Request
10
- include API
11
- include SecretAPI
12
-
13
- attr_reader :api_key
14
-
15
- def initialize(api_key)
16
- @api_key = api_key
17
- end
18
- end
19
- end
@@ -1,22 +0,0 @@
1
- require 'pushbullet/http_exception.rb'
2
- require 'pushbullet/parse_json.rb'
3
-
4
- module Pushbullet
5
- module Connection
6
- private
7
- def connection
8
- @connection ||= Faraday.new(url: 'https://api.pushbullet.com/') do |f|
9
- f.request :basic_auth, api_key, ''
10
- f.request :multipart
11
- f.request :url_encoded
12
-
13
- f.response :logger
14
-
15
- f.use Pushbullet::ParseJSON
16
- f.use Pushbullet::HttpException
17
-
18
- f.adapter :net_http
19
- end
20
- end
21
- end
22
- end
@@ -1,31 +0,0 @@
1
- require 'faraday'
2
-
3
- module Pushbullet
4
- class BadRequest < StandardError; end
5
- class Unauthorized < StandardError; end
6
- class RequestFailed < StandardError; end
7
- class Forbidden < StandardError; end
8
- class NotFound < StandardError; end
9
- class ServerError < StandardError; end
10
-
11
- class HttpException < Faraday::Response::Middleware
12
- def call(env)
13
- @app.call(env).on_complete do |response|
14
- case response[:status].to_i
15
- when 400
16
- raise Pushbullet::BadRequest, 'Often missing a required parameter'
17
- when 401
18
- raise Pushbullet::Unauthorized, 'No valid API key provided'
19
- when 402
20
- raise Pushbullet::RequestFailed, 'Parameters were valid but the request failed'
21
- when 403
22
- raise Pushbullet::Forbidden, 'The API key is not valid for that request'
23
- when 404
24
- raise Pushbullet::NotFound, 'The requested item doesn\'t exist'
25
- when 500..505
26
- raise Pushbullet::ServerError, 'Something went wrong on PushBullet\'s side'
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,9 +0,0 @@
1
- require 'json'
2
-
3
- module Pushbullet
4
- class ParseJSON < Faraday::Response::Middleware
5
- def on_complete(env)
6
- env[:body] = JSON.parse(env[:body])
7
- end
8
- end
9
- end
@@ -1,24 +0,0 @@
1
- require 'pushbullet/connection.rb'
2
-
3
- module Pushbullet
4
- module Request
5
- include Connection
6
-
7
- def get(path)
8
- request(:get, path)
9
- end
10
-
11
- def post(path, payload)
12
- request(:post, path, payload)
13
- end
14
-
15
- private
16
-
17
- def request(method, path, payload = {})
18
- response = connection.send(method) {|request|
19
- request.url path
20
- request.body = payload if method == :post
21
- }
22
- end
23
- end
24
- end
@@ -1,30 +0,0 @@
1
- module Pushbullet
2
- module SecretAPI
3
- def contacts
4
- get('/v2/contacts')
5
- end
6
-
7
- def push_note_to(target_email, title, body)
8
- push_to :note, target_email, title: title, body: body
9
- end
10
-
11
- def push_link_to(target_email, title, url)
12
- push_to :link, target_email, title: title, url: url
13
- end
14
-
15
- def push_address_to(target_email, title, address)
16
- push_to :address, target_email, title: title, address: address
17
- end
18
-
19
- # FIXME Now, can send *only* one item
20
- def push_list_to(target_email, title, items)
21
- push_to :list, target_email, title: title, items: items
22
- end
23
-
24
- private
25
-
26
- def push_to(type, target_email, payload)
27
- post '/api/pushes', payload.merge(target_email: target_email, type: type)
28
- end
29
- end
30
- end
@@ -1,3 +0,0 @@
1
- module Pushbullet
2
- VERSION = '0.0.2'
3
- end
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'pushbullet/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "pushbullet"
8
- spec.version = Pushbullet::VERSION
9
- spec.authors = ["vajapravin"]
10
- spec.email = ["vajapravin23@gmail.com"]
11
- spec.summary = %q{PushBullet's API enables developers to push to devices that have installed the PushBullet Android app.}
12
- spec.description = %q{PushBullet's API enables developers to push to devices that have installed the PushBullet Android app. Authentication is provided by a user's API key, found in their Account Settings. By using an API key, users can allow third party software built on this API without needing to provide their Google account and password.}
13
- spec.homepage = "https://github.com/vajapravin/pushbullet"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake", "~> 0"
23
- spec.add_development_dependency 'faraday', "~> 0"
24
- spec.add_development_dependency 'mime-types', "~> 0"
25
-
26
- end