motion-tickspot 1.0.10 → 1.0.11

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: 0e82bf381090a0e8d3d7e34d0a3a4349ee1b7d3f
4
- data.tar.gz: f30ceaf911a5c1252870d0cde13a89a1451fcc64
3
+ metadata.gz: 6bdb96961fddc506def917e52f9afeb0183b845e
4
+ data.tar.gz: 4d402077a1c88d58c6c2279aa4365f9aca12b434
5
5
  SHA512:
6
- metadata.gz: 3821a5cf77fd4c39d4c1732e0375d0330fdcefe9cba859479f10a4d777c2fd148d056c0ad079d91fcf95bd1db3ac4c2b2cf7075a7fc02ecfc620a292fcf856a7
7
- data.tar.gz: a0e1c9b37003c89b22256119847901206d16ffc1258e5b26b7ac15a7e41cc6dfe4eef84fc8f159867334fef5f1330296248021c0fdec165dfc171a9057a764f5
6
+ metadata.gz: 1d5438affedc222d198630d544d25a188b3c52092626fc562159c667418fd6c7ddbef4fc35dc7b129d49d8e72bb999ff6e0ed19566621fcd42b384bb527672fb
7
+ data.tar.gz: 0e9fc4a73f6cfc69889aa9d5597f5174c1fc5bd37c65164545c9c33ad20619184b3af6c1e83768a74ee7389f7cb894876536c31fec3a3fb3c37a9eba17c5db8a
@@ -7,10 +7,10 @@ end
7
7
  lib_dir_path = File.dirname(File.expand_path(__FILE__))
8
8
  Motion::Project::App.setup do |app|
9
9
  app.files.unshift(Dir.glob(File.join(lib_dir_path, "tick/**/*.rb")))
10
-
10
+
11
11
  app.pods do
12
- pod "AFNetworking", "~> 2.0.1"
13
- pod "GDataXML-HTML", "~> 1.1.0"
14
- pod "SSKeychain", "~> 1.2.1"
12
+ pod "AFNetworking", "~> 2.4"
13
+ pod "GDataXML-HTML", "~> 1.2"
14
+ pod "SSKeychain", "~> 1.2"
15
15
  end
16
16
  end
@@ -1,10 +1,10 @@
1
1
  module Tick
2
-
2
+
3
3
  DATE_FORMAT = "yyyy-MM-dd"
4
4
  DATETIME_FORMAT = "EE, dd MMM yyyy HH:mm:ss ZZZ"
5
-
5
+
6
6
  class << self
7
-
7
+
8
8
  def log_in(company, email, password, &block)
9
9
  params = {
10
10
  company: company,
@@ -16,22 +16,22 @@ module Tick
16
16
  end
17
17
  end
18
18
  alias_method :login, :log_in
19
-
19
+
20
20
  def log_out
21
21
  Session.current.destroy if Session.current
22
22
  end
23
23
  alias_method :logout, :log_out
24
-
24
+
25
25
  def logged_in?
26
26
  Session.logged_in?
27
27
  end
28
-
28
+
29
29
  end
30
-
30
+
31
31
  class Base
32
32
  attr_accessor :id, :created_at, :updated_at
33
33
  attr_reader :api_name, :api_path
34
-
34
+
35
35
  def set_properties_from_xml_node(xml_node)
36
36
  self.class::XML_PROPERTIES.each do |property|
37
37
  xml_elements = xml_node.elementsForName(property)
@@ -39,47 +39,47 @@ module Tick
39
39
  self.send("#{property}=", value)
40
40
  end
41
41
  end
42
-
42
+
43
43
  def self.api_name
44
44
  self.to_s.split('::').last.downcase
45
45
  end
46
-
46
+
47
47
  def self.api_path
48
48
  "/api/#{api_name}s"
49
49
  end
50
-
50
+
51
51
  def self.list(options={}, &block)
52
52
  url = "https://#{current_session.company}.tickspot.com#{api_path}"
53
-
53
+
54
54
  params = authentication_params.merge!(options)
55
-
56
- request_manager.GET(url, parameters:params, success:lambda{|operation, result|
55
+
56
+ request_manager.GET(url, parameters: params, success: ->(operation, result) {
57
57
  objects = []
58
-
58
+
59
59
  # Parse XML
60
60
  error = Pointer.new(:object)
61
61
  xml = GDataXMLDocument.alloc.initWithXMLString(result.to_s, error:error)
62
-
62
+
63
63
  # Create the objects
64
64
  error = Pointer.new(:object)
65
65
  xml_nodes = xml.nodesForXPath("//#{api_name}", error:error)
66
-
66
+
67
67
  xml_nodes.each do |xml_node|
68
68
  object = new
69
69
  object.set_properties_from_xml_node(xml_node)
70
70
  objects << object
71
71
  end
72
-
72
+
73
73
  block.call(objects) if block
74
- }, failure:lambda{|operation, error|
74
+ }, failure: ->(operation, error) {
75
75
  block.call(error) if block
76
76
  })
77
-
77
+
78
78
  self
79
79
  end
80
-
80
+
81
81
  private
82
-
82
+
83
83
  def get_xml_element_value(xml_element)
84
84
  type = xml_element.attributeForName("type")
85
85
  type = type.stringValue if type
@@ -105,26 +105,26 @@ module Tick
105
105
  end
106
106
  end
107
107
  end
108
-
108
+
109
109
  def date_from_string(string)
110
110
  dateFormatter = NSDateFormatter.new
111
111
  dateFormatter.setDateFormat(DATE_FORMAT)
112
112
  dateFormatter.dateFromString(string)
113
113
  end
114
-
114
+
115
115
  def datetime_from_string(string)
116
116
  dateFormatter = NSDateFormatter.new
117
117
  dateFormatter.setDateFormat(DATETIME_FORMAT)
118
118
  dateFormatter.dateFromString(string)
119
119
  end
120
-
120
+
121
121
  def self.authentication_params
122
122
  {
123
123
  email: current_session.email,
124
124
  password: current_session.password
125
125
  }
126
126
  end
127
-
127
+
128
128
  def self.current_session
129
129
  if Session.current
130
130
  Session.current
@@ -132,21 +132,21 @@ module Tick
132
132
  raise AuthenticationError.new("User is not logged in.")
133
133
  end
134
134
  end
135
-
135
+
136
136
  def self.request_manager
137
137
  manager = AFHTTPRequestOperationManager.manager
138
-
138
+
139
139
  request_serializer = AFHTTPRequestSerializer.serializer
140
140
  request_serializer.setValue("application/xml", forHTTPHeaderField:"Content-type")
141
141
  manager.requestSerializer = request_serializer
142
-
142
+
143
143
  response_serializer = AFHTTPResponseSerializer.serializer
144
144
  response_serializer.acceptableContentTypes = NSSet.setWithObjects("application/xml", nil)
145
145
  manager.responseSerializer = response_serializer
146
-
146
+
147
147
  manager
148
148
  end
149
-
149
+
150
150
  end
151
-
152
- end
151
+
152
+ end
@@ -1,3 +1,3 @@
1
1
  module Tick
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.11"
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.10
4
+ version: 1.0.11
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-06-05 00:00:00.000000000 Z
11
+ date: 2014-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-cocoapods
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.4'
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: awesome_print_motion
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ files:
126
126
  - lib/tick/task.rb
127
127
  - lib/tick/timer.rb
128
128
  - lib/tick/version.rb
129
- homepage: https://github.com/81designs/motion-tickspot
129
+ homepage: https://github.com/codelation/motion-tickspot
130
130
  licenses:
131
131
  - MIT
132
132
  metadata: {}
@@ -151,4 +151,3 @@ signing_key:
151
151
  specification_version: 4
152
152
  summary: A RubyMotion wrapper for the http://tickspot.com API
153
153
  test_files: []
154
- has_rdoc: