syncano 3.1.1.beta3 → 3.1.1.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OTU1OTQyZDc3YmQ0YWIwNTExNDg1N2RhMWZhYTJmNDRlNDA3ZTlhNQ==
5
- data.tar.gz: !binary |-
6
- MDJkOTExMzZiMTJlNzNhYWIwZTlmNGIzMzI5NTRjNmEwNTA2NzNlYg==
2
+ SHA1:
3
+ metadata.gz: b75edf5f1aad772e7227d8ca59887d525e598cdb
4
+ data.tar.gz: 12605d8d994a1af479fbc2c6acf5b789120c1220
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NWIzZGMwNWI4NGRjNWYxYjQwZjQ3MDllYmE2MGYwOGJhMWI5N2NiZjliYjhm
10
- YjlhYzc1YWY3MzYyOGM1NmNmNzZhNzU3MzU4YThkMzQ0MDBiZTM0NzNkYzNh
11
- MDI3ZDc3YmFiYzExOWIyYjQ3Y2FmMTg3ZDRlZTI5YWE2YjYzZjk=
12
- data.tar.gz: !binary |-
13
- Y2Y5ZDkxNDAwYzZlMDJiMGNiMGQxN2Q2ZjcxM2Q4YzIxMzk0ZTVmNzE4Zjll
14
- ZGU4OTkzNmM2ODZiN2Q5YTU1MmQwZjRhNGRmMWRhNGY0NDI2OTM5ZjVjOWE5
15
- N2UxYTY4Yjc2OWRhMGRhNGMzYmEyZWYyZTc1Mzc2MzA4YmQ2NzE=
6
+ metadata.gz: 5800139bcb19838db014acb5fe4461930ccf52cb9b4de7223ada5bb60da78097402d3277965c0d24a143442c6745c851f7a3dc5bd695e163cfc6fffdd98b4cd7
7
+ data.tar.gz: fbb8fc5451242f2e6e2603abaf691448b11867fe81a411b949d4c6b6e5005ae1a436d0002ef83e8bfdc755a1bc8fea0ad02bdc1d91fe1c242544d6816da18a8d
data/README.md CHANGED
@@ -10,7 +10,7 @@ Click here to learn more about [Syncano](http://www.syncano.com) or [create an a
10
10
 
11
11
  Add this line to your application's Gemfile:
12
12
 
13
- gem 'syncano', '~> 3.1.1.beta3'
13
+ gem 'syncano', '~> 3.1.1.beta4'
14
14
 
15
15
  And then execute:
16
16
 
@@ -18,7 +18,7 @@ And then execute:
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- $ gem install syncano -v 3.1.1.beta3 --pre
21
+ $ gem install syncano -v 3.1.1.beta4 --pre
22
22
 
23
23
  At the end generate initializer with api key and api instance name:
24
24
 
@@ -273,7 +273,7 @@ Before you will receive any notification, you have to subscribe to some project
273
273
 
274
274
  ```ruby
275
275
  client = Syncano.sync_client
276
- project = client.projects.find(project_id)
276
+ project = client.project.find(project_id)
277
277
  project.subscribe
278
278
  ```
279
279
 
@@ -1,4 +1,4 @@
1
- module Syncano
1
+ class Syncano
2
2
  # Module for generators used implemented in the gem
3
3
  module Generators
4
4
  # Install generator used for initializing gem in a Rails application
data/lib/syncano.rb CHANGED
@@ -19,7 +19,7 @@ class Syncano
19
19
  auth_data = self.auth_data(options)
20
20
  client = Syncano::Clients::Sync.instance(auth_data[:instance_name], auth_data[:api_key], auth_data[:auth_key])
21
21
  client.login(options[:username], options[:password]) if client.auth_key.nil? && options[:username].present?
22
- client.connect
22
+ client.reconnect
23
23
  client
24
24
  end
25
25
 
@@ -29,9 +29,15 @@ class Syncano
29
29
  @singleton__instance__
30
30
  end
31
31
 
32
+ # Checks if client is connected
33
+ # @return [TrueClass, FalseClass]
34
+ def connected?
35
+ !connection.blank?
36
+ end
37
+
32
38
  # Connects with the Sync api
33
39
  def connect
34
- if connection.blank?
40
+ unless connected?
35
41
  hostname = 'api.syncano.com'
36
42
  port = 8200
37
43
 
@@ -68,7 +74,7 @@ class Syncano
68
74
 
69
75
  # Disconnects with the Sync api
70
76
  def disconnect
71
- EM.stop
77
+ EM.stop if EM::reactor_running?
72
78
  self.connection = nil
73
79
  end
74
80
 
@@ -125,9 +131,12 @@ class Syncano
125
131
  # @param [String] response_key for cases when response from api is incompatible with the convention
126
132
  # @return [Syncano::Response]
127
133
  def make_request(resource_name, method_name, params = {}, response_key = nil)
134
+ raise(::Syncano::ConnectionError.new('Not connected to the Sync Server!')) unless connected?
135
+
128
136
  response_key ||= resource_name
129
137
 
130
138
  packet = ::Syncano::Packets::Call.new(resource_name: resource_name, method_name: method_name, data: params)
139
+
131
140
  connection.send_data("#{packet.to_json}\n")
132
141
 
133
142
  response_packet = nil
@@ -1,4 +1,4 @@
1
1
  class Syncano
2
2
  # Syncano version number
3
- VERSION = '3.1.1.beta3'
3
+ VERSION = '3.1.1.beta4'
4
4
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syncano
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1.beta3
4
+ version: 3.1.1.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Zadrożny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2014-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jimson-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: multi_json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.10'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.10'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: eventmachine
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.6'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.6'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mocha
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard-rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ! '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: A Ruby client that provides convenient interface for the Syncano api.
@@ -157,7 +157,7 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - .gitignore
160
+ - ".gitignore"
161
161
  - Gemfile
162
162
  - Guardfile
163
163
  - LICENSE.txt
@@ -222,12 +222,12 @@ require_paths:
222
222
  - lib
223
223
  required_ruby_version: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - ! '>='
225
+ - - ">="
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  requirements:
230
- - - ! '>'
230
+ - - ">"
231
231
  - !ruby/object:Gem::Version
232
232
  version: 1.3.1
233
233
  requirements: []