motion-tickspot 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b6455d7dace1aac142f428ac433445ac3dda174
4
- data.tar.gz: fcfe56dc4d391ee5d5e0b9b2421cb89c62652763
3
+ metadata.gz: 8bafc1996b9372f0d3212c08a153992c56032f19
4
+ data.tar.gz: 6103752954c06dc8b0cf0752e26f909b536200a3
5
5
  SHA512:
6
- metadata.gz: b91738ee8620ccdfa71051ae2e6e9480121615fda8c92e59d05eec9d437ec35fe939b52af2ffc579a48beaec8155e69634ac15c66739fbae9f0458fc2c2fcec5
7
- data.tar.gz: dec452fdb76f245f004e7102ed812e4833e4c59263048f86f7e12f2ffc0a82386cbcdab216b76cb3da701bedc3d08ebe17172ef973c8764250645e09dc4ddef4
6
+ metadata.gz: 4bd371423e829956b082048988bd08bcf21e9bba591bf95d00d4c2575fd4acd1b8c311b0a3d2a7d402f7816868b2d1443e02d575bd3d824672983be23efae4b9
7
+ data.tar.gz: dba7f186a682f583b05f0ff387bfa75d8233388a334ae718d71533fc8e196709551e50a0b646c0db89d20a49eb63dac71c92d0af39dc5740040f9e666f8ed8d9
data/lib/tick/session.rb CHANGED
@@ -1,84 +1,84 @@
1
1
  module Tick
2
-
2
+
3
3
  class AuthenticationError < Exception
4
4
  end
5
-
5
+
6
6
  class Session < Tick::Base
7
7
  attr_accessor :company, :email, :first_name, :last_name, :password
8
-
8
+
9
9
  SERVICE_NAME = "Tick"
10
-
10
+
11
11
  def company
12
12
  @company ||= storage.objectForKey("company")
13
13
  end
14
-
14
+
15
15
  def company=(value)
16
16
  @company = value
17
17
  storage.setObject(value, forKey:"company")
18
18
  storage.synchronize
19
19
  @company
20
20
  end
21
-
21
+
22
22
  def destroy
23
23
  storage.removeObjectForKey("company")
24
24
  storage.removeObjectForKey("email")
25
25
  SSKeychain.deletePasswordForService(SERVICE_NAME, account:email)
26
26
  self.class.current = nil
27
27
  end
28
-
28
+
29
29
  def email
30
30
  @email ||= storage.objectForKey("email")
31
31
  end
32
-
32
+
33
33
  def email=(value)
34
34
  @email = value
35
35
  storage.setObject(value, forKey:"email")
36
36
  storage.synchronize
37
37
  @email
38
38
  end
39
-
39
+
40
40
  def first_name
41
41
  @first_name ||= storage.objectForKey("first_name")
42
42
  end
43
-
43
+
44
44
  def first_name=(value)
45
45
  @first_name = value
46
46
  storage.setObject(value, forKey:"first_name")
47
47
  storage.synchronize
48
48
  @first_name
49
49
  end
50
-
50
+
51
51
  def last_name
52
52
  @last_name ||= storage.objectForKey("last_name")
53
53
  end
54
-
54
+
55
55
  def last_name=(value)
56
56
  @last_name = value
57
57
  storage.setObject(value, forKey:"last_name")
58
58
  storage.synchronize
59
59
  @last_name
60
60
  end
61
-
61
+
62
62
  def password
63
63
  @password ||= SSKeychain.passwordForService(SERVICE_NAME, account:email)
64
64
  end
65
-
65
+
66
66
  def password=(value)
67
67
  @password = value
68
68
  SSKeychain.setPassword(value, forService:SERVICE_NAME, account:email)
69
69
  @password
70
70
  end
71
-
71
+
72
72
  def storage
73
73
  NSUserDefaults.standardUserDefaults
74
74
  end
75
-
75
+
76
76
  def self.create(params, &block)
77
77
  url = "https://#{params[:company]}.tickspot.com/api/users"
78
-
78
+
79
79
  company = params[:company]
80
80
  params.delete(:company)
81
-
81
+
82
82
  request_manager.GET(url, parameters:params, success:lambda{|operation, result|
83
83
  # TODO: Save first and last name
84
84
  @current = new
@@ -90,22 +90,22 @@ module Tick
90
90
  ap error
91
91
  block.call(nil) if block
92
92
  })
93
-
93
+
94
94
  self
95
95
  end
96
-
96
+
97
97
  def self.current
98
- @current || (logged_in? ? new : nil)
98
+ @current || new
99
99
  end
100
-
100
+
101
101
  def self.current=(value)
102
102
  @current = value
103
103
  end
104
-
104
+
105
105
  def self.logged_in?
106
- (@current && @current.company && @current.email && @current.password) ? true : false
106
+ (current.company && current.email && current.password) ? true : false
107
107
  end
108
-
108
+
109
109
  end
110
-
111
- end
110
+
111
+ end
data/lib/tick/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tick
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-tickspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-cocoapods