moneybird 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moneybird/client.rb +1 -0
- data/lib/moneybird/resource.rb +5 -1
- data/lib/moneybird/service/contact.rb +5 -1
- data/lib/moneybird/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a71f6c3bf7c67ce566d5e65b601c5d18e088b6e
|
4
|
+
data.tar.gz: 84f430b9085ea231a82d768f8b24e6fab55f1fa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 894f446517bea40ccc38c2dd302f9b6bbbeba66f356ee6f3a9178e3c0efa9deee4f30f4edc11edde696029f1021924e27b61fb6208dec8f4f1d3075e08f4eb58
|
7
|
+
data.tar.gz: cb7727d232e24e1ab5954867562e7623f9b043eac3e4931ad1bcafe6ffbb43ef8302d0c7122505d33d926fa677d68f2655386fd314a7a4655ecfdf52250a1ef8
|
data/lib/moneybird/client.rb
CHANGED
data/lib/moneybird/resource.rb
CHANGED
@@ -15,6 +15,10 @@ module Moneybird
|
|
15
15
|
persisted? ? "/#{id}" : ""
|
16
16
|
end
|
17
17
|
|
18
|
+
def name
|
19
|
+
self.class.name.split('::').last.downcase
|
20
|
+
end
|
21
|
+
|
18
22
|
def attributes=(attributes)
|
19
23
|
@attributes = attributes
|
20
24
|
attributes.each do |attribute, value|
|
@@ -42,7 +46,7 @@ module Moneybird
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def to_json
|
45
|
-
JSON.generate(attributes)
|
49
|
+
JSON.generate({name => attributes})
|
46
50
|
end
|
47
51
|
|
48
52
|
module ClassMethods
|
@@ -18,7 +18,11 @@ module Moneybird::Service
|
|
18
18
|
def find_by_customer_id(customer_id)
|
19
19
|
result = client.get("#{path}/customer_id/#{customer_id}")
|
20
20
|
|
21
|
-
|
21
|
+
if result.code.to_i == 200
|
22
|
+
build(JSON.parse(result.body))
|
23
|
+
else
|
24
|
+
JSON.parse(result.body)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
data/lib/moneybird/version.rb
CHANGED