freckly 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +15 -10
- data/freckly.gemspec +2 -2
- data/lib/freckly.rb +4 -2
- data/lib/freckly/entry.rb +5 -12
- data/lib/freckly/project.rb +1 -1
- data/lib/freckly/version.rb +1 -1
- data/spec/freckly/entry_spec.rb +20 -6
- data/spec/freckly/project_spec.rb +6 -2
- metadata +18 -34
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,18 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/railslove/faraday.git
|
3
|
+
revision: 1c4337bfd46a0a524ec510daf8d9ab21df645767
|
4
|
+
branch: hacking
|
5
|
+
specs:
|
6
|
+
faraday (0.5.3)
|
7
|
+
addressable (~> 2.2.2)
|
8
|
+
multipart-post (~> 1.0.1)
|
9
|
+
rack (>= 1.1.0, < 2)
|
10
|
+
|
1
11
|
PATH
|
2
12
|
remote: .
|
3
13
|
specs:
|
4
14
|
freckly (0.0.2)
|
5
|
-
|
6
|
-
faraday_middleware (~> 0.2.1)
|
15
|
+
faraday_middleware (~> 0.3.0)
|
7
16
|
hashie (~> 0.4.0)
|
8
17
|
multi_xml (~> 0.2.0)
|
9
18
|
|
@@ -13,12 +22,8 @@ GEM
|
|
13
22
|
addressable (2.2.2)
|
14
23
|
crack (0.1.8)
|
15
24
|
diff-lcs (1.1.2)
|
16
|
-
|
17
|
-
|
18
|
-
multipart-post (~> 1.0.1)
|
19
|
-
rack (>= 1.1.0, < 2)
|
20
|
-
faraday_middleware (0.2.1)
|
21
|
-
faraday (~> 0.5.1)
|
25
|
+
faraday_middleware (0.3.0)
|
26
|
+
faraday (~> 0.5.3)
|
22
27
|
hashie (0.4.0)
|
23
28
|
multi_xml (0.2.0)
|
24
29
|
multipart-post (1.0.1)
|
@@ -40,8 +45,8 @@ PLATFORMS
|
|
40
45
|
ruby
|
41
46
|
|
42
47
|
DEPENDENCIES
|
43
|
-
faraday
|
44
|
-
faraday_middleware (~> 0.
|
48
|
+
faraday!
|
49
|
+
faraday_middleware (~> 0.3.0)
|
45
50
|
freckly!
|
46
51
|
hashie (~> 0.4.0)
|
47
52
|
multi_xml (~> 0.2.0)
|
data/freckly.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.rubyforge_project = "freckly"
|
16
16
|
|
17
|
-
s.add_dependency "faraday", "~> 0.5.3"
|
18
|
-
s.add_dependency "faraday_middleware", "~> 0.
|
17
|
+
#s.add_dependency "faraday", "~> 0.5.3"
|
18
|
+
s.add_dependency "faraday_middleware", "~> 0.3.0"
|
19
19
|
s.add_dependency "multi_xml", "~> 0.2.0"
|
20
20
|
s.add_dependency "hashie", "~> 0.4.0"
|
21
21
|
|
data/lib/freckly.rb
CHANGED
@@ -15,7 +15,7 @@ module Freckly
|
|
15
15
|
attr_accessor :token, :subdomain
|
16
16
|
|
17
17
|
def authed_get(path, options={})
|
18
|
-
|
18
|
+
authed_connection.get do |request|
|
19
19
|
request.url(path, options)
|
20
20
|
end.body
|
21
21
|
end
|
@@ -25,7 +25,9 @@ module Freckly
|
|
25
25
|
:user_agent => "Freckly",
|
26
26
|
"X-FreckleToken" => token
|
27
27
|
}
|
28
|
-
@connection ||= Faraday::Connection.new(:url => "
|
28
|
+
@connection ||= Faraday::Connection.new(:url => "https://#{subdomain}.letsfreckle.com",
|
29
|
+
:headers => headers,
|
30
|
+
:ssl => {:verify => false}) do |builder|
|
29
31
|
builder.adapter Faraday.default_adapter
|
30
32
|
builder.use Faraday::Response::ParseXml
|
31
33
|
builder.use Faraday::Response::Mashify
|
data/lib/freckly/entry.rb
CHANGED
@@ -2,20 +2,13 @@ module Freckly
|
|
2
2
|
class Entry
|
3
3
|
class << self
|
4
4
|
def all(options={})
|
5
|
-
|
6
|
-
Freckly.authed_get("/api/entries.xml", options)[:entries].map {|entry| new(entry) }
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
5
|
+
results = Freckly.authed_get("/api/entries.xml", :search => options)
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
params[key] = value.join(",")
|
7
|
+
if entries = results[:entries]
|
8
|
+
entries.map {|entry| new(entry) }
|
9
|
+
else
|
10
|
+
[]
|
16
11
|
end
|
17
|
-
|
18
|
-
params
|
19
12
|
end
|
20
13
|
end
|
21
14
|
|
data/lib/freckly/project.rb
CHANGED
data/lib/freckly/version.rb
CHANGED
data/spec/freckly/entry_spec.rb
CHANGED
@@ -16,21 +16,35 @@ describe Freckly::Entry do
|
|
16
16
|
describe "the request" do
|
17
17
|
subject { WebMock::API }
|
18
18
|
|
19
|
-
it { should have_requested(:get, "
|
19
|
+
it { should have_requested(:get, "https://test.letsfreckle.com/api/entries.xml").with(:headers => {"X-FreckleToken" => "aaa"},
|
20
|
+
:query => {:search => {
|
21
|
+
:projects => "123,192"}
|
22
|
+
}) }
|
20
23
|
end
|
21
24
|
|
22
|
-
|
23
|
-
|
25
|
+
context "when returning something" do
|
26
|
+
describe "the response" do
|
27
|
+
subject { @response }
|
24
28
|
|
25
|
-
|
29
|
+
it { should be_a(Array) }
|
30
|
+
|
31
|
+
its(:first) { should be_a(Freckly::Entry) }
|
32
|
+
end
|
33
|
+
end
|
26
34
|
|
27
|
-
|
35
|
+
context "when returning nothing" do
|
36
|
+
before { stub_request(:any, /entries/) }
|
37
|
+
|
38
|
+
subject { Freckly::Entry.all(:projects => %w{123 192}) }
|
39
|
+
|
40
|
+
it { should be_a(Array) }
|
41
|
+
it { should be_empty }
|
28
42
|
end
|
29
43
|
end
|
30
44
|
end
|
31
45
|
|
32
46
|
describe "Initialization" do
|
33
|
-
let(:entry) { Freckly::Entry.
|
47
|
+
let(:entry) { Freckly::Entry.all(:projects => 123).first }
|
34
48
|
subject { entry }
|
35
49
|
|
36
50
|
its(:billable) { should be_true }
|
@@ -13,7 +13,7 @@ describe Freckly::Project do
|
|
13
13
|
before { Freckly::Project.all }
|
14
14
|
subject { WebMock }
|
15
15
|
|
16
|
-
it { should have_requested(:get, "
|
16
|
+
it { should have_requested(:get, "https://test.letsfreckle.com/api/projects.xml").with(:headers => {"X-FreckleToken" => "aaa"}) }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "the response" do
|
@@ -36,7 +36,11 @@ describe Freckly::Project do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "#entries" do
|
39
|
-
before
|
39
|
+
before do
|
40
|
+
stub_request(:any, /entries/).to_return(:body => fixture("entries.xml"))
|
41
|
+
Freckly::Entry.stub!(:find_all_for_project).and_return([mock])
|
42
|
+
end
|
43
|
+
|
40
44
|
let(:project) { Freckly::Project.all.first }
|
41
45
|
|
42
46
|
subject { project.entries }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freckly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Davis
|
@@ -15,45 +15,29 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-16 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: faraday_middleware
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 19
|
30
30
|
segments:
|
31
31
|
- 0
|
32
|
-
- 5
|
33
32
|
- 3
|
34
|
-
version: 0.5.3
|
35
|
-
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: faraday_middleware
|
39
|
-
prerelease: false
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 21
|
46
|
-
segments:
|
47
33
|
- 0
|
48
|
-
|
49
|
-
- 1
|
50
|
-
version: 0.2.1
|
34
|
+
version: 0.3.0
|
51
35
|
type: :runtime
|
52
|
-
version_requirements: *
|
36
|
+
version_requirements: *id001
|
53
37
|
- !ruby/object:Gem::Dependency
|
54
38
|
name: multi_xml
|
55
39
|
prerelease: false
|
56
|
-
requirement: &
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
42
|
requirements:
|
59
43
|
- - ~>
|
@@ -65,11 +49,11 @@ dependencies:
|
|
65
49
|
- 0
|
66
50
|
version: 0.2.0
|
67
51
|
type: :runtime
|
68
|
-
version_requirements: *
|
52
|
+
version_requirements: *id002
|
69
53
|
- !ruby/object:Gem::Dependency
|
70
54
|
name: hashie
|
71
55
|
prerelease: false
|
72
|
-
requirement: &
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
59
|
- - ~>
|
@@ -81,11 +65,11 @@ dependencies:
|
|
81
65
|
- 0
|
82
66
|
version: 0.4.0
|
83
67
|
type: :runtime
|
84
|
-
version_requirements: *
|
68
|
+
version_requirements: *id003
|
85
69
|
- !ruby/object:Gem::Dependency
|
86
70
|
name: rspec
|
87
71
|
prerelease: false
|
88
|
-
requirement: &
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
89
73
|
none: false
|
90
74
|
requirements:
|
91
75
|
- - ~>
|
@@ -97,11 +81,11 @@ dependencies:
|
|
97
81
|
- 0
|
98
82
|
version: 2.1.0
|
99
83
|
type: :development
|
100
|
-
version_requirements: *
|
84
|
+
version_requirements: *id004
|
101
85
|
- !ruby/object:Gem::Dependency
|
102
86
|
name: webmock
|
103
87
|
prerelease: false
|
104
|
-
requirement: &
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
105
89
|
none: false
|
106
90
|
requirements:
|
107
91
|
- - ~>
|
@@ -113,11 +97,11 @@ dependencies:
|
|
113
97
|
- 1
|
114
98
|
version: 1.6.1
|
115
99
|
type: :development
|
116
|
-
version_requirements: *
|
100
|
+
version_requirements: *id005
|
117
101
|
- !ruby/object:Gem::Dependency
|
118
102
|
name: rake
|
119
103
|
prerelease: false
|
120
|
-
requirement: &
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
121
105
|
none: false
|
122
106
|
requirements:
|
123
107
|
- - ~>
|
@@ -129,7 +113,7 @@ dependencies:
|
|
129
113
|
- 7
|
130
114
|
version: 0.8.7
|
131
115
|
type: :development
|
132
|
-
version_requirements: *
|
116
|
+
version_requirements: *id006
|
133
117
|
description: Wrapper for Freckle
|
134
118
|
email:
|
135
119
|
- red@railslove.com
|