ruby_spark 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/core_example.rb +2 -2
- data/examples/tinker_example.rb +2 -2
- data/lib/{spark.rb → ruby_spark.rb} +4 -4
- data/lib/{spark → ruby_spark}/core.rb +3 -3
- data/lib/{spark → ruby_spark}/tinker.rb +1 -1
- data/lib/{spark → ruby_spark}/version.rb +1 -1
- data/ruby_spark.gemspec +2 -2
- data/spec/spark/tinker_spec.rb +8 -8
- data/spec/spec_helper.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9324c9a6228dcc21ff13bd9d695389055af9cca7
|
4
|
+
data.tar.gz: 6a858029a91ba90690a2d1a9711dae5667159fcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e5516528e6443dc4f54132079ac5680e4c204153e3a592241c5e24670e34fb60f5346be0b3367253f5ebdc87fd169c61bcc0af1bfab4eba2d685e02c0ca8b07
|
7
|
+
data.tar.gz: 1dc2900c9ba70089e4310268e166e55a68729894101b6683244815ce15029c1769c8b9fec4a29509697b98dc0ee0a81cdb5a3c44ebf5ac113f862024edec874b
|
data/examples/core_example.rb
CHANGED
data/examples/tinker_example.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'ruby_spark/version'
|
4
|
+
require 'ruby_spark/core'
|
5
|
+
require 'ruby_spark/tinker'
|
6
6
|
|
7
|
-
module
|
7
|
+
module RubySpark
|
8
8
|
class ConfigurationError < StandardError; end
|
9
9
|
|
10
10
|
class << self
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module RubySpark
|
2
2
|
|
3
3
|
class Core
|
4
4
|
class ApiError < StandardError; end
|
5
5
|
|
6
|
-
def initialize(core_id, access_token =
|
7
|
-
raise
|
6
|
+
def initialize(core_id, access_token = RubySpark.access_token)
|
7
|
+
raise RubySpark::ConfigurationError.new("Access Token not defined") if access_token.nil?
|
8
8
|
|
9
9
|
@access_token = access_token
|
10
10
|
@core_id = core_id
|
data/ruby_spark.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
5
|
-
require '
|
4
|
+
require 'ruby_spark/version'
|
5
|
+
require 'ruby_spark/core'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "ruby_spark"
|
data/spec/spark/tinker_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'pry'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe RubySpark::Tinker do
|
5
5
|
|
6
6
|
context "with Access Token set in config variable" do
|
7
|
-
before {
|
7
|
+
before { RubySpark.access_token = "good_access_token" }
|
8
8
|
subject { described_class.new("good_core_id") }
|
9
9
|
|
10
10
|
describe "#digital_write" do
|
@@ -15,12 +15,12 @@ describe Spark::Tinker do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "returns the appropriate error when Access Token is bad" do
|
18
|
-
|
18
|
+
RubySpark.access_token = "bad_token"
|
19
19
|
|
20
20
|
VCR.use_cassette("bad_token") do
|
21
21
|
expect {
|
22
22
|
subject.digital_write(7, "HIGH")
|
23
|
-
}.to raise_error(
|
23
|
+
}.to raise_error(RubySpark::Core::ApiError)
|
24
24
|
end
|
25
25
|
|
26
26
|
VCR.use_cassette("bad_token") do
|
@@ -38,7 +38,7 @@ describe Spark::Tinker do
|
|
38
38
|
VCR.use_cassette("bad_core_id") do
|
39
39
|
expect {
|
40
40
|
subject.digital_write(7, "HIGH")
|
41
|
-
}.to raise_error(
|
41
|
+
}.to raise_error(RubySpark::Core::ApiError)
|
42
42
|
end
|
43
43
|
|
44
44
|
VCR.use_cassette("bad_core_id") do
|
@@ -54,7 +54,7 @@ describe Spark::Tinker do
|
|
54
54
|
VCR.use_cassette("spark_timeout") do
|
55
55
|
expect {
|
56
56
|
subject.digital_write(7, "HIGH")
|
57
|
-
}.to raise_error(
|
57
|
+
}.to raise_error(RubySpark::Core::ApiError)
|
58
58
|
end
|
59
59
|
|
60
60
|
VCR.use_cassette("spark_timeout") do
|
@@ -105,14 +105,14 @@ describe Spark::Tinker do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
context "with no Access Token defined" do
|
108
|
-
before {
|
108
|
+
before { RubySpark.access_token = nil }
|
109
109
|
subject { described_class.new("good_core_id") }
|
110
110
|
|
111
111
|
it "returns proper error if Access Token is not defined" do
|
112
112
|
VCR.use_cassette("no_token") do
|
113
113
|
expect {
|
114
114
|
subject.digital_read(6)
|
115
|
-
}.to raise_error(
|
115
|
+
}.to raise_error(RubySpark::ConfigurationError)
|
116
116
|
end
|
117
117
|
|
118
118
|
VCR.use_cassette("no_token") do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_spark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eli Fatsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,10 +122,10 @@ files:
|
|
122
122
|
- Rakefile
|
123
123
|
- examples/core_example.rb
|
124
124
|
- examples/tinker_example.rb
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
125
|
+
- lib/ruby_spark.rb
|
126
|
+
- lib/ruby_spark/core.rb
|
127
|
+
- lib/ruby_spark/tinker.rb
|
128
|
+
- lib/ruby_spark/version.rb
|
129
129
|
- ruby_spark.gemspec
|
130
130
|
- spec/fixtures/vcr_cassettes/analog_read.yml
|
131
131
|
- spec/fixtures/vcr_cassettes/analog_write.yml
|