motion-pusher 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e7e1f408b0db48f3e18f02c23bf3fdf6509b403a
4
+ data.tar.gz: e7023e524d38cbffd9c88376253ecbdd29e7cb06
5
+ SHA512:
6
+ metadata.gz: 45a040d589fbfc178ba35bc92c8f09d0a85719aabc0cb2a19c15f50f7f7a23df7a2974bf46b790fffc12d132f3a5e1deb028ba93f0710ccaf890d4390c2ad90f
7
+ data.tar.gz: d3c87dc53f217c68585b88aea01c142a853e3c2539b506dd76ae82fc3c2271b6638f098bdd9f5323ab696afdefd9f22d3f0c15d330ca55b60288ffbbaecef9a7
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 InfiniteRed LLC (http://infinitered.com)
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 ADDED
@@ -0,0 +1,49 @@
1
+ # motion-pusher
2
+
3
+ A ruby motion wrapper gem to interact with [the pusher cocoapod](https://github.com/lukeredpath/libPusher)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion-pusher'
10
+
11
+ If you are not currently using cocoapods, update your Rakefile
12
+
13
+ require 'rubygems'
14
+ require 'motion-cocoapods'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+ $ rake pod:setup
20
+ $ rake pod:install
21
+
22
+ ## Usage
23
+
24
+ Configure your Rakefile
25
+
26
+ app.pusher do
27
+ app.pusher.key = <PUSHER_KEY>
28
+ app.pusher.authorization_url = <AUTH_URL_FOR_PRIVATE_CHANNELS>
29
+ end
30
+
31
+ And create your first connection
32
+
33
+ class PusherClient
34
+ attr_accessor :client
35
+
36
+ def initialize
37
+ self.client = MotionPusherClient.new(self)
38
+ client.connect
39
+ client.subscribe_to('cool-public-channel')
40
+ end
41
+ end
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require 'motion-pusher/motion-pusher'
@@ -0,0 +1,29 @@
1
+ class MotionPusherClient
2
+ def initialize(delegate)
3
+ self.client = PTPusher.pusherWithKey(
4
+ self.config['key'],
5
+ delegate: delegate,
6
+ encrypted: true
7
+ )
8
+ end
9
+
10
+ def connect
11
+ client.connect
12
+ end
13
+
14
+ def subscribe_to(channel)
15
+ client.subscribeToChannelNamed(channel)
16
+ end
17
+
18
+ def subscribe_to_private(channel)
19
+ client.subscribeToPrivateChannelNamed(channel)
20
+ end
21
+
22
+ def config
23
+ @config ||= NSBundle.mainBundle.objectForInfoDictionaryKey('MotionPusher')
24
+ end
25
+
26
+ private
27
+
28
+ attr_accessor :client
29
+ end
@@ -0,0 +1,42 @@
1
+ unless defined?(Motion::Project::App)
2
+ raise "This must be required from within a RubyMotion Rakefile"
3
+ end
4
+
5
+ class PusherConfig
6
+ attr_accessor :key, :authorization_url
7
+
8
+ def initialize(config)
9
+ @config = config
10
+ end
11
+
12
+ def key=(value)
13
+ @config.info_plist['MotionPusher'] ||= {}
14
+ @config.info_plist['MotionPusher']['key'] = value
15
+ end
16
+
17
+ def authorization_url=(value)
18
+ @config.info_plist['MotionPusher'] ||= {}
19
+ @config.info_plist['MotionPusher']['authorization_url'] = value
20
+ end
21
+ end
22
+
23
+ module Motion
24
+ module Project
25
+ class Config
26
+ variable :pusher
27
+
28
+ def pusher
29
+ @pusher ||= PusherConfig.new(self)
30
+ yield @pusher if block_given?
31
+ @pusher
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ Motion::Project::App.setup do |app|
38
+ app.pods ||= Motion::Project::CocoaPods.new(app)
39
+ app.pods.dependency 'libPusher', '~> 1.5'
40
+ app.files.push(File.join(File.dirname(__FILE__), 'motion-pusher-client.rb'))
41
+ end
42
+
@@ -0,0 +1,3 @@
1
+ module MotionPusher
2
+ VERSION = "0.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-pusher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - David Larrabee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: motion-cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.6.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: bacon
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: RubyMotion interface to the Pusher
62
+ email:
63
+ - david.larrabee@meyouhealth.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - LICENSE
69
+ - README.md
70
+ - lib/motion-pusher.rb
71
+ - lib/motion-pusher/motion-pusher-client.rb
72
+ - lib/motion-pusher/motion-pusher.rb
73
+ - lib/motion-pusher/version.rb
74
+ homepage: https://github.com/squidpunch/motion-pusher
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.2
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: RubyMotion interface to the Pusher
98
+ test_files: []