blockspring 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blockspring/version.rb +1 -1
- data/lib/blockspring.rb +34 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 302eceaf4796ab9ca3e0195c35423805ed1864ac
|
4
|
+
data.tar.gz: 28fe7c7021613c6363c2f976cee039268fced591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ae88098f14fd0a23e376215b7187943809e617f20f2c74260cbb20e7309c3e3b388a3e2acfc2d40bd59662bfc22efde76752ff50575ac120bc1cf997c82847d
|
7
|
+
data.tar.gz: 04a3c95352d8fbad28befe81671a62a7c301f3681672f934100e799b51fdef1fc04605f4bf6aca8374190941122bdb28e4077d5f2636f8f84aab255ccc823dfd
|
data/lib/blockspring/version.rb
CHANGED
data/lib/blockspring.rb
CHANGED
@@ -77,18 +77,33 @@ module Blockspring
|
|
77
77
|
return @request
|
78
78
|
end
|
79
79
|
|
80
|
-
def self.run(block, data = {},
|
80
|
+
def self.run(block, data = {}, options = {})
|
81
|
+
if (options.is_a?(String))
|
82
|
+
options = {
|
83
|
+
"api_key" => options,
|
84
|
+
"cache" => false,
|
85
|
+
"expiry" => 0
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
unless (options.has_key?("api_key"))
|
90
|
+
options["api_key"] = nil
|
91
|
+
end
|
92
|
+
|
81
93
|
if !(data.is_a?(Hash))
|
82
94
|
raise "your data needs to be a dictionary."
|
83
95
|
end
|
84
96
|
|
85
97
|
data = data.to_json
|
86
|
-
api_key = api_key || ENV['BLOCKSPRING_API_KEY'] || ""
|
98
|
+
api_key = options["api_key"] || ENV['BLOCKSPRING_API_KEY'] || ""
|
99
|
+
cache = options.has_key?("cache") ? options["cache"] : false
|
100
|
+
expiry = options.has_key?("expiry") ? options["expiry"] : nil
|
101
|
+
|
87
102
|
blockspring_url = ENV['BLOCKSPRING_URL'] || 'https://sender.blockspring.com'
|
88
103
|
block = block.split("/")[-1]
|
89
104
|
|
90
105
|
begin
|
91
|
-
response = RestClient.post "#{blockspring_url}/api_v2/blocks/#{block}?api_key=#{api_key}", data, :content_type => :json
|
106
|
+
response = RestClient.post "#{blockspring_url}/api_v2/blocks/#{block}?api_key=#{api_key}&cache=#{cache}&expiry=#{expiry}", data, :content_type => :json
|
92
107
|
rescue => e
|
93
108
|
response = e.response
|
94
109
|
end
|
@@ -102,18 +117,31 @@ module Blockspring
|
|
102
117
|
end
|
103
118
|
end
|
104
119
|
|
105
|
-
def self.runParsed(block, data = {},
|
120
|
+
def self.runParsed(block, data = {}, options = {})
|
121
|
+
if (options.is_a?(String))
|
122
|
+
options = {
|
123
|
+
"api_key" => options
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
unless (options.has_key?("api_key"))
|
128
|
+
options["api_key"] = nil
|
129
|
+
end
|
130
|
+
|
106
131
|
if !(data.is_a?(Hash))
|
107
132
|
raise "your data needs to be a dictionary."
|
108
133
|
end
|
109
134
|
|
110
135
|
data = data.to_json
|
111
|
-
api_key = api_key || ENV['BLOCKSPRING_API_KEY'] || ""
|
136
|
+
api_key = options["api_key"] || ENV['BLOCKSPRING_API_KEY'] || ""
|
137
|
+
cache = options.has_key?("cache") ? options["cache"] : false
|
138
|
+
expiry = options.has_key?("expiry") ? options["expiry"] : nil
|
139
|
+
|
112
140
|
blockspring_url = ENV['BLOCKSPRING_URL'] || 'https://sender.blockspring.com'
|
113
141
|
block = block.split("/")[-1]
|
114
142
|
|
115
143
|
begin
|
116
|
-
response = RestClient.post "#{blockspring_url}/api_v2/blocks/#{block}?api_key=#{api_key}", data, :content_type => :json
|
144
|
+
response = RestClient.post "#{blockspring_url}/api_v2/blocks/#{block}?api_key=#{api_key}&cache=#{cache}&expiry=#{expiry}", data, :content_type => :json
|
117
145
|
rescue => e
|
118
146
|
response = e.response
|
119
147
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockspring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Pinkus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|