tripletexer 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: bcf1f36657638f5e3584d071122ae69310909da6
4
- data.tar.gz: 66a31e734019fd8137144c90c80808c1f8182a1c
3
+ metadata.gz: 63a2d711b4eb31fff96d55d77ce0f5d7d20b4d12
4
+ data.tar.gz: 8c40cf2469c34698ea1cdbca1fed49e2c632122f
5
5
  SHA512:
6
- metadata.gz: a2b71951766e6c75960aedee1f37ae3eb048defd4845feb03935d81da3649cab926613dca0598fa83e8f75ef856bc0bfedd34851043d93f883a89cd49efb47cb
7
- data.tar.gz: c1fc07477f60e2e9186ff7c480f6a47130e362fad4c4cec344d27c629db61e43484ccb0239091ab783ebd72321e00d531d6aeec2c34ec0684ddce139467d3ec1
6
+ metadata.gz: a95ea62564e4316bcdf29f50d08e7e82092f704696ef71effff21ac2286f960037cdc303c74985e1dc065d3e7f594017d302fa3f75dfa243ef935d7bdc12a5f0
7
+ data.tar.gz: bf892f2cd4df7b31a27c2993be1353bba7f831a80fbce186a8593fc10a5668ffad2a14b5bc6d67cba2909a55037174b5d9a23bf86bb4d5718bf14e61ecf337b2
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # Tripletexer - ruby client for tripletex.no API v2
2
2
 
3
+ https://github.com/graudeejs/tripletexer
4
+
3
5
  [![Build Status](https://travis-ci.org/graudeejs/tripletexer.svg?branch=master)](https://travis-ci.org/graudeejs/tripletexer)
4
6
  [![CircleCI](https://circleci.com/gh/graudeejs/tripletexer.svg?style=svg)](https://circleci.com/gh/graudeejs/tripletexer)
5
7
  [![Code Climate](https://codeclimate.com/github/graudeejs/tripletexer.svg)](https://codeclimate.com/github/graudeejs/tripletexer)
6
8
  [![Coverage Status](https://coveralls.io/repos/github/graudeejs/tripletexer/badge.svg?branch=master)](https://coveralls.io/github/graudeejs/tripletexer?branch=master)
9
+ [![Gem Version](https://badge.fury.io/rb/tripletexer.svg)](https://badge.fury.io/rb/tripletexer)
7
10
 
8
11
  ## Getting started
9
12
  Add tripletexer to your Gemfile
10
13
  ```ruby
11
- gem 'tripletexer', '~> 0.2.0'
14
+ gem 'tripletexer', '~> 0.2.1'
12
15
  ```
13
16
  run bundle install
14
17
 
@@ -16,7 +19,10 @@ run bundle install
16
19
 
17
20
  Tripletex.no API documentation can be found here: https://tripletex.no/v2-docs/
18
21
 
19
- This gem tries to fallow patterns of tripletex.no documentation, however not completely.
22
+ This gem tries to fallow patterns of tripletex.no documentation, however not
23
+ completely. Feel free to checkout
24
+ [tripletexer on rubydoc](http://www.rubydoc.info/gems/tripletexer)
25
+
20
26
 
21
27
  ```ruby
22
28
  client = Tripletexer.new
@@ -12,6 +12,8 @@
12
12
  tripletexer/endpoints/company.rb
13
13
  tripletexer/endpoints/contact.rb
14
14
  tripletexer/endpoints/country.rb
15
+ tripletexer/endpoints/crm.rb
16
+ tripletexer/endpoints/crm/prospect.rb
15
17
  tripletexer/endpoints/currency.rb
16
18
  tripletexer/endpoints/customer.rb
17
19
  tripletexer/endpoints/customer/category.rb
@@ -33,6 +35,7 @@
33
35
  tripletexer/endpoints/order.rb
34
36
  tripletexer/endpoints/order/orderline.rb
35
37
  tripletexer/endpoints/product.rb
38
+ tripletexer/endpoints/product/unit.rb
36
39
  tripletexer/endpoints/project.rb
37
40
  tripletexer/endpoints/project/category.rb
38
41
  tripletexer/endpoints/supplier.rb
@@ -124,6 +127,10 @@ class Tripletexer
124
127
  Tripletexer::Endpoints::Token.new(api_client)
125
128
  end
126
129
 
130
+ def crm
131
+ Tripletexer::Endpoints::Crm.new(api_client)
132
+ end
133
+
127
134
  private
128
135
 
129
136
  attr_accessor :api_client
@@ -14,7 +14,7 @@ module Tripletexer::Endpoints
14
14
  def find_entities(path, params, &block)
15
15
  Enumerator.new do |enum_yielder|
16
16
  request_params = params.dup
17
- begin
17
+ loop do
18
18
  result = api_client.get(path, request_params, &block)
19
19
 
20
20
  result['values'].each do |value|
@@ -22,7 +22,8 @@ module Tripletexer::Endpoints
22
22
  end
23
23
 
24
24
  request_params['from'] = result['from'] + result['count']
25
- end until result['fullResultSize'] <= request_params['from']
25
+ break if result['fullResultSize'] <= request_params['from']
26
+ end
26
27
  end
27
28
  end
28
29
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tripletexer::Endpoints
4
+ class Crm < AbstractEndpoint
5
+ def prospect
6
+ ::Tripletexer::Endpoints::Crm::Prospect.new(api_client)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tripletexer::Endpoints
4
+ class Crm::Prospect < Tripletexer::Endpoints::AbstractEndpoint
5
+ # https://tripletex.no/v2-docs/#!/crm47prospect/search
6
+ def search(params)
7
+ find_entities('/v2/crm/prospect', final_params)
8
+ end
9
+
10
+ # https://tripletex.no/v2-docs/#!/crm47prospect/get
11
+ def find(id, params = {})
12
+ find_entity("/v2/crm/prospect/#{id}", params)
13
+ end
14
+ end
15
+ end
@@ -17,5 +17,13 @@ module Tripletexer::Endpoints
17
17
  find_entity("/v2/ledger/posting/#{id}", params)
18
18
  end
19
19
 
20
+ # https://tripletex.no/v2-docs/#!/ledger47posting/openPost
21
+ def open_post(date, params = {})
22
+ final_params = params.merge(
23
+ 'date' => ::Tripletexer::FormatHelpers.format_date(date),
24
+ )
25
+ find_entities('/v2/ledger/posting/openPost', final_params)
26
+ end
27
+
20
28
  end
21
29
  end
@@ -6,8 +6,8 @@ module Tripletexer::Endpoints
6
6
  # https://tripletex.no/v2-docs/#!/ledger47voucher/search
7
7
  def search(date_from, date_to, params = {})
8
8
  final_params = params.merge(
9
- 'invoiceDateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
10
- 'invoiceDateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
9
+ 'dateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
10
+ 'dateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
11
11
  )
12
12
  find_entities('/v2/ledger/voucher', final_params)
13
13
  end
@@ -13,5 +13,19 @@ module Tripletexer::Endpoints
13
13
  find_entity("/v2/product/#{id}", params)
14
14
  end
15
15
 
16
+ # https://tripletex.no/v2-docs/#!/product/post
17
+ def create(body)
18
+ create_entity('/v2/product', body)
19
+ end
20
+
21
+ # https://tripletex.no/v2-docs/#!/product/put
22
+ def update(id, body = {})
23
+ update_entity("/v2/product/#{id}", body)
24
+ end
25
+
26
+ def unit
27
+ ::Tripletexer::Endpoints::Product::Unit.new(api_client)
28
+ end
29
+
16
30
  end
17
31
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tripletexer::Endpoints
4
+ class Product::Unit < AbstractEndpoint
5
+
6
+ # https://tripletex.no/v2-docs/#!/product47unit/search
7
+ def search(params = {})
8
+ find_entities('/v2/product/unit', params)
9
+ end
10
+
11
+ # https://tripletex.no/v2-docs/#!/product47unit/get
12
+ def find(id, params = {})
13
+ find_entity("/v2/product/unit/#{id}", params)
14
+ end
15
+
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Tripletexer
4
- VERSION = '0.2.0'
5
- API_VERSION = '2.1.2'
4
+ VERSION = '0.2.1'
5
+ API_VERSION = '2.3.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tripletexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldis Berjoza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -270,6 +270,8 @@ files:
270
270
  - lib/tripletexer/endpoints/company.rb
271
271
  - lib/tripletexer/endpoints/contact.rb
272
272
  - lib/tripletexer/endpoints/country.rb
273
+ - lib/tripletexer/endpoints/crm.rb
274
+ - lib/tripletexer/endpoints/crm/prospect.rb
273
275
  - lib/tripletexer/endpoints/currency.rb
274
276
  - lib/tripletexer/endpoints/customer.rb
275
277
  - lib/tripletexer/endpoints/customer/category.rb
@@ -291,6 +293,7 @@ files:
291
293
  - lib/tripletexer/endpoints/order.rb
292
294
  - lib/tripletexer/endpoints/order/orderline.rb
293
295
  - lib/tripletexer/endpoints/product.rb
296
+ - lib/tripletexer/endpoints/product/unit.rb
294
297
  - lib/tripletexer/endpoints/project.rb
295
298
  - lib/tripletexer/endpoints/project/category.rb
296
299
  - lib/tripletexer/endpoints/supplier.rb