ruby_spark 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +1 -0
- data/lib/ruby_spark/core.rb +6 -2
- data/lib/ruby_spark/helpers/configuration.rb +33 -0
- data/lib/ruby_spark/version.rb +1 -1
- data/lib/ruby_spark.rb +4 -7
- data/ruby_spark.gemspec +6 -6
- data/spec/fixtures/vcr_cassettes/bad_core_id.yml +9 -12
- data/spec/fixtures/vcr_cassettes/bad_token.yml +10 -14
- data/spec/fixtures/vcr_cassettes/function.yml +35 -0
- data/spec/fixtures/vcr_cassettes/info.yml +36 -0
- data/spec/fixtures/vcr_cassettes/spark_timeout.yml +12 -15
- data/spec/fixtures/vcr_cassettes/variable.yml +37 -0
- data/spec/spark/core_spec.rb +105 -0
- metadata +38 -31
- data/spec/fixtures/vcr_cassettes/no_token.yml +0 -39
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NjFkMjAzNmY1NzIzMTVjMTIwYWRiYjc2NThhOWZkOTIwMDRmMDVlMg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7f147c684f6fb7473b04b4f6aac6089f93bef71b
|
4
|
+
data.tar.gz: 62ac1c2b712e27e5d4b79c559dd13612113247ba
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Mzg1M2M5Y2YzNWNiMDRhNzM2ZjFjMDAyYjYzYWNhMDcwNzg5MDhhMTg0OGQy
|
11
|
-
ODM1OWQ1NDQ4NWZiMzBlYWEwNTQ0OTIzMzIzYTZiZjM3OTQ0OTI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzI0MzA3YzI3NjRjZGEzNWQ3NWQyODMwZTUwMDRiNmVmNGJmYjFkNzUwODA0
|
14
|
-
ZmQ1MTM5ZTk2NTkwODUzMTA3Y2EwZmQ4NzE0MWQ1NzYwYzllYzJhNmFiYjc4
|
15
|
-
NTVlZDU2NDY5NjRhYmJlNDMxZDliZDgyNmMwMTViYWRkYWEyYTQ=
|
6
|
+
metadata.gz: 4903c3db3b4d4ca770f6c717f05a03d3a1102d24111b079c4fec85a2020979677acb2e2dc366787fa19cf9d03e6fca1dda2450f6b5d69c9608d8d6be8f10c25c
|
7
|
+
data.tar.gz: 9146be81e0c787d70fb4cb57b336d04e0a10d3d2e502bc67c761e7ad54cb46b91c2f9bfd6b7267d44c8a9f9aa252ae5ba8897ff4737dfc14a1728af478cc8398
|
data/README.md
CHANGED
data/lib/ruby_spark/core.rb
CHANGED
@@ -37,14 +37,14 @@ module RubySpark
|
|
37
37
|
url = base_url + action
|
38
38
|
body = access_params.merge(params)
|
39
39
|
|
40
|
-
HTTParty.post(url, :body => body).parsed_response
|
40
|
+
HTTParty.post(url, :body => body, :timeout => timeout).parsed_response
|
41
41
|
end
|
42
42
|
|
43
43
|
def get(action, params = {})
|
44
44
|
url = base_url + action
|
45
45
|
query = access_params.merge(params)
|
46
46
|
|
47
|
-
HTTParty.get(url, :query => query).parsed_response
|
47
|
+
HTTParty.get(url, :query => query, :timeout => timeout).parsed_response
|
48
48
|
end
|
49
49
|
|
50
50
|
def handle(response, &block)
|
@@ -70,6 +70,10 @@ module RubySpark
|
|
70
70
|
def access_params
|
71
71
|
{:access_token => @access_token}
|
72
72
|
end
|
73
|
+
|
74
|
+
def timeout
|
75
|
+
RubySpark.timeout
|
76
|
+
end
|
73
77
|
end
|
74
78
|
|
75
79
|
end
|
@@ -0,0 +1,33 @@
|
|
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
|
data/lib/ruby_spark/version.rb
CHANGED
data/lib/ruby_spark.rb
CHANGED
@@ -3,16 +3,13 @@ require 'httparty'
|
|
3
3
|
require 'ruby_spark/version'
|
4
4
|
require 'ruby_spark/core'
|
5
5
|
require 'ruby_spark/tinker'
|
6
|
+
require 'ruby_spark/helpers/configuration'
|
6
7
|
|
7
8
|
module RubySpark
|
8
9
|
class ConfigurationError < StandardError; end
|
9
10
|
|
10
|
-
|
11
|
-
attr_accessor :access_token
|
12
|
-
|
13
|
-
def configuration
|
14
|
-
yield self
|
15
|
-
end
|
16
|
-
end
|
11
|
+
include Configuration
|
17
12
|
|
13
|
+
define_setting :access_token
|
14
|
+
define_setting :timeout, 30
|
18
15
|
end
|
data/ruby_spark.gemspec
CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^spec/})
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
-
spec.add_development_dependency "rake"
|
22
|
-
spec.add_development_dependency "rspec"
|
23
|
-
spec.add_development_dependency "vcr"
|
24
|
-
spec.add_development_dependency "webmock"
|
25
|
-
spec.add_development_dependency "pry"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
22
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
23
|
+
spec.add_development_dependency "vcr", "~> 2.5"
|
24
|
+
spec.add_development_dependency "webmock", "~> 1.11"
|
25
|
+
spec.add_development_dependency "pry", "~> 0.9"
|
26
26
|
|
27
|
-
spec.add_dependency "httparty"
|
27
|
+
spec.add_dependency "httparty", "~> 0.13"
|
28
28
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://api.spark.io/v1/devices/bad_core_id
|
4
|
+
method: get
|
5
|
+
uri: https://api.spark.io/v1/devices/bad_core_id/?access_token=good_access_token
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
9
|
headers: {}
|
10
10
|
response:
|
11
11
|
status:
|
@@ -13,11 +13,11 @@ http_interactions:
|
|
13
13
|
message: Forbidden
|
14
14
|
headers:
|
15
15
|
Access-Control-Allow-Origin:
|
16
|
-
- '*'
|
16
|
+
- ! '*'
|
17
17
|
Content-Type:
|
18
18
|
- application/json; charset=utf-8
|
19
19
|
Date:
|
20
|
-
-
|
20
|
+
- Thu, 20 Feb 2014 21:50:42 GMT
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.2
|
23
23
|
X-Powered-By:
|
@@ -27,11 +27,8 @@ http_interactions:
|
|
27
27
|
Connection:
|
28
28
|
- keep-alive
|
29
29
|
body:
|
30
|
-
encoding:
|
31
|
-
string:
|
32
|
-
{
|
33
|
-
"error": "Permission Denied"
|
34
|
-
}
|
30
|
+
encoding: US-ASCII
|
31
|
+
string: ! "{\n \"error\": \"Permission Denied\"\n}"
|
35
32
|
http_version:
|
36
|
-
recorded_at:
|
33
|
+
recorded_at: Thu, 20 Feb 2014 21:50:42 GMT
|
37
34
|
recorded_with: VCR 2.5.0
|
@@ -1,11 +1,11 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://api.spark.io/v1/devices/good_core_id
|
4
|
+
method: get
|
5
|
+
uri: https://api.spark.io/v1/devices/good_core_id/?access_token=bad_token
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
9
|
headers: {}
|
10
10
|
response:
|
11
11
|
status:
|
@@ -13,11 +13,11 @@ http_interactions:
|
|
13
13
|
message: Bad Request
|
14
14
|
headers:
|
15
15
|
Access-Control-Allow-Origin:
|
16
|
-
- '*'
|
16
|
+
- ! '*'
|
17
17
|
Content-Type:
|
18
18
|
- application/json; charset=utf-8
|
19
19
|
Date:
|
20
|
-
-
|
20
|
+
- Thu, 20 Feb 2014 21:47:57 GMT
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.2
|
23
23
|
X-Powered-By:
|
@@ -27,13 +27,9 @@ http_interactions:
|
|
27
27
|
Connection:
|
28
28
|
- keep-alive
|
29
29
|
body:
|
30
|
-
encoding:
|
31
|
-
string:
|
32
|
-
|
33
|
-
"code": 400,
|
34
|
-
"error": "invalid_grant",
|
35
|
-
"error_description": "The access token provided is invalid."
|
36
|
-
}
|
30
|
+
encoding: US-ASCII
|
31
|
+
string: ! "{\n \"code\": 400,\n \"error\": \"invalid_grant\",\n \"error_description\":
|
32
|
+
\"The access token provided is invalid.\"\n}"
|
37
33
|
http_version:
|
38
|
-
recorded_at:
|
34
|
+
recorded_at: Thu, 20 Feb 2014 21:47:57 GMT
|
39
35
|
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.spark.io/v1/devices/good_core_id/readTemp
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: access_token=good_access_token¶ms=outside
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Access-Control-Allow-Origin:
|
16
|
+
- ! '*'
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Thu, 20 Feb 2014 21:45:09 GMT
|
21
|
+
Server:
|
22
|
+
- nginx/1.4.2
|
23
|
+
X-Powered-By:
|
24
|
+
- Express
|
25
|
+
Content-Length:
|
26
|
+
- '121'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
body:
|
30
|
+
encoding: US-ASCII
|
31
|
+
string: ! "{\n \"id\": \"good_core_id\",\n \"name\": \"chippy\",\n
|
32
|
+
\ \"last_app\": null,\n \"connected\": true,\n \"return_value\": 72\n}"
|
33
|
+
http_version:
|
34
|
+
recorded_at: Thu, 20 Feb 2014 21:45:09 GMT
|
35
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.spark.io/v1/devices/good_core_id/?access_token=good_access_token
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Access-Control-Allow-Origin:
|
16
|
+
- ! '*'
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Thu, 20 Feb 2014 21:43:08 GMT
|
21
|
+
Server:
|
22
|
+
- nginx/1.4.2
|
23
|
+
X-Powered-By:
|
24
|
+
- Express
|
25
|
+
Content-Length:
|
26
|
+
- '144'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
body:
|
30
|
+
encoding: US-ASCII
|
31
|
+
string: ! "{\n \"id\": \"good_core_id\",\n \"name\": \"chippy\",\n
|
32
|
+
\ \"variables\": {\n \"temperature\": \"int32\"\n },\n \"functions\":
|
33
|
+
[\n \"readTemp\"\n ]\n}"
|
34
|
+
http_version:
|
35
|
+
recorded_at: Thu, 20 Feb 2014 21:43:07 GMT
|
36
|
+
recorded_with: VCR 2.5.0
|
@@ -1,37 +1,34 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://api.spark.io/v1/devices/good_core_id
|
4
|
+
method: get
|
5
|
+
uri: https://api.spark.io/v1/devices/good_core_id/?access_token=good_access_token
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
9
|
headers: {}
|
10
10
|
response:
|
11
11
|
status:
|
12
|
-
code:
|
13
|
-
message:
|
12
|
+
code: 403
|
13
|
+
message: Forbidden
|
14
14
|
headers:
|
15
15
|
Access-Control-Allow-Origin:
|
16
|
-
- '*'
|
16
|
+
- ! '*'
|
17
17
|
Content-Type:
|
18
18
|
- application/json; charset=utf-8
|
19
19
|
Date:
|
20
|
-
-
|
20
|
+
- Thu, 20 Feb 2014 21:50:42 GMT
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.2
|
23
23
|
X-Powered-By:
|
24
24
|
- Express
|
25
25
|
Content-Length:
|
26
|
-
- '
|
26
|
+
- '34'
|
27
27
|
Connection:
|
28
28
|
- keep-alive
|
29
29
|
body:
|
30
|
-
encoding:
|
31
|
-
string:
|
32
|
-
{
|
33
|
-
"error": "Timed out."
|
34
|
-
}
|
30
|
+
encoding: US-ASCII
|
31
|
+
string: ! "{\n \"error\": \"Timed out.\"\n}"
|
35
32
|
http_version:
|
36
|
-
recorded_at:
|
33
|
+
recorded_at: Thu, 20 Feb 2014 21:50:42 GMT
|
37
34
|
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.spark.io/v1/devices/good_core_id/temperature?access_token=good_access_token
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Access-Control-Allow-Origin:
|
16
|
+
- ! '*'
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Thu, 20 Feb 2014 21:44:49 GMT
|
21
|
+
Server:
|
22
|
+
- nginx/1.4.2
|
23
|
+
X-Powered-By:
|
24
|
+
- Express
|
25
|
+
Content-Length:
|
26
|
+
- '218'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
body:
|
30
|
+
encoding: US-ASCII
|
31
|
+
string: ! "{\n \"cmd\": \"VarReturn\",\n \"name\": \"temperature\",\n \"result\":
|
32
|
+
70,\n \"coreInfo\": {\n \"last_app\": \"\",\n \"last_heard\": \"2014-02-20T21:44:49.566Z\",\n
|
33
|
+
\ \"connected\": true,\n \"deviceID\": \"good_core_id\"\n
|
34
|
+
\ }\n}"
|
35
|
+
http_version:
|
36
|
+
recorded_at: Thu, 20 Feb 2014 21:44:49 GMT
|
37
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
describe RubySpark::Core do
|
5
|
+
|
6
|
+
context "when things go right" do
|
7
|
+
before { RubySpark.access_token = "good_access_token" }
|
8
|
+
subject { described_class.new("good_core_id") }
|
9
|
+
|
10
|
+
describe "#info" do
|
11
|
+
it "succeeds when Access Token and Core ID are correct" do
|
12
|
+
VCR.use_cassette("info") do
|
13
|
+
info = subject.info
|
14
|
+
|
15
|
+
info.should be_a Hash
|
16
|
+
info.keys.should =~ ["id", "name", "variables", "functions"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#variable" do
|
22
|
+
it "succeeds when Access Token and Core ID are correct" do
|
23
|
+
VCR.use_cassette("variable") do
|
24
|
+
subject.variable("temperature").should == 70
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#function" do
|
30
|
+
it "succeeds when Access Token and Core ID are correct" do
|
31
|
+
VCR.use_cassette("function") do
|
32
|
+
subject.function("readTemp", "outside").should == 72
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when things go wrong" do
|
39
|
+
it "returns the appropriate error when Access Token is bad" do
|
40
|
+
RubySpark.access_token = "bad_token"
|
41
|
+
subject = described_class.new("good_core_id")
|
42
|
+
|
43
|
+
VCR.use_cassette("bad_token") do
|
44
|
+
expect {
|
45
|
+
subject.info
|
46
|
+
}.to raise_error(RubySpark::Core::ApiError)
|
47
|
+
end
|
48
|
+
|
49
|
+
VCR.use_cassette("bad_token") do
|
50
|
+
begin
|
51
|
+
subject.info
|
52
|
+
rescue => e
|
53
|
+
e.message.should == "invalid_grant: The access token provided is invalid."
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "returns proper error if Access Token is not defined" do
|
59
|
+
RubySpark.access_token = nil
|
60
|
+
|
61
|
+
expect {
|
62
|
+
subject = described_class.new("good_core_id")
|
63
|
+
}.to raise_error(RubySpark::ConfigurationError)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "returns the appropriate error when Core ID is bad" do
|
67
|
+
RubySpark.access_token = "good_access_token"
|
68
|
+
subject = described_class.new("bad_core_id")
|
69
|
+
|
70
|
+
VCR.use_cassette("bad_core_id") do
|
71
|
+
expect {
|
72
|
+
subject.info
|
73
|
+
}.to raise_error(RubySpark::Core::ApiError)
|
74
|
+
end
|
75
|
+
|
76
|
+
VCR.use_cassette("bad_core_id") do
|
77
|
+
begin
|
78
|
+
subject.info
|
79
|
+
rescue => e
|
80
|
+
e.message.should == "Permission Denied: Invalid Core ID"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it "returns the appropriate error when the Spark API times out" do
|
86
|
+
RubySpark.access_token = "good_access_token"
|
87
|
+
subject = described_class.new("good_core_id")
|
88
|
+
|
89
|
+
VCR.use_cassette("spark_timeout") do
|
90
|
+
expect {
|
91
|
+
subject.info
|
92
|
+
}.to raise_error(RubySpark::Core::ApiError)
|
93
|
+
end
|
94
|
+
|
95
|
+
VCR.use_cassette("spark_timeout") do
|
96
|
+
begin
|
97
|
+
subject.info
|
98
|
+
rescue => e
|
99
|
+
e.message.should == "Timed out."
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
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: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eli Fatsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,86 +28,86 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '
|
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
|
-
version: '0'
|
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
|
-
version: '0'
|
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
|
-
version: '0'
|
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
|
-
version: '0'
|
110
|
+
version: '0.13'
|
111
111
|
description: Ruby Gem to make API calls to the Spark Cloud
|
112
112
|
email:
|
113
113
|
- eli.fatsi@viget.com
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- examples/tinker_example.rb
|
125
125
|
- lib/ruby_spark.rb
|
126
126
|
- lib/ruby_spark/core.rb
|
127
|
+
- lib/ruby_spark/helpers/configuration.rb
|
127
128
|
- lib/ruby_spark/tinker.rb
|
128
129
|
- lib/ruby_spark/version.rb
|
129
130
|
- ruby_spark.gemspec
|
@@ -133,8 +134,11 @@ files:
|
|
133
134
|
- spec/fixtures/vcr_cassettes/bad_token.yml
|
134
135
|
- spec/fixtures/vcr_cassettes/digital_read.yml
|
135
136
|
- spec/fixtures/vcr_cassettes/digital_write.yml
|
136
|
-
- spec/fixtures/vcr_cassettes/
|
137
|
+
- spec/fixtures/vcr_cassettes/function.yml
|
138
|
+
- spec/fixtures/vcr_cassettes/info.yml
|
137
139
|
- spec/fixtures/vcr_cassettes/spark_timeout.yml
|
140
|
+
- spec/fixtures/vcr_cassettes/variable.yml
|
141
|
+
- spec/spark/core_spec.rb
|
138
142
|
- spec/spark/tinker_spec.rb
|
139
143
|
- spec/spec_helper.rb
|
140
144
|
homepage: http://github.com/efatsi/ruby_spark
|
@@ -147,17 +151,17 @@ require_paths:
|
|
147
151
|
- lib
|
148
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
153
|
requirements:
|
150
|
-
- -
|
154
|
+
- - '>='
|
151
155
|
- !ruby/object:Gem::Version
|
152
156
|
version: '0'
|
153
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
158
|
requirements:
|
155
|
-
- -
|
159
|
+
- - '>='
|
156
160
|
- !ruby/object:Gem::Version
|
157
161
|
version: '0'
|
158
162
|
requirements: []
|
159
163
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.4.1
|
161
165
|
signing_key:
|
162
166
|
specification_version: 4
|
163
167
|
summary: Ruby Gem to make API calls to the Spark Cloud
|
@@ -168,7 +172,10 @@ test_files:
|
|
168
172
|
- spec/fixtures/vcr_cassettes/bad_token.yml
|
169
173
|
- spec/fixtures/vcr_cassettes/digital_read.yml
|
170
174
|
- spec/fixtures/vcr_cassettes/digital_write.yml
|
171
|
-
- spec/fixtures/vcr_cassettes/
|
175
|
+
- spec/fixtures/vcr_cassettes/function.yml
|
176
|
+
- spec/fixtures/vcr_cassettes/info.yml
|
172
177
|
- spec/fixtures/vcr_cassettes/spark_timeout.yml
|
178
|
+
- spec/fixtures/vcr_cassettes/variable.yml
|
179
|
+
- spec/spark/core_spec.rb
|
173
180
|
- spec/spark/tinker_spec.rb
|
174
181
|
- spec/spec_helper.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://api.spark.io/v1/devices/good_core_id/digitalread
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: access_token=good_access_token¶ms=D6
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 400
|
13
|
-
message: Bad Request
|
14
|
-
headers:
|
15
|
-
Access-Control-Allow-Origin:
|
16
|
-
- '*'
|
17
|
-
Content-Type:
|
18
|
-
- application/json; charset=utf-8
|
19
|
-
Date:
|
20
|
-
- Thu, 26 Dec 2013 17:04:34 GMT
|
21
|
-
Server:
|
22
|
-
- nginx/1.4.2
|
23
|
-
X-Powered-By:
|
24
|
-
- Express
|
25
|
-
Content-Length:
|
26
|
-
- '109'
|
27
|
-
Connection:
|
28
|
-
- keep-alive
|
29
|
-
body:
|
30
|
-
encoding: UTF-8
|
31
|
-
string: |-
|
32
|
-
{
|
33
|
-
"code": 400,
|
34
|
-
"error": "invalid_grant",
|
35
|
-
"error_description": "The access token provided is invalid."
|
36
|
-
}
|
37
|
-
http_version:
|
38
|
-
recorded_at: Thu, 26 Dec 2013 17:04:34 GMT
|
39
|
-
recorded_with: VCR 2.5.0
|