trustedsearch 1.0.9 → 1.10.0

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzBjOTczNWRmODNjN2UzZDVhM2Q3ZjIwNDZkZmVmNTIwYTMxZjY4MQ==
4
+ ZmRjZTJiNDgwZTM0YTc4MjMxNGE5YWE1ZGRhMjJmMzdhYWYwNjY1YQ==
5
5
  data.tar.gz: !binary |-
6
- N2RhMDNhMDQ4ZGQ1ZDQ5NTI3NWM0NjYzODgwMzNiYzU1MGQzM2NlNg==
6
+ YWNhYTMyZmViYzc0Zjc3YmFjZmZlNjI3MTkwMzBmYzFjY2Y5ZWI2NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWQzMWE4ZTU1ZDEyZjEwNDU1NTc4NzFiNDczNDY0ZGIyMDFhMzE0ZDcyMTlj
10
- ZWIyYTdhMmJmODI5OTg1MWQzNmYzMTUyYWQ0YjdmODYyZjBmYjk5MTZkMzY3
11
- ZjQ4OGE3NDUwMGFmZGNiMzY5YmVkOWY0OTZjNjBjM2M0YTc2ZjU=
9
+ OTdkZjg0NTYyM2I4Y2ZiNzM5Y2ZiNGM0NjIwZmEyYzU0MTJkMTM5NmM0ODU0
10
+ NjI1NWIzM2EyMzkxYWE2OTI0NzE0OTcyMmUwYTlmZGNjMzQyNTFjYTlkNzQx
11
+ NGU3MWNiZTVlMzc0MTllYzBmYzg1OGYwMmZkOTc5YjdmNzM1NmY=
12
12
  data.tar.gz: !binary |-
13
- ZWRjMDAyMWExMDYzMTA5OGQ5OGVkMzdlZTZjOTNlNGVlM2NhZWUzYzM2NWY2
14
- ZjEzYTdkNGY5YThmN2Q0MGNiNzQxZDdhZjQzNmRjYjQ1N2ExMTNiNDQyYTFh
15
- MGQ4ZDE3NDliZmNkOWNjZTc5MWM0OTczZmYxNzA5YTM4ZTc4YmM=
13
+ ZDUxYWFlNmJlZTQ3OTU0ZjM2MWRhNDZlMDU5ZTA0MmI2NWZlYTE4ZTdkZDEy
14
+ MTZkNjVjODIxZGJhZGI3ZTg4OGIxZGRkZWIyMjQ4ODRmYjNmMmI2YWFhZmEy
15
+ OGVkZGExOTM4YjQ4YmE2NjBkMzUzZjNmMzk1Y2EwYjA2ZmExZDE=
data/README.md CHANGED
@@ -94,6 +94,42 @@ Get update since 1380611103
94
94
  rake v1:updates_since[YourPublicKey,YourPrivateKey,1380611103]
95
95
  ```
96
96
 
97
+
98
+ #### Submit Business for data validation
99
+ See the [API documentation](http://developers.trustedsearch.org/#/v1-validate) for details.
100
+
101
+
102
+ ```ruby
103
+ business_data = {
104
+ :contact => {
105
+ :firstName => "Albert",
106
+ :lastName => "Einstein",
107
+ :email => "albert@trustedsearch.org",
108
+ :phone => "5555555555"
109
+ },
110
+ :business => {
111
+ :name => "Albert's Relativity Lane",
112
+ :street => "123 Cherry Tree Lane",
113
+ :city => "Santa Barbara",
114
+ :state => "CA",
115
+ :postalCode => "93041",
116
+ :phoneTollFree =>"(800) 555-5555",
117
+ :website => "http://www.trustedsearch.org",
118
+ :email => "info@trustedsearch.org",
119
+ }
120
+ }
121
+
122
+
123
+ api = TrustedSearch::V1.new
124
+ response = api.postValidate(business_data)
125
+
126
+ ##### Rake
127
+ Validate single business record.
128
+ ```ruby
129
+ rake v1:validate[YourPublicKey,YourPrivateKey,"examples/single.json"]
130
+ ```
131
+
132
+
97
133
  #### Submit New Business Listings
98
134
 
99
135
  See the [API documentation](http://developers.trustedsearch.org/#/submitting-a-business) for a list of parameters for each API resource.
data/lib/tasks/v1.rake CHANGED
@@ -69,7 +69,37 @@ namespace :v1 do
69
69
 
70
70
  file.close
71
71
 
72
- end
72
+ end
73
+
74
+
75
+ desc "Submit a location to be validate before passing it to postBusiness."
76
+ task :validate, [:public_key, :private_key, :file] do |t, args|
77
+ TrustedSearch.public_key = args.public_key
78
+ TrustedSearch.private_key = args.private_key
79
+ TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')
80
+ body_file = ( args.file ? args.file : nil)
81
+ if(body_file.nil?)
82
+ puts "You must specify a valid body file."
83
+ next
84
+ end
85
+
86
+ file = File.open(body_file, "rb")
87
+ begin
88
+ api = TrustedSearch::V1.new
89
+ contents = file.read
90
+ response = api.postValidate(JSON.parse(contents))
91
+ puts response.code
92
+ puts response.data
93
+ rescue Exception => e
94
+ puts "Message: " + e.message.to_s
95
+ puts "Body:"
96
+ puts e.body
97
+ puts "Code: " + e.code.to_s
98
+ end
99
+
100
+ file.close
101
+
102
+ end
73
103
 
74
104
  task :test_fulfillment, [:public_key, :private_key, :uuid] do |t, args|
75
105
  TrustedSearch.public_key = args.public_key
@@ -42,8 +42,12 @@ module TrustedSearch
42
42
  def postBusiness( data = [] )
43
43
  method_url = 'local-business'
44
44
  return self.post(method_url, {} , data )
45
- end
46
-
45
+ end
46
+ #Validate a record.
47
+ def postValidate( data = [] )
48
+ method_url = 'validate'
49
+ return self.post(method_url, {} , data )
50
+ end
47
51
 
48
52
  def putTestFulfillment( uuid = nil)
49
53
  method_url = 'test-fulfillment/' + uuid.to_s
@@ -129,6 +129,9 @@ module TrustedSearch
129
129
 
130
130
  #get the end_point based upon the environment. Default to sandbox.
131
131
  def end_point
132
+ if(ENV['RAKE_ENV'])
133
+ TrustedSearch.environment = ENV['RAKE_ENV']
134
+ end
132
135
  if(TrustedSearch.environment == 'production')
133
136
  return TrustedSearch.environments[:production][:domain]
134
137
  elsif(TrustedSearch.environment == 'local')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trustedsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - trustedSEARCH Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-20 00:00:00.000000000 Z
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable