Class: LinkshareAPI::DeepLinking
- Inherits:
-
Object
- Object
- LinkshareAPI::DeepLinking
- Defined in:
- lib/linkshare_api/deep_linking.rb
Overview
For implementation details please visit rakutenlinkshare.zendesk.com/hc/en-us/articles/201295755-Guide-to-Deep-Linking
Instance Attribute Summary collapse
-
#affiliate_id ⇒ Object
readonly
Returns the value of attribute affiliate_id.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
- #build(mid, murl) ⇒ Object
-
#initialize ⇒ DeepLinking
constructor
A new instance of DeepLinking.
Constructor Details
#initialize ⇒ DeepLinking
Returns a new instance of DeepLinking.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/linkshare_api/deep_linking.rb', line 9 def initialize @affiliate_id = LinkshareAPI.affiliate_id @base_url = LinkshareAPI::WEB_SERVICE_URIS[:deep_linking] if @affiliate_id.nil? raise AuthenticationError.new( "No Affilite ID. Set your Affiliate ID by using 'LinkshareAPI.affiliate_id = <AFFILIATE_ID>'. " + "See https://github.com/rmarescu/linkshare_api#deep-linking for details." ) end end |
Instance Attribute Details
#affiliate_id ⇒ Object (readonly)
Returns the value of attribute affiliate_id.
7 8 9 |
# File 'lib/linkshare_api/deep_linking.rb', line 7 def affiliate_id @affiliate_id end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
7 8 9 |
# File 'lib/linkshare_api/deep_linking.rb', line 7 def base_url @base_url end |
Instance Method Details
#build(mid, murl) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/linkshare_api/deep_linking.rb', line 21 def build(mid, murl) raise ArgumentError, "mid must be a Fixnum, got #{mid.class} instead" unless mid.is_a?(Fixnum) uri = Addressable::URI.parse(base_url) uri.query_values = { id: affiliate_id, mid: mid, murl: murl } uri.to_s end |