clio_client 0.1.7 → 0.1.8
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.
- checksums.yaml +4 -4
- data/lib/clio_client/api/activity.rb +1 -1
- data/lib/clio_client/api/contact.rb +1 -1
- data/lib/clio_client/version.rb +1 -1
- data/spec/api/activities_spec.rb +22 -0
- data/spec/api/contact_spec.rb +22 -0
- data/spec/support/resource_examples.rb +19 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3763fdcd4ea70e27786db82c37d9643044f398
|
4
|
+
data.tar.gz: cbe52074c3948eba4951afe6ed31b652c123062e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1115013458aa1cea9dcd9a69efc07e1af25fbdbb91f9a4550b9c7a47267e17b9aec4d91f0cefd1bcc68da8151259eb1b70e5726366a3643fce2c5425b9d13f8
|
7
|
+
data.tar.gz: 1e0c7b1f9821ba97ccc6b3c09d3ee4e41497e39dd091f3263729ea7a7de9bf4071a71ebe44779df960c6b336c16315dbfd4c08f0ba383a8666f5d5b7cc62d15a
|
@@ -9,7 +9,7 @@ module ClioClient
|
|
9
9
|
private
|
10
10
|
def data_klass(attributes)
|
11
11
|
accepted_types = %w(TimeEntry ExpenseEntry)
|
12
|
-
type = attributes["type"] ||
|
12
|
+
type = attributes["type"] || attributes[:type]
|
13
13
|
if accepted_types.include? type
|
14
14
|
ClioClient.const_get type
|
15
15
|
else
|
@@ -9,7 +9,7 @@ module ClioClient
|
|
9
9
|
private
|
10
10
|
def data_klass(attributes)
|
11
11
|
accepted_types = %w(Person Company)
|
12
|
-
type = attributes["type"] ||
|
12
|
+
type = attributes["type"] || attributes[:type]
|
13
13
|
if accepted_types.include? type
|
14
14
|
ClioClient.const_get type
|
15
15
|
else
|
data/lib/clio_client/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ClioClient::Api::Activity do
|
4
|
+
let(:session) { double("ClioClient::Api::Session") }
|
5
|
+
subject {
|
6
|
+
ClioClient::Api::Activity.new(session)
|
7
|
+
}
|
8
|
+
|
9
|
+
context "of type TimeEntry" do
|
10
|
+
let(:type_value) { "TimeEntry" }
|
11
|
+
let(:type_klass) { ClioClient::TimeEntry }
|
12
|
+
|
13
|
+
include_examples "typed resource"
|
14
|
+
end
|
15
|
+
|
16
|
+
context "of type ExpenseEntry" do
|
17
|
+
let(:type_value) { "ExpenseEntry" }
|
18
|
+
let(:type_klass) { ClioClient::ExpenseEntry }
|
19
|
+
|
20
|
+
include_examples "typed resource"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ClioClient::Api::Contact do
|
4
|
+
let(:session) { double("ClioClient::Api::Session") }
|
5
|
+
subject {
|
6
|
+
ClioClient::Api::Contact.new(session)
|
7
|
+
}
|
8
|
+
|
9
|
+
context "of type Company" do
|
10
|
+
let(:type_value) { "Company" }
|
11
|
+
let(:type_klass) { ClioClient::Company }
|
12
|
+
include_examples "typed resource"
|
13
|
+
end
|
14
|
+
|
15
|
+
context "of type Person" do
|
16
|
+
let(:type_value) { "Person" }
|
17
|
+
let(:type_klass) { ClioClient::Person }
|
18
|
+
include_examples "typed resource"
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
@@ -80,3 +80,22 @@ shared_examples "model initialization" do
|
|
80
80
|
|
81
81
|
end
|
82
82
|
|
83
|
+
shared_examples "typed resource" do
|
84
|
+
|
85
|
+
it "should accept type key as a string" do
|
86
|
+
verify_type_key( { "type" => type_value } )
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should accept type key as a symbol" do
|
90
|
+
verify_type_key( { type: type_value } )
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
def verify_type_key(attributes)
|
95
|
+
record = subject.new(attributes)
|
96
|
+
expect(record).to be_kind_of type_klass
|
97
|
+
expect(record.type).to eql type_value
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clio_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -176,6 +176,8 @@ files:
|
|
176
176
|
- lib/clio_client/support/reminder.rb
|
177
177
|
- lib/clio_client/support/web_site.rb
|
178
178
|
- lib/clio_client/version.rb
|
179
|
+
- spec/api/activities_spec.rb
|
180
|
+
- spec/api/contact_spec.rb
|
179
181
|
- spec/api/crudable_spec.rb
|
180
182
|
- spec/api/findable_spec.rb
|
181
183
|
- spec/api/listable_spec.rb
|
@@ -240,6 +242,8 @@ signing_key:
|
|
240
242
|
specification_version: 4
|
241
243
|
summary: A simple ruby library to interact with Clio's Api
|
242
244
|
test_files:
|
245
|
+
- spec/api/activities_spec.rb
|
246
|
+
- spec/api/contact_spec.rb
|
243
247
|
- spec/api/crudable_spec.rb
|
244
248
|
- spec/api/findable_spec.rb
|
245
249
|
- spec/api/listable_spec.rb
|