zuckermo 0.0.1

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: feef88c44599df583a08a5ee88ea6a09cf6861fc
4
+ data.tar.gz: b1732bb2765e50dea642bb256633545c9504218e
5
+ SHA512:
6
+ metadata.gz: e3103e463ef45cee931ba02f85776b1cba7ea86ce8f3f9feacdfbe7754b5ed860810929541d575f6f876ff7d9050d5f98efe7f30a8de22a60ed8981ebb89e77f
7
+ data.tar.gz: 0258481f673bf66eb0fe2c45985cb9f318813a599422c37444bde4f005b15e10ea79f3d8da33685a08c58a1ec7aa643ef78dfb03a773896182a8d2a81e35f5da
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1,5 @@
1
+ 0g�ܠ�n�n�k
2
+ a~4�@�KUg7}!��D�X�GQw�b���ħ�o
3
+ �0a�a��T�.;��b����U�E
4
+ �P�x��)ex+P�����j\�\F�0�H@猴*mJC|�Ʃ{��)o84Үe�BH9��*�������n� 㮩�g8�Tf�P�}>��Z8SZ�b%\��v
5
+ -6K��ןq.�
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ Gemfile.lock
2
+ .repl_history
3
+ build
4
+ resources/*.nib
5
+ resources/*.momd
6
+ resources/*.storyboardc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in the gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Zuckermo, a RubyMotion Wrapper for Facebook.
2
+
3
+ Hat Tip to clayallsopp/twittermotion for inspiration
4
+
5
+ ## Usage
6
+
7
+ Sign in:
8
+
9
+ ```ruby
10
+ Facebook.app_key = 'xxxxxxxxx'
11
+ Facebook.sign_in do |granted, ns_error|
12
+ # have fun
13
+ end
14
+ ```
15
+
16
+ See accounts:
17
+
18
+ ```ruby
19
+ > Facebook.accounts
20
+ => [#<Twitter::User>]
21
+ > Facebook.accounts[0].username
22
+ => "name@example.com"
23
+ ```
24
+
25
+ ## Installation
26
+
27
+ 1. `gem install zuckermo`
28
+
29
+ 2. Add `require 'zuckermo'` to your `Rakefile`
30
+
31
+ ## Contributing
32
+
33
+ It would be really cool if this was a fully-compatible Facebook API wrapper, so add whatever functionality you think helps!
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ $:.unshift("/Library/RubyMotion/lib")
2
+ require 'dotenv'
3
+ Dotenv.load
4
+
5
+ require 'motion/project/template/ios'
6
+ require "bundler/gem_tasks"
7
+
8
+ $:.unshift("./lib/")
9
+ require './lib/zuckermo'
10
+
11
+ Motion::Project::App.setup do |app|
12
+ # Use `rake config' to see complete project settings.
13
+ app.name = 'Zuckermo'
14
+ app.identifier = 'com.zuckermo.test'
15
+ end
@@ -0,0 +1,31 @@
1
+ class AppDelegate
2
+
3
+ def application application, didFinishLaunchingWithOptions: launchOptions
4
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
5
+
6
+ @controller = UIViewController.alloc.initWithNibName(nil, bundle:nil)
7
+
8
+ @window.rootViewController = @controller
9
+ @window.makeKeyAndVisible
10
+
11
+ @label = UILabel.alloc.initWithFrame [ [10,10], [300,100] ]
12
+ @label.setAccessibilityLabel 'username'
13
+ @label.setText '...'
14
+ @controller.view.addSubview @label
15
+
16
+ Facebook.app_id = ENV['APP_ID']
17
+ Facebook.sign_in do |granted, error|
18
+ if granted
19
+ @label.setText Facebook.accounts[0].username
20
+ else
21
+ puts error.code
22
+ puts error.localizedDescription
23
+ puts error.localizedRecoveryOptions
24
+ puts error.localizedRecoverySuggestion
25
+ @label.setText 'Fail... See Log'
26
+ end
27
+ end
28
+
29
+ true
30
+ end
31
+ end
data/lib/zuckermo.rb ADDED
@@ -0,0 +1,14 @@
1
+ require "zuckermo/version"
2
+
3
+ unless defined?(Motion::Project::Config)
4
+ raise "This file must be required within a RubyMotion project config (usually the Rakefile)."
5
+ end
6
+
7
+ require 'bubble-wrap'
8
+
9
+ Motion::Project::App.setup do |app|
10
+ Dir.glob(File.join(File.dirname(__FILE__), '../motion/**/*.rb')).each do |file|
11
+ app.files.unshift(file)
12
+ end
13
+ app.frameworks += ["Facebook", "Accounts"]
14
+ end
@@ -0,0 +1,3 @@
1
+ module Zuckermo
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,29 @@
1
+ module Facebook
2
+ class << self
3
+
4
+ def app_id= id
5
+ zuckermo.app_id = id
6
+ end
7
+
8
+ def account_store
9
+ zuckermo.account_store
10
+ end
11
+
12
+ def account_type
13
+ zuckermo.account_type
14
+ end
15
+
16
+ def accounts
17
+ zuckermo.accounts
18
+ end
19
+
20
+ def sign_in permissions = ['email'], audience = nil, &block
21
+ zuckermo.sign_in permissions, audience, &block
22
+ end
23
+
24
+ private
25
+ def zuckermo
26
+ @zuckermo ||= Zuckermo::AccountStore.alloc.init
27
+ end
28
+ end
29
+ end
data/motion/pollute.rb ADDED
@@ -0,0 +1,9 @@
1
+ class ACAccountType
2
+ alias_method :granted?, :accessGranted
3
+ alias_method :description, :accountTypeDescription
4
+ end
5
+
6
+ class ACAccount
7
+ alias_method :account_description, :accountDescription
8
+ alias_method :account_type, :accountType
9
+ end
@@ -0,0 +1,2 @@
1
+ module Zuckermo
2
+ end
@@ -0,0 +1,43 @@
1
+ module Zuckermo
2
+ class AccountStore
3
+
4
+ def init
5
+ @app_id = nil
6
+ @account_store ||= ACAccountStore.alloc.init
7
+ self
8
+ end
9
+
10
+ attr_accessor :app_id
11
+ attr_reader :account_store
12
+
13
+ def account_type
14
+ self.account_store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook)
15
+ end
16
+
17
+ def accounts
18
+ self.account_store.accountsWithAccountType(account_type).collect do |ac_account|
19
+ Zuckermo::User.new ac_account
20
+ end
21
+ end
22
+
23
+ def sign_in permissions, audience, &block
24
+ @permissions, @audience, @callback = permissions, audience, block
25
+
26
+ @options =
27
+ {
28
+ ACFacebookAppIdKey => @app_id,
29
+ ACFacebookPermissionsKey => @permissions
30
+ }
31
+
32
+ self.account_store.requestAccessToAccountsWithType( self.account_type,
33
+ options: @options,
34
+ completion: -> granted, error do
35
+ Dispatch::Queue.main.sync do
36
+ @callback.call(granted, error)
37
+ end
38
+ end
39
+ )
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,14 @@
1
+ module Zuckermo
2
+ class User
3
+ attr_accessor :ac_account
4
+
5
+ def initialize(ac_account)
6
+ self.ac_account = ac_account
7
+ end
8
+
9
+ def username
10
+ self.ac_account.username
11
+ end
12
+
13
+ end
14
+ end
data/spec/main_spec.rb ADDED
@@ -0,0 +1,17 @@
1
+ describe "Accessing a Facebook account" do
2
+ extend Bacon::Functional::API
3
+
4
+ before do
5
+ self.window = UIApplication.sharedApplication.keyWindow
6
+ end
7
+
8
+ it 'allows us to retrieve the users name' do
9
+ wait 1 do
10
+ tap 'ok'
11
+ end
12
+ wait 1 do
13
+ view('username').text.should.equal ENV['USER']
14
+ end
15
+ end
16
+
17
+ end
data/zuckermo.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/zuckermo/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "zuckermo"
6
+ s.version = Zuckermo::VERSION
7
+ s.authors = ["Jon Rowe"]
8
+ s.email = ["hello@jonrowe.co.uk"]
9
+ s.homepage = "https://github.com/JonRowe/zuckermo"
10
+ s.summary = "A RubyMotion Facebook Wrapper"
11
+ s.description = "A RubyMotion Facebook Wrapper, based of @clayallsopp's TwitterMotion wrapper."
12
+
13
+ s.files = `git ls-files`.split($\)
14
+ s.test_files = s.files.grep(%r{^(spec|features)/})
15
+ s.require_paths = ["lib"]
16
+
17
+ s.add_dependency "bubble-wrap", ">= 1.1.2"
18
+ s.add_development_dependency 'rake'
19
+ s.add_development_dependency 'dotenv'
20
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zuckermo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jon Rowe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDVjCCAj6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBRMQ4wDAYDVQQDDAVoZWxs
14
+ bzEXMBUGCgmSJomT8ixkARkWB2pvbnJvd2UxEjAQBgoJkiaJk/IsZAEZFgJjbzES
15
+ MBAGCgmSJomT8ixkARkWAnVrMB4XDTEzMDIwMzA4MTgwNloXDTE0MDIwMzA4MTgw
16
+ NlowUTEOMAwGA1UEAwwFaGVsbG8xFzAVBgoJkiaJk/IsZAEZFgdqb25yb3dlMRIw
17
+ EAYKCZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJ1azCCASIwDQYJKoZI
18
+ hvcNAQEBBQADggEPADCCAQoCggEBAMhs6ng/SRrYfG7RtQx8liJTZs8tpz7PBnlH
19
+ qyOwuU0weJc7nh6C9C8LGyJzpkbjJJo1rfTMg7huDyL14Py82dfMDomApif8jNNI
20
+ 8KtviAgB1DrWq0fCDLtu/M77+yuVV3OhDdrAFaBkT/euvdJ8cAKrLxbJ+klgvrcB
21
+ FK+c4PUV3/zBKghe0l7FuDhyQCsuLNDbWyFvDS97tPjeN6yWuszwg22vZMDdsuzN
22
+ Cj3M4LLSkbrt+AOUcysEJxI4t6uv2U1bRzHsDfAF0RI/Q7OMtUr+Dtz/2YJ47KKs
23
+ 51ZRjLLGHd10XrIfFSfGyJj1dMbDgLsEBj1sFH4e6dy7gau8TaUCAwEAAaM5MDcw
24
+ CQYDVR0TBAIwADAdBgNVHQ4EFgQULu5JH2g7RAjoXaZt+fbrfNDI9IkwCwYDVR0P
25
+ BAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IBAQAf5A4kB769DPKGjPZ++v42FwVi7X7v
26
+ RpufPs6R4YHyzHXaJmAqnhleZhVJijBgsdb2SigNRbg+IK8XYHg7jkonMgO8OS3D
27
+ C6w8VB5bI0PqyDOwCGcQkYHYlZZWCghAyBTSBowHAekMb9V3QjJtJ8XkizjshETO
28
+ ZCVI2AObjlJi8I10aK2tSo9sv2riCKZ92BVSM13zYWn+C/eCP/m9BDiw37UQtuQq
29
+ 2feWfO4gCNmvfFjULOAYHq9JHEjN5SLSXvj5HdSnDcCyIfJKn5Ya3JahWQaWIsXf
30
+ /NPE/mB57TOwj+d7XUa2NC4HUadF8R51IYEcIB0PpIEzJlKtfXFcOZxO
31
+ -----END CERTIFICATE-----
32
+ date: 2013-05-22 00:00:00.000000000 Z
33
+ dependencies:
34
+ - !ruby/object:Gem::Dependency
35
+ name: bubble-wrap
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.1.2
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.2
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: dotenv
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ description: A RubyMotion Facebook Wrapper, based of @clayallsopp's TwitterMotion
77
+ wrapper.
78
+ email:
79
+ - hello@jonrowe.co.uk
80
+ executables: []
81
+ extensions: []
82
+ extra_rdoc_files: []
83
+ files:
84
+ - .gitignore
85
+ - Gemfile
86
+ - README.md
87
+ - Rakefile
88
+ - app/app_delegate.rb
89
+ - lib/zuckermo.rb
90
+ - lib/zuckermo/version.rb
91
+ - motion/facebook.rb
92
+ - motion/pollute.rb
93
+ - motion/zuckermo.rb
94
+ - motion/zuckermo/account_store.rb
95
+ - motion/zuckermo/user.rb
96
+ - spec/main_spec.rb
97
+ - zuckermo.gemspec
98
+ homepage: https://github.com/JonRowe/zuckermo
99
+ licenses: []
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.0.3
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: A RubyMotion Facebook Wrapper
121
+ test_files:
122
+ - spec/main_spec.rb
metadata.gz.sig ADDED
Binary file