Module: LinkshareAPI

Defined in:
lib/linkshare_api.rb,
lib/linkshare_api/logger.rb,
lib/linkshare_api/version.rb,
lib/linkshare_api/response.rb,
lib/linkshare_api/deep_linking.rb,
lib/linkshare_api/errors/error.rb,
lib/linkshare_api/link_generator.rb,
lib/linkshare_api/product_search.rb,
lib/linkshare_api/coupon_web_service.rb,
lib/linkshare_api/errors/connection_error.rb,
lib/linkshare_api/errors/authentication_error.rb,
lib/linkshare_api/errors/invalid_request_error.rb

Defined Under Namespace

Classes: AuthenticationError, ConnectionError, CouponWebService, DeepLinking, Error, InvalidRequestError, LinkGenerator, Logger, ProductSearch, Response

Constant Summary collapse

WEB_SERVICE_URIS =
{
  link_generator: "http://getdeeplink.linksynergy.com/createcustomlink.shtml",
  deep_linking: "http://click.linksynergy.com/deeplink",
  product_search: "http://productsearch.linksynergy.com/productsearch",
  coupon_web_service: "http://couponfeed.linksynergy.com/coupon"
}
PARSE_RESULT =
{
  link_generator: "item",
  product_search: "item",
  coupon_web_service: "link"
}
RESULT =
{
  product_search: "result",
  coupon_web_service: "couponfeed"
}
PAGE_NUMBER =
{
  product_search: "PageNumber",
  coupon_web_service: "PageNumberRequested"
}
VERSION =
"0.3.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.affiliate_idObject

Returns the value of attribute affiliate_id.



47
48
49
# File 'lib/linkshare_api.rb', line 47

def affiliate_id
  @affiliate_id
end

.api_timeoutObject

Returns the value of attribute api_timeout.



48
49
50
# File 'lib/linkshare_api.rb', line 48

def api_timeout
  @api_timeout
end

.loggerObject

Returns the value of attribute logger.



47
48
49
# File 'lib/linkshare_api.rb', line 47

def logger
  @logger
end

.tokenObject

Returns the value of attribute token.



47
48
49
# File 'lib/linkshare_api.rb', line 47

def token
  @token
end

Class Method Details

.coupon_web_service(options = {}) ⇒ Object



78
79
80
81
# File 'lib/linkshare_api.rb', line 78

def self.coupon_web_service(options = {})
  coupon_web_service = LinkshareAPI::CouponWebService.new
  coupon_web_service.query(options)
end


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/linkshare_api.rb', line 57

def self.link_generator(mid, murl)
  if affiliate_id.nil?
    LinkshareAPI::Logger.log(
      :warn,
      "`Automated Link Generator` has been discontinued in favor of `Deep Linking`. " +
      "To use `Deep Linking` you only have to set your Affiliate ID by executing " +
      "'LinkshareAPI.affiliate_id = <AFFILIATE_ID>'. Everything else remains the same. " +
      "See https://github.com/rmarescu/linkshare_api#deep-linking for details."
    )
    link_generator = LinkshareAPI::LinkGenerator.new
  else
    link_generator = LinkshareAPI::DeepLinking.new
  end
  link_generator.build(mid, murl)
end

.product_search(options = {}) ⇒ Object



73
74
75
76
# File 'lib/linkshare_api.rb', line 73

def self.product_search(options = {})
  product_search = LinkshareAPI::ProductSearch.new
  product_search.query(options)
end