Class: SearchSpring::Client
- Inherits:
-
Object
- Object
- SearchSpring::Client
- Defined in:
- lib/search_spring/client.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
-
#site_id ⇒ Object
readonly
Returns the value of attribute site_id.
Instance Method Summary collapse
- #delete(feed_id:, product_ids: []) ⇒ Object
-
#initialize(site_id, secret_key, req_options = {}) ⇒ Client
constructor
A new instance of Client.
- #update(feed_id:, products: []) ⇒ Object
- #upsert(feed_id:, products: []) ⇒ Object
Constructor Details
#initialize(site_id, secret_key, req_options = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/search_spring/client.rb', line 10 def initialize(site_id, secret_key, = {}) @site_id = site_id @secret_key = secret_key raise Errors::AuthenticationError, 'No Site ID provided.' unless @site_id unless @secret_key raise Errors::AuthenticationError, 'No Secret Key provided.' end @conn = connection() end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
8 9 10 |
# File 'lib/search_spring/client.rb', line 8 def conn @conn end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
8 9 10 |
# File 'lib/search_spring/client.rb', line 8 def secret_key @secret_key end |
#site_id ⇒ Object (readonly)
Returns the value of attribute site_id.
8 9 10 |
# File 'lib/search_spring/client.rb', line 8 def site_id @site_id end |
Instance Method Details
#delete(feed_id:, product_ids: []) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/search_spring/client.rb', line 37 def delete(feed_id:, product_ids: []) conn.post( 'api/index/delete.json', feedId: feed_id, records: product_ids ) end |
#update(feed_id:, products: []) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/search_spring/client.rb', line 29 def update(feed_id:, products: []) conn.post( 'api/index/update.json', feedId: feed_id, records: products ) end |
#upsert(feed_id:, products: []) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/search_spring/client.rb', line 21 def upsert(feed_id:, products: []) conn.post( 'api/index/upsert.json', feedId: feed_id, records: products ) end |