ruby_spark 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/helpers/configuration.rb +27 -0
- data/lib/ruby_spark/core.rb +1 -1
- data/lib/ruby_spark/version.rb +1 -1
- data/lib/ruby_spark.rb +2 -2
- data/ruby_spark.gemspec +2 -2
- data/spec/fixtures/vcr_cassettes/analog_read.yml +1 -1
- data/spec/fixtures/vcr_cassettes/analog_write.yml +1 -1
- data/spec/fixtures/vcr_cassettes/bad_core_id.yml +1 -1
- data/spec/fixtures/vcr_cassettes/bad_token.yml +1 -1
- data/spec/fixtures/vcr_cassettes/digital_read.yml +1 -1
- data/spec/fixtures/vcr_cassettes/digital_write.yml +1 -1
- data/spec/fixtures/vcr_cassettes/function.yml +1 -1
- data/spec/fixtures/vcr_cassettes/info.yml +1 -1
- data/spec/fixtures/vcr_cassettes/spark_timeout.yml +1 -1
- data/spec/fixtures/vcr_cassettes/variable.yml +1 -1
- data/spec/spark/core_spec.rb +1 -1
- metadata +23 -23
- data/lib/ruby_spark/helpers/configuration.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84a1c59d2d9a832c4480eab8511e481f75bd3bb9
|
4
|
+
data.tar.gz: 4e1e129c0c8901463930751de034ea263fc1ad73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b14196cfa903efa3b8f2a698606c7aa36f140f54a6a9b23bc56f688d5fa5a299b734334ed0d900aaef731f989b8b1374b5e0d0f9ccfaa72488f1b4664bb87b35
|
7
|
+
data.tar.gz: ecba90f558d501a401de11b1a90ae0f61944ef404c2b5dbbfe71eb9fcf5882e6ec1f11a045537cb3be078c48e37068f01f2fd977eee6f4867ac2ba2fc2741e9b
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# RubySpark
|
2
2
|
|
3
|
-
|
3
|
+
Easily control you [Particle](http://particle.io) (formerly Spark) Device with Ruby.
|
4
4
|
|
5
|
-
## Obtaining a
|
5
|
+
## Obtaining a Particle Access Token and Core ID
|
6
6
|
|
7
|
-
Assuming at this point you've followed
|
7
|
+
Assuming at this point you've followed Particle's [Getting Started](http://docs.particle.io/#/start) guides and connected your Core with the Particle Cloud.
|
8
8
|
|
9
|
-
Head over to the [
|
9
|
+
Head over to the [Particle Build IDE](https://www.particle.io/build). In the Settings tab you can get your Access Token, and you can fetch your Device ID from the Cores tab. You'll need these both to authenticate your API calls, and the Device ID to direct them.
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Configuration
|
2
|
+
|
3
|
+
def configuration
|
4
|
+
yield self
|
5
|
+
end
|
6
|
+
|
7
|
+
def define_setting(name, default = nil)
|
8
|
+
class_variable_set("@@#{name}", default)
|
9
|
+
|
10
|
+
define_class_method "#{name}=" do |value|
|
11
|
+
class_variable_set("@@#{name}", value)
|
12
|
+
end
|
13
|
+
|
14
|
+
define_class_method name do
|
15
|
+
class_variable_get("@@#{name}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def define_class_method(name, &block)
|
22
|
+
(class << self; self; end).instance_eval do
|
23
|
+
define_method name, &block
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/ruby_spark/core.rb
CHANGED
data/lib/ruby_spark/version.rb
CHANGED
data/lib/ruby_spark.rb
CHANGED
@@ -3,12 +3,12 @@ require 'httparty'
|
|
3
3
|
require 'ruby_spark/version'
|
4
4
|
require 'ruby_spark/core'
|
5
5
|
require 'ruby_spark/tinker'
|
6
|
-
require '
|
6
|
+
require 'helpers/configuration'
|
7
7
|
|
8
8
|
module RubySpark
|
9
9
|
class ConfigurationError < StandardError; end
|
10
10
|
|
11
|
-
|
11
|
+
extend Configuration
|
12
12
|
|
13
13
|
define_setting :access_token
|
14
14
|
define_setting :timeout, 30
|
data/ruby_spark.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = RubySpark::VERSION
|
10
10
|
spec.authors = ["Eli Fatsi"]
|
11
11
|
spec.email = ["eli.fatsi@viget.com"]
|
12
|
-
spec.description = "Ruby Gem to make API calls to the
|
13
|
-
spec.summary = "Ruby Gem to make API calls to the
|
12
|
+
spec.description = "Ruby Gem to make API calls to the Particle Cloud"
|
13
|
+
spec.summary = "Ruby Gem to make API calls to the Particle Cloud"
|
14
14
|
spec.homepage = "http://github.com/efatsi/ruby_spark"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://api.
|
5
|
+
uri: https://api.particle.io/v1/devices/good_core_id/temperature?access_token=good_access_token
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
data/spec/spark/core_spec.rb
CHANGED
@@ -82,7 +82,7 @@ describe RubySpark::Core do
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
it "returns the appropriate error when the
|
85
|
+
it "returns the appropriate error when the Particle API times out" do
|
86
86
|
RubySpark.access_token = "good_access_token"
|
87
87
|
subject = described_class.new("good_core_id")
|
88
88
|
|
metadata
CHANGED
@@ -1,130 +1,130 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_spark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eli Fatsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
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: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.1'
|
34
34
|
type: :development
|
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: '10.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.14'
|
48
48
|
type: :development
|
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: '2.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: vcr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.5'
|
62
62
|
type: :development
|
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: '2.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.11'
|
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.11'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.9'
|
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.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: httparty
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.13'
|
104
104
|
type: :runtime
|
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.13'
|
111
|
-
description: Ruby Gem to make API calls to the
|
111
|
+
description: Ruby Gem to make API calls to the Particle Cloud
|
112
112
|
email:
|
113
113
|
- eli.fatsi@viget.com
|
114
114
|
executables: []
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- .gitignore
|
118
|
+
- ".gitignore"
|
119
119
|
- Gemfile
|
120
120
|
- LICENSE.txt
|
121
121
|
- README.md
|
122
122
|
- Rakefile
|
123
123
|
- examples/core_example.rb
|
124
124
|
- examples/tinker_example.rb
|
125
|
+
- lib/helpers/configuration.rb
|
125
126
|
- lib/ruby_spark.rb
|
126
127
|
- lib/ruby_spark/core.rb
|
127
|
-
- lib/ruby_spark/helpers/configuration.rb
|
128
128
|
- lib/ruby_spark/tinker.rb
|
129
129
|
- lib/ruby_spark/version.rb
|
130
130
|
- ruby_spark.gemspec
|
@@ -151,20 +151,20 @@ require_paths:
|
|
151
151
|
- lib
|
152
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
|
-
- -
|
154
|
+
- - ">="
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: '0'
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '0'
|
162
162
|
requirements: []
|
163
163
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.2.0
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
|
-
summary: Ruby Gem to make API calls to the
|
167
|
+
summary: Ruby Gem to make API calls to the Particle Cloud
|
168
168
|
test_files:
|
169
169
|
- spec/fixtures/vcr_cassettes/analog_read.yml
|
170
170
|
- spec/fixtures/vcr_cassettes/analog_write.yml
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module RubySpark
|
2
|
-
module Configuration
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
base.extend ClassMethods
|
6
|
-
end
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
def configuration
|
10
|
-
yield self
|
11
|
-
end
|
12
|
-
|
13
|
-
def define_setting(name, default = nil)
|
14
|
-
class_variable_set("@@#{name}", default)
|
15
|
-
|
16
|
-
define_class_method "#{name}=" do |value|
|
17
|
-
class_variable_set("@@#{name}", value)
|
18
|
-
end
|
19
|
-
|
20
|
-
define_class_method name do
|
21
|
-
class_variable_get("@@#{name}")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def define_class_method(name, &block)
|
28
|
-
(class << self; self; end).instance_eval { define_method name, &block }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|