homeflow_api 0.17.1 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -0
- data/Guardfile +24 -0
- data/VERSION +1 -1
- data/homeflow_api.gemspec +2 -1
- data/lib/homeflow/api.rb +2 -1
- data/lib/homeflow/api/request.rb +8 -10
- data/spec/homeflow_api_spec.rb +8 -3
- data/spec/query_spec.rb +1 -1
- metadata +3 -2
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,8 +6,19 @@ GEM
|
|
6
6
|
multi_json (~> 1.0)
|
7
7
|
bourne (1.1.2)
|
8
8
|
mocha (= 0.10.5)
|
9
|
+
coderay (1.0.9)
|
9
10
|
diff-lcs (1.1.3)
|
11
|
+
ffi (1.8.1)
|
12
|
+
formatador (0.2.4)
|
10
13
|
git (1.2.5)
|
14
|
+
guard (1.8.0)
|
15
|
+
formatador (>= 0.2.4)
|
16
|
+
listen (>= 1.0.0)
|
17
|
+
lumberjack (>= 1.0.2)
|
18
|
+
pry (>= 0.9.10)
|
19
|
+
thor (>= 0.14.6)
|
20
|
+
guard-rspec (1.2.1)
|
21
|
+
guard (>= 1.1)
|
11
22
|
hashie (1.2.0)
|
12
23
|
httparty (0.9.0)
|
13
24
|
multi_json (~> 1.0)
|
@@ -18,12 +29,27 @@ GEM
|
|
18
29
|
git (>= 1.2.5)
|
19
30
|
rake
|
20
31
|
json (1.7.5)
|
32
|
+
listen (1.1.6)
|
33
|
+
rb-fsevent (>= 0.9.3)
|
34
|
+
rb-inotify (>= 0.9)
|
35
|
+
rb-kqueue (>= 0.2)
|
36
|
+
lumberjack (1.0.3)
|
21
37
|
metaclass (0.0.1)
|
38
|
+
method_source (0.8.1)
|
22
39
|
mocha (0.10.5)
|
23
40
|
metaclass (~> 0.0.1)
|
24
41
|
multi_json (1.4.0)
|
25
42
|
multi_xml (0.5.1)
|
43
|
+
pry (0.9.12.2)
|
44
|
+
coderay (~> 1.0.5)
|
45
|
+
method_source (~> 0.8)
|
46
|
+
slop (~> 3.4)
|
26
47
|
rake (10.0.4)
|
48
|
+
rb-fsevent (0.9.3)
|
49
|
+
rb-inotify (0.9.0)
|
50
|
+
ffi (>= 0.5.0)
|
51
|
+
rb-kqueue (0.2.0)
|
52
|
+
ffi (>= 0.5.0)
|
27
53
|
rspec (2.12.0)
|
28
54
|
rspec-core (~> 2.12.0)
|
29
55
|
rspec-expectations (~> 2.12.0)
|
@@ -39,13 +65,17 @@ GEM
|
|
39
65
|
shoulda-matchers (1.4.2)
|
40
66
|
activesupport (>= 3.0.0)
|
41
67
|
bourne (~> 1.1.2)
|
68
|
+
slop (3.4.5)
|
42
69
|
test-unit (2.5.3)
|
70
|
+
thor (0.18.1)
|
43
71
|
|
44
72
|
PLATFORMS
|
45
73
|
ruby
|
46
74
|
|
47
75
|
DEPENDENCIES
|
48
76
|
bundler
|
77
|
+
guard
|
78
|
+
guard-rspec
|
49
79
|
hashie (~> 1.1)
|
50
80
|
httparty
|
51
81
|
jeweler (~> 1.6.4)
|
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara request specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.
|
1
|
+
0.17.3
|
data/homeflow_api.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "homeflow_api"
|
8
|
-
s.version = "0.17.
|
8
|
+
s.version = "0.17.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Cooper"]
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
".document",
|
21
21
|
"Gemfile",
|
22
22
|
"Gemfile.lock",
|
23
|
+
"Guardfile",
|
23
24
|
"LICENSE.txt",
|
24
25
|
"README.rdoc",
|
25
26
|
"Rakefile",
|
data/lib/homeflow/api.rb
CHANGED
@@ -61,12 +61,13 @@ module Homeflow
|
|
61
61
|
|
62
62
|
# A configuration instance
|
63
63
|
class Configuration
|
64
|
-
attr_accessor :api_key, :source, :show_debug
|
64
|
+
attr_accessor :api_key, :source, :show_debug, :logger
|
65
65
|
|
66
66
|
def initialize
|
67
67
|
@api_key = 'API_KEY_REQUIRED'
|
68
68
|
@source = 'http://localhost:3000'
|
69
69
|
@show_debug = false
|
70
|
+
@logger = nil
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
data/lib/homeflow/api/request.rb
CHANGED
@@ -26,16 +26,14 @@ module Homeflow
|
|
26
26
|
end
|
27
27
|
query_params = @request_specification.to_params.merge(constant_params)
|
28
28
|
post_params = (@request_specification.respond_to?(:post_params) ? @request_specification.post_params : {})
|
29
|
-
if Homeflow::API.config.show_debug
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
puts "@request_specification:\n#{@request_specification.to_json}\n"
|
38
|
-
puts "****************************************************************************************"
|
29
|
+
if Homeflow::API.config.show_debug && Homeflow::API.configuration.logger
|
30
|
+
log_line = []
|
31
|
+
log_line << "Destination - #{url}"
|
32
|
+
log_line << "Request params:\n#{query_params.to_json}\n"
|
33
|
+
log_line << "Post params:\n#{post_params.to_json}\n"
|
34
|
+
log_line << "request_specification:\n#{request_specification.to_json}\n"
|
35
|
+
log_line << "@request_specification:\n#{@request_specification.to_json}\n"
|
36
|
+
Homeflow::API.configuration.logger.info(log_line.join("\n"))
|
39
37
|
end
|
40
38
|
|
41
39
|
if request_specification.is_a? Query
|
data/spec/homeflow_api_spec.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'logger'
|
2
3
|
describe Homeflow::API do
|
3
4
|
|
4
5
|
context "when setting up" do
|
5
6
|
|
6
7
|
it "should provide a config block" do
|
7
|
-
|
8
8
|
Homeflow::API.configure do |config|
|
9
9
|
config.api_key = "test api key"
|
10
10
|
end
|
11
|
-
|
12
11
|
Homeflow::API.configuration.api_key.should == "test api key"
|
13
|
-
|
14
12
|
end
|
15
13
|
|
16
14
|
it "should provide setters" do
|
@@ -18,5 +16,12 @@ describe Homeflow::API do
|
|
18
16
|
Homeflow::API.configuration.api_key.should == "test api key"
|
19
17
|
end
|
20
18
|
|
19
|
+
it "should provide a logger" do
|
20
|
+
Homeflow::API.configure do |config|
|
21
|
+
config.api_key = "test api key"
|
22
|
+
config.logger = Logger.new('log.log')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
21
26
|
end
|
22
27
|
end
|
data/spec/query_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Homeflow::API::Resource do
|
|
23
23
|
context "When inhereted by a class" do
|
24
24
|
|
25
25
|
it "should cause the implementing class to recive a message when find is called" do
|
26
|
-
data =
|
26
|
+
data = File.read(File.dirname(__FILE__) + '/data/property_details.json')
|
27
27
|
Homeflow::API::Request.any_instance.should_receive(:perform).and_return(data)
|
28
28
|
property = Homeflow::API::Property.find(2).property
|
29
29
|
property.class.should == Homeflow::API::Property
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homeflow_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- .document
|
119
119
|
- Gemfile
|
120
120
|
- Gemfile.lock
|
121
|
+
- Guardfile
|
121
122
|
- LICENSE.txt
|
122
123
|
- README.rdoc
|
123
124
|
- Rakefile
|
@@ -177,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
178
|
version: '0'
|
178
179
|
segments:
|
179
180
|
- 0
|
180
|
-
hash:
|
181
|
+
hash: 1464991823187094903
|
181
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
183
|
none: false
|
183
184
|
requirements:
|