saasu2 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1affbc76306877b1478cd092e7f30cee9dc54eb4
4
- data.tar.gz: 97086f72357ed3b063a6667f8c3a6d47d9923044
3
+ metadata.gz: 1a8d35ea5e24cb6fe01ec9f88b9b46fb34a373d3
4
+ data.tar.gz: 3d71d23be75c004dee22405fd70ee1f1a9b54624
5
5
  SHA512:
6
- metadata.gz: c6c4168807cc9dd04660890381a0aacb6259884f43ee21a0f7ef973893323310644101564e4dec06d29c05e58d6cdca67441ddc5546c514741aff6d387f523c4
7
- data.tar.gz: 39d4bc50bed5d3088fa930c84669ac354f8cdeda4de2a2d2f9b514ee3cd2381f3379fe54ae56c3ca29dc36e6e203c2d293b456b7a6c0a7e6954dc961575529b7
6
+ metadata.gz: 9ac5b6e2b2c049042a34eef4d7d670ddd1d038bc77ab8dabdf9b5be3599766bccab348f51b39581c695d53c75a75f79088ffd8d6642a2187bc411ef1f2b7bd57
7
+ data.tar.gz: 35981f4eb95688dd6d94d65477e142312baab4d51245d44f061794a022d8e105f9c9e5c8249111a2b189d9d2faac0629a7c85ce4d4628ff940757a5d02865686
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,12 @@
1
+ ==== Version 0.1.4
2
+ Features:
3
+ * Saasu::User.reset_password – Allows a user to request that a password reset email be generated and sent to them.
4
+ * Sassu::FileIdentity - list the set of files a user has access to.
5
+ * Saasu::ContactAggregate - allows a user to add a Contact with a related company and contact manager in one call. This can also be retrieved and updated BUT NO delete operation is allowed.
6
+ * Saasu::Search - new filtering options for transaction_type.
7
+ * Saasu::Invoice#email - allows emailing to the contact on the invoice or emailing to a specified email address.
8
+
1
9
  ==== Version 0.1.2
2
10
  Features:
3
11
  * Add support #create, #update, #destroy methods for /Items API
4
- * Add support for /Search endpoint
12
+ * Add support for /Search endpoint
data/README.md CHANGED
@@ -42,6 +42,9 @@ You can access the following objects:
42
42
  - Saasu::Payment
43
43
  - Saasu::TaxCode
44
44
  - Saasu::Search
45
+ - Saasu::User
46
+ - Saasu::FileIdentity
47
+ - Saasu::ContactAggregate
45
48
 
46
49
  Usage examples:
47
50
 
@@ -76,13 +79,25 @@ contact['GivenName'] = 'John'
76
79
  # get all attributes
77
80
  contact.attributes
78
81
 
79
- # Search. Available scopes: All, Transactions, Contacts, InventoryItems.
82
+ # Search. Available scopes: All, Transactions, Contacts, InventoryItems.
80
83
  query = Saasu::Search.new('Book', 'InventoryItems')
81
84
  query.perform
82
85
 
83
86
  query.contacts
84
87
  query.items
85
88
  query.invoices
89
+
90
+ # You can filter search results by transaction type - Sale, Purchase, Journal, Payroll
91
+ query = Saasu::Search.new('Book', scope: 'InventoryItems', transaction_type: 'Sale')
92
+
93
+ # or you can use the default scope - 'All'
94
+ query = Saasu::Search.new('Book', transaction_type: 'Purchase')
95
+
96
+ # reset user password
97
+ Saasu::User.reset_password('user@saasu.com')
98
+
99
+ # list the set of files a user has access to
100
+ Saasu::FileIdentity.all
86
101
  ```
87
102
 
88
103
  Note - Saasu uses .NET naming convention for fields and filters eg. GivenName, LastModifiedDate
@@ -0,0 +1,3 @@
1
+ class Saasu::ContactAggregate < Saasu::Base
2
+ allowed_methods :show, :update, :create
3
+ end
@@ -0,0 +1,7 @@
1
+ class Saasu::FileIdentity < Saasu::Base
2
+ allowed_methods :show, :index
3
+
4
+ def self.find(file_id)
5
+ Saasu::Client.request(:get, 'FileIdentity', { FileId: file_id })
6
+ end
7
+ end
data/lib/saasu/invoice.rb CHANGED
@@ -1,4 +1,16 @@
1
1
  class Saasu::Invoice < Saasu::Base
2
2
  allowed_methods :show, :index, :destroy, :update, :create
3
3
  filter_by %W(InvoiceNumber LastModifiedFromDate LastModifiedToDate TransactionType Tags TagSelection InvoiceFromDate InvoiceToDate InvoiceStatus PaymentStatus ContactId)
4
+
5
+ def email(email_address = nil)
6
+ if email_address.present?
7
+ url = ['Invoice', id, 'email'].join('/')
8
+ params = { EmailTo: email_address }
9
+ else
10
+ url = ['Invoice', id, 'email-contact'].join('/')
11
+ params = {}
12
+ end
13
+
14
+ Saasu::Client.request(:post, url, params)
15
+ end
4
16
  end
data/lib/saasu/search.rb CHANGED
@@ -3,8 +3,17 @@ module Saasu
3
3
  VALID_SCOPES = %W(All Transactions Contacts InventoryItems)
4
4
  attr_accessor :scope, :keywords
5
5
 
6
- def initialize(keywords, scope = 'All')
7
- @scope = scope
6
+ # allowed params:
7
+ # :scope - All, Transactions, Contacts, InventoryItems
8
+ # :transaction_type - Sale, Purchase, Journal, Payroll
9
+ def initialize(keywords, params = {})
10
+ if params.is_a?(Hash)
11
+ @scope = params[:scope].presence || 'All'
12
+ @transaction_type = "Transactions.#{params[:transaction_type]}" if params[:transaction_type].present?
13
+ else
14
+ @scope = params
15
+ end
16
+
8
17
  @keywords = keywords
9
18
 
10
19
  validate_scope!
@@ -34,8 +43,14 @@ module Saasu
34
43
  end
35
44
 
36
45
  private
46
+ def search_params
47
+ _params = { Scope: @scope, Keywords: @keywords, IncludeSearchTermHighlights: false }
48
+ _params[:TransactionType] = @transaction_type if @transaction_type.present?
49
+ _params
50
+ end
51
+
37
52
  def perform_search!
38
- @search_results = Saasu::Client.request(:get, 'search', { Scope: @scope, Keywords: @keywords, IncludeSearchTermHighlights: false })
53
+ @search_results = Saasu::Client.request(:get, 'search', search_params)
39
54
  end
40
55
 
41
56
  def search_results
data/lib/saasu/user.rb ADDED
@@ -0,0 +1,6 @@
1
+ class Saasu::User < Saasu::Base
2
+ def self.reset_password(username)
3
+ raise "Username is required." if username.blank?
4
+ Saasu::Client.request(:post, 'User/reset-password', { Username: username })['StatusMessage']
5
+ end
6
+ end
data/lib/saasu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Saasu
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/saasu.rb CHANGED
@@ -12,6 +12,9 @@ require "saasu/tax_code"
12
12
  require "saasu/config"
13
13
  require "saasu/auth"
14
14
  require "saasu/search"
15
+ require "saasu/user"
16
+ require "saasu/file_identity"
17
+ require "saasu/contact_aggregate"
15
18
 
16
19
  module Saasu
17
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saasu2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sinenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-20 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -177,12 +177,15 @@ files:
177
177
  - lib/saasu/company.rb
178
178
  - lib/saasu/config.rb
179
179
  - lib/saasu/contact.rb
180
+ - lib/saasu/contact_aggregate.rb
181
+ - lib/saasu/file_identity.rb
180
182
  - lib/saasu/invoice.rb
181
183
  - lib/saasu/invoice_attachment.rb
182
184
  - lib/saasu/item.rb
183
185
  - lib/saasu/payment.rb
184
186
  - lib/saasu/search.rb
185
187
  - lib/saasu/tax_code.rb
188
+ - lib/saasu/user.rb
186
189
  - lib/saasu/version.rb
187
190
  - saasu2.gemspec
188
191
  homepage: https://api.saasu.com
@@ -205,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
208
  version: '0'
206
209
  requirements: []
207
210
  rubyforge_project:
208
- rubygems_version: 2.2.2
211
+ rubygems_version: 2.4.8
209
212
  signing_key:
210
213
  specification_version: 4
211
214
  summary: Ruby wrapper for Saasu API.