invoiced 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/lib/invoiced/operations/update.rb +18 -4
- data/lib/invoiced/version.rb +1 -1
- data/lib/invoiced.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e1807afacc160361d8d7b3014164edb507e3970
|
4
|
+
data.tar.gz: c806be29c391920e499ed18c941f5d740cfa4b45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dd95aa7ee089d9a7da05dd054be8ea58c81be724fb3d6309e8a6b49cf81e35b3abb0151e71462b626cb88e7754c2120429bf2d0bbdc9d182178e0a0c1237f7b
|
7
|
+
data.tar.gz: a381dffbc857778b616b71c5beb950e6d716106765b4bbd4d235681119435858fca7fe110dbd55fa7961e03ff5293177c537a1215011c1d9488a789cfa56e007
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2015 Invoiced, Inc. (https://invoiced.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -1,11 +1,25 @@
|
|
1
1
|
module Invoiced
|
2
2
|
module Operations
|
3
3
|
module Update
|
4
|
-
def save
|
5
|
-
|
4
|
+
def save(params = {})
|
5
|
+
update = {}
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
@unsaved.each do |k|
|
8
|
+
update[k] = @values[k]
|
9
|
+
end
|
10
|
+
|
11
|
+
update.merge(params)
|
12
|
+
|
13
|
+
# perform the update if there are any changes
|
14
|
+
if update.length > 0
|
15
|
+
response = @client.request(:patch, @endpoint, update)
|
16
|
+
|
17
|
+
# update the local values with the response
|
18
|
+
@values = response[:body].dup.merge({:id => self.id})
|
19
|
+
@unsaved = Set.new
|
20
|
+
|
21
|
+
return response[:code] == 200
|
22
|
+
end
|
9
23
|
end
|
10
24
|
end
|
11
25
|
end
|
data/lib/invoiced/version.rb
CHANGED
data/lib/invoiced.rb
CHANGED
@@ -115,7 +115,7 @@ module Invoiced
|
|
115
115
|
end
|
116
116
|
|
117
117
|
case response.code
|
118
|
-
when 400, 404
|
118
|
+
when 400, 403, 404
|
119
119
|
raise invalid_request_error(error, response)
|
120
120
|
when 401
|
121
121
|
raise authentication_error(error, response)
|
@@ -141,7 +141,7 @@ module Invoiced
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def general_api_error(code, body)
|
144
|
-
raise ApiError.new("API Error #{code} - #{body}")
|
144
|
+
raise ApiError.new("API Error #{code} - #{body}", code)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoiced
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared King
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- .gitignore
|
118
118
|
- .travis.yml
|
119
119
|
- Gemfile
|
120
|
+
- LICENSE
|
120
121
|
- README.md
|
121
122
|
- Rakefile
|
122
123
|
- invoiced.gemspec
|