saasu2 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +1 -1
- data/lib/saasu/search.rb +3 -7
- data/lib/saasu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1affbc76306877b1478cd092e7f30cee9dc54eb4
|
4
|
+
data.tar.gz: 97086f72357ed3b063a6667f8c3a6d47d9923044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c4168807cc9dd04660890381a0aacb6259884f43ee21a0f7ef973893323310644101564e4dec06d29c05e58d6cdca67441ddc5546c514741aff6d387f523c4
|
7
|
+
data.tar.gz: 39d4bc50bed5d3088fa930c84669ac354f8cdeda4de2a2d2f9b514ee3cd2381f3379fe54ae56c3ca29dc36e6e203c2d293b456b7a6c0a7e6954dc961575529b7
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ contact['GivenName'] = 'John'
|
|
77
77
|
contact.attributes
|
78
78
|
|
79
79
|
# Search. Available scopes: All, Transactions, Contacts, InventoryItems.
|
80
|
-
query = Saasu::Search.new(
|
80
|
+
query = Saasu::Search.new('Book', 'InventoryItems')
|
81
81
|
query.perform
|
82
82
|
|
83
83
|
query.contacts
|
data/lib/saasu/search.rb
CHANGED
@@ -3,7 +3,7 @@ module Saasu
|
|
3
3
|
VALID_SCOPES = %W(All Transactions Contacts InventoryItems)
|
4
4
|
attr_accessor :scope, :keywords
|
5
5
|
|
6
|
-
def initialize(scope
|
6
|
+
def initialize(keywords, scope = 'All')
|
7
7
|
@scope = scope
|
8
8
|
@keywords = keywords
|
9
9
|
|
@@ -35,11 +35,7 @@ module Saasu
|
|
35
35
|
|
36
36
|
private
|
37
37
|
def perform_search!
|
38
|
-
@search_results = Saasu::Client.request(:get, 'search', { Scope: scope, Keywords: @keywords, IncludeSearchTermHighlights: false })
|
39
|
-
end
|
40
|
-
|
41
|
-
def scope
|
42
|
-
@scope ||= 'All'
|
38
|
+
@search_results = Saasu::Client.request(:get, 'search', { Scope: @scope, Keywords: @keywords, IncludeSearchTermHighlights: false })
|
43
39
|
end
|
44
40
|
|
45
41
|
def search_results
|
@@ -47,7 +43,7 @@ module Saasu
|
|
47
43
|
end
|
48
44
|
|
49
45
|
def validate_scope!
|
50
|
-
unless scope.in? VALID_SCOPES
|
46
|
+
unless @scope.in? VALID_SCOPES
|
51
47
|
raise "Invalid scope argument. Valid values are: #{VALID_SCOPES.join(', ')}"
|
52
48
|
end
|
53
49
|
end
|
data/lib/saasu/version.rb
CHANGED