moneybird 0.7.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/lib/moneybird.rb +5 -0
- data/lib/moneybird/resource.rb +5 -3
- data/lib/moneybird/resource/administration.rb +4 -0
- data/lib/moneybird/resource/recurring_sales_invoice.rb +2 -2
- data/lib/moneybird/resource/sales_invoice.rb +2 -2
- data/lib/moneybird/version.rb +1 -1
- data/moneybird.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 944b2c8d8441278203f58d084b530147a0f23886
|
4
|
+
data.tar.gz: 1c7a0f696c363928717f41f4294544a853a1cf73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b527b144d9dcf62f37832b35e20f21875e00c223e865b738719bc73b9e6ada95c02b4bb57b603fdd5acac91d3d3d6d14e0f9ac5d7a476f58c618c1ec9bc9813a
|
7
|
+
data.tar.gz: 686f076396deeaa72a11445db74375eb3fee3d8c48adc0004c1a18114ffc9ec82ed5f8212902b451004caa3976c698d975b87af4a11276851c988c4e95010f93
|
data/.travis.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
3
|
+
- 2.2.2
|
4
4
|
before_install: gem install bundler -v 1.11.2
|
5
5
|
|
6
6
|
addons:
|
7
7
|
code_climate:
|
8
|
-
repo_token: 0b8e41ecbc26637a7db4e6e9d4581c445441674f689016ab45fb5c51242b59bf
|
8
|
+
repo_token: 0b8e41ecbc26637a7db4e6e9d4581c445441674f689016ab45fb5c51242b59bf
|
9
|
+
|
10
|
+
after_success:
|
11
|
+
- bundle exec codeclimate-test-reporter
|
data/lib/moneybird.rb
CHANGED
data/lib/moneybird/resource.rb
CHANGED
@@ -30,7 +30,9 @@ module Moneybird
|
|
30
30
|
self.class.attributes.inject({}) do |attributes, attribute|
|
31
31
|
value = send(attribute)
|
32
32
|
if !value.nil?
|
33
|
-
if value.respond_to?(:attributes)
|
33
|
+
if value.is_a?(Array) && value.first.respond_to?(:attributes)
|
34
|
+
attributes["#{attribute}_attributes"] = value.map { |item| item.attributes }
|
35
|
+
elsif value.respond_to?(:attributes)
|
34
36
|
attributes["#{attribute}_attributes"] = value.attributes
|
35
37
|
else
|
36
38
|
unless self.class.nillable_attributes && self.class.nillable_attributes.include?(attribute)
|
@@ -42,7 +44,7 @@ module Moneybird
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def to_json
|
45
|
-
JSON.generate({self.class.resource => attributes})
|
47
|
+
JSON.generate({self.class.resource => attributes.as_json})
|
46
48
|
end
|
47
49
|
|
48
50
|
module ClassMethods
|
@@ -60,7 +62,7 @@ module Moneybird
|
|
60
62
|
end
|
61
63
|
|
62
64
|
def resource
|
63
|
-
self.name.split('::').last.
|
65
|
+
self.name.split('::').last.underscore
|
64
66
|
end
|
65
67
|
|
66
68
|
def has_attributes(attributes)
|
@@ -43,11 +43,11 @@ module Moneybird::Resource
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def contact=(attributes)
|
46
|
-
@contact
|
46
|
+
@contact = Moneybird::Resource::Contact.build(attributes)
|
47
47
|
end
|
48
48
|
|
49
49
|
def details=(line_items)
|
50
|
-
@details
|
50
|
+
@details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
|
51
51
|
end
|
52
52
|
|
53
53
|
def events=(events)
|
@@ -46,11 +46,11 @@ module Moneybird::Resource
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def contact=(attributes)
|
49
|
-
@contact
|
49
|
+
@contact = Moneybird::Resource::Contact.build(attributes)
|
50
50
|
end
|
51
51
|
|
52
52
|
def details=(line_items)
|
53
|
-
@details
|
53
|
+
@details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
|
54
54
|
end
|
55
55
|
|
56
56
|
def events=(events)
|
data/lib/moneybird/version.rb
CHANGED
data/moneybird.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.add_dependency "activesupport", '>= 3.0'
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.11"
|
24
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moneybird
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maarten van Vliet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
163
|
version: '0'
|
150
164
|
requirements: []
|
151
165
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.5.2
|
153
167
|
signing_key:
|
154
168
|
specification_version: 4
|
155
169
|
summary: Library to interface with Moneybird API
|