xpensify-sdk 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5954814ad4593baa0ef39565b18b6d50fdd4a7661d995b67acccdd2a8bc1f759
4
- data.tar.gz: 297a199973fa552b0aaf072fd3b89345bc3f39e57be50ae765401b7285f28e8f
3
+ metadata.gz: 440f5c9e24c9c7072940fe6e495350f5d7cb3514a2380b9da75553a46db3730c
4
+ data.tar.gz: 2887c5fa900b867efd773d81176a049ae7655a7f960c1b55d4b55a8a64b8ff2e
5
5
  SHA512:
6
- metadata.gz: 21371daec0bf8daaaac79a33255589deaacc36f47de711b28c3d0b92d2115d80f6eeb4b668acc33127bf9c029f06aec7e8c3ec7caac2f4084b7c10e4d5fcde19
7
- data.tar.gz: 84cb4848dd2ceaf37a12521099842300871e1b6c3b114e38f75749c31729dfba21cf702680aadc69d7f31586c0139f85c030b362ce806d3351ac807ebaf0adb7
6
+ metadata.gz: d9e70e3565397832c6ca3649f9dd2e2a5b13a688077a899c5111c0c4382928c67850961075c8cb0efc0ac1f869497bfa85b2fd9dcc1d6c224acd02af29a23474
7
+ data.tar.gz: ec74028328e4d46c544a6fc3d8e7e64be827c5d1719300821a76b9c5a4cfa3c4e604f3aba67fef5b4113530789cee22061c5cc19b6bcbe394e109f162007303d
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  .byebug_history
13
13
 
14
14
  .DS_Store
15
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xpensify_sdk (0.0.1)
4
+ xpensify-sdk (0.0.2)
5
5
  http (~> 5.0)
6
6
 
7
7
  GEM
@@ -91,7 +91,7 @@ DEPENDENCIES
91
91
  rubocop-performance (~> 1.12)
92
92
  rubocop-rspec (~> 2.6)
93
93
  simplecov (~> 0.21)
94
- xpensify_sdk!
94
+ xpensify-sdk!
95
95
 
96
96
  BUNDLED WITH
97
97
  2.2.31
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Xpensify
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.
data/README.md CHANGED
@@ -9,7 +9,7 @@ You can read the API docs directly from [here](https://xpensifyapi.docs.apiary.i
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'xpensify_sdk'
12
+ gem 'xpensify-sdk'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -21,7 +21,7 @@ $> bundle
21
21
  Or install it yourself as:
22
22
 
23
23
  ```bash
24
- $> gem install xpensify_sdk
24
+ $> gem install xpensify-sdk
25
25
  ```
26
26
 
27
27
  ## Usage
@@ -86,6 +86,13 @@ puts invoice.id
86
86
  puts invoice.products
87
87
  ```
88
88
 
89
+ ### Update an invoice
90
+
91
+ ```ruby
92
+ client = XpensifySDK::Client.new
93
+ client.update_invoice(ID, { accounted: 'completed' }) #=> :ok
94
+ ```
95
+
89
96
  ### Errors
90
97
 
91
98
  You can check [here](https://github.com/Xpensify/ruby-sdk/blob/master/lib/xpensify_sdk/error.rb) all the error classes that the library raises.
@@ -16,5 +16,11 @@ module XpensifySDK
16
16
  # TODO: use dry-rb structs instead of OpenStruct
17
17
  JSON.parse(response.body.to_s, object_class: OpenStruct) # rubocop:disable Style/OpenStructUse
18
18
  end
19
+
20
+ def update_invoice(id, options)
21
+ response = HTTPClient.update_invoice(id, options, @api_key)
22
+ Error.raise_from_code!(response.code) if response.code != 200
23
+ :ok
24
+ end
19
25
  end
20
26
  end
@@ -20,10 +20,18 @@ module XpensifySDK
20
20
  )
21
21
  end
22
22
 
23
+ def update_invoice(id, params, api_key)
24
+ HTTP.put(
25
+ "#{API_URL}/invoices/#{id}",
26
+ body: params.to_json,
27
+ headers: build_headers(api_key)
28
+ )
29
+ end
30
+
23
31
  private
24
32
 
25
33
  def build_headers(api_key)
26
- { 'Authorization' => api_key }
34
+ { 'Authorization' => api_key, 'Content-type' => 'application/json' }
27
35
  end
28
36
  end
29
37
  end
@@ -1,3 +1,3 @@
1
1
  module XpensifySDK
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xpensify-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Bezdjian
@@ -67,6 +67,7 @@ files:
67
67
  - ".travis.yml"
68
68
  - Gemfile
69
69
  - Gemfile.lock
70
+ - LICENSE
70
71
  - README.md
71
72
  - Rakefile
72
73
  - bin/console