linkshare_api 0.1.0 → 0.2.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 +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -0
- data/README.md +20 -0
- data/lib/linkshare_api.rb +31 -8
- data/lib/linkshare_api/coupon_web_service.rb +49 -0
- data/lib/linkshare_api/link_generator.rb +1 -0
- data/lib/linkshare_api/product_search.rb +1 -1
- data/lib/linkshare_api/response.rb +11 -6
- data/lib/linkshare_api/version.rb +1 -1
- data/linkshare_api.gemspec +5 -4
- data/test/linkshare_coupon_api_test.rb +392 -0
- metadata +51 -51
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: b32e4d516fc03567a0d237cf9668ff023e873ed7
         | 
| 4 | 
            +
              data.tar.gz: 729a0129c9b661d5d3f211c5c7919bfe67e732ec
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: 6f4053896f431cd45d1500a053ebf5fefef4c26783719f983b434bc36656ef712b297a50f5777ed9fae9569e25afabbfdf8b4df06a4118b44020a34b590e456f
         | 
| 7 | 
            +
              data.tar.gz: 47dfebd2653f171431b0c5bbebe03020e79ec2a9612fe6822950fee56f8d342bb43fc3d41e78ad783fced9ccb54a0e39b7fe212a83a2f561d3981a858943d22b
         | 
    
        data/.ruby-version
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            2.1.1
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -99,6 +99,26 @@ end | |
| 99 99 |  | 
| 100 100 | 
             
            When using the `all` method, `response` object is updated with the data returned by the last API request (last page). `response.all` returns the `data` array.
         | 
| 101 101 |  | 
| 102 | 
            +
            ### Coupon Web Services
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            Easy access to coupons and promotional link data for your advertisers using [Coupon Web Service](http://helpcenter.linkshare.com/publisher/questions.php?questionid=865)
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            ```ruby
         | 
| 107 | 
            +
            # Search for promotion types "Clearance" (id 3) and "Dollar Amount Off" (id 5)
         | 
| 108 | 
            +
            # from Wal-Mart (id 2149) within category "Apparel - Babies & Kids" (id 3)
         | 
| 109 | 
            +
            # in the US network (id 1)
         | 
| 110 | 
            +
            options = {
         | 
| 111 | 
            +
              promotiontype: 3|5,
         | 
| 112 | 
            +
              mid: 2149,
         | 
| 113 | 
            +
              cat: 3,
         | 
| 114 | 
            +
              network: 1
         | 
| 115 | 
            +
            }
         | 
| 116 | 
            +
            response = LinkshareAPI.coupon_web_service(options)
         | 
| 117 | 
            +
            response.data.each do |item|
         | 
| 118 | 
            +
              # Do stuff
         | 
| 119 | 
            +
            end
         | 
| 120 | 
            +
            ```
         | 
| 121 | 
            +
             | 
| 102 122 | 
             
            ### Extra Configuration
         | 
| 103 123 |  | 
| 104 124 | 
             
            * `LinkshareAPI.api_timeout` - the timeout set when initiating requests to LinkShare Web Services (default value is 30 seconds)
         | 
    
        data/lib/linkshare_api.rb
    CHANGED
    
    | @@ -2,20 +2,38 @@ | |
| 2 2 | 
             
            require "linkshare_api/version"
         | 
| 3 3 |  | 
| 4 4 | 
             
            # Resources
         | 
| 5 | 
            -
            require "linkshare_api/link_generator"
         | 
| 6 | 
            -
            require "linkshare_api/product_search"
         | 
| 7 | 
            -
            require "linkshare_api/ | 
| 5 | 
            +
            require File.expand_path("../linkshare_api/link_generator", __FILE__)
         | 
| 6 | 
            +
            require File.expand_path("../linkshare_api/product_search", __FILE__)
         | 
| 7 | 
            +
            require File.expand_path("../linkshare_api/coupon_web_service", __FILE__)
         | 
| 8 | 
            +
            require File.expand_path("../linkshare_api/response", __FILE__)
         | 
| 8 9 |  | 
| 9 10 | 
             
            # Errors
         | 
| 10 | 
            -
            require "linkshare_api/errors/error"
         | 
| 11 | 
            -
            require "linkshare_api/errors/authentication_error"
         | 
| 12 | 
            -
            require "linkshare_api/errors/connection_error"
         | 
| 13 | 
            -
            require "linkshare_api/errors/invalid_request_error"
         | 
| 11 | 
            +
            require File.expand_path("../linkshare_api/errors/error", __FILE__)
         | 
| 12 | 
            +
            require File.expand_path("../linkshare_api/errors/authentication_error", __FILE__)
         | 
| 13 | 
            +
            require File.expand_path("../linkshare_api/errors/connection_error", __FILE__)
         | 
| 14 | 
            +
            require File.expand_path("../linkshare_api/errors/invalid_request_error", __FILE__)
         | 
| 14 15 |  | 
| 15 16 | 
             
            module LinkshareAPI
         | 
| 16 17 | 
             
              WEB_SERVICE_URIS = {
         | 
| 17 18 | 
             
                link_generator: "http://getdeeplink.linksynergy.com/createcustomlink.shtml",
         | 
| 18 | 
            -
                product_search: "http://productsearch.linksynergy.com/productsearch"
         | 
| 19 | 
            +
                product_search: "http://productsearch.linksynergy.com/productsearch",
         | 
| 20 | 
            +
                coupon_web_service: "http://couponfeed.linksynergy.com/coupon"
         | 
| 21 | 
            +
              }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              PARSE_RESULT = {
         | 
| 24 | 
            +
                link_generator: "item",
         | 
| 25 | 
            +
                product_search: "item",
         | 
| 26 | 
            +
                coupon_web_service: "link"
         | 
| 27 | 
            +
              }
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              RESULT = {
         | 
| 30 | 
            +
                product_search: "result",
         | 
| 31 | 
            +
                coupon_web_service: "couponfeed"
         | 
| 32 | 
            +
              }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              PAGE_NUMBER = {
         | 
| 35 | 
            +
                product_search: "PageNumber",
         | 
| 36 | 
            +
                coupon_web_service: "PageNumberRequested"
         | 
| 19 37 | 
             
              }
         | 
| 20 38 |  | 
| 21 39 | 
             
              @api_timeout  = 30
         | 
| @@ -40,4 +58,9 @@ module LinkshareAPI | |
| 40 58 | 
             
                product_search = LinkshareAPI::ProductSearch.new
         | 
| 41 59 | 
             
                product_search.query(options)
         | 
| 42 60 | 
             
              end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
              def self.coupon_web_service(options = {})
         | 
| 63 | 
            +
                coupon_web_service = LinkshareAPI::CouponWebService.new
         | 
| 64 | 
            +
                coupon_web_service.query(options)
         | 
| 65 | 
            +
              end
         | 
| 43 66 | 
             
            end
         | 
| @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            require "addressable/uri"
         | 
| 2 | 
            +
            require "httparty"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module LinkshareAPI
         | 
| 5 | 
            +
              # For implementation details please visit
         | 
| 6 | 
            +
              # http://helpcenter.linkshare.com/publisher/questions.php?questionid=865
         | 
| 7 | 
            +
              class CouponWebService
         | 
| 8 | 
            +
                include HTTParty
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                attr_reader :api_base_url, :api_timeout, :token
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def initialize
         | 
| 13 | 
            +
                  @token        = LinkshareAPI.token
         | 
| 14 | 
            +
                  @api_base_url = LinkshareAPI::WEB_SERVICE_URIS[:coupon_web_service]
         | 
| 15 | 
            +
                  @api_timeout  = LinkshareAPI.api_timeout
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  if @token.nil?
         | 
| 18 | 
            +
                    raise AuthenticationError.new(
         | 
| 19 | 
            +
                      "No token. Set your token by using 'LinkshareAPI.token = <TOKEN>'. " +
         | 
| 20 | 
            +
                      "You can retrieve your token from LinkhShare's Web Services page under the Links tab. " +
         | 
| 21 | 
            +
                      "See http://helpcenter.linkshare.com/publisher/questions.php?questionid=648 for details."
         | 
| 22 | 
            +
                    )
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                def query(params)
         | 
| 27 | 
            +
                  raise ArgumentError, "Hash expected, got #{params.class} instead" unless params.is_a?(Hash)
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  params.merge!(token: token)
         | 
| 30 | 
            +
                  begin
         | 
| 31 | 
            +
                    response = self.class.get(
         | 
| 32 | 
            +
                      api_base_url,
         | 
| 33 | 
            +
                      query: params,
         | 
| 34 | 
            +
                      timeout: api_timeout
         | 
| 35 | 
            +
                    )
         | 
| 36 | 
            +
                  rescue Timeout::Error
         | 
| 37 | 
            +
                    raise ConnectionError.new("Timeout error (#{timeout}s)")
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                  if response.code != 200
         | 
| 41 | 
            +
                    raise Error.new(response.message, response.code)
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
                  error = response["fault"]
         | 
| 44 | 
            +
                  raise InvalidRequestError.new(error["errorstring"], error["errorcode"].to_i) if error
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  Response.new(response, :coupon_web_service)
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
            end
         | 
| @@ -14,6 +14,7 @@ module LinkshareAPI | |
| 14 14 | 
             
                  @token        = LinkshareAPI.token
         | 
| 15 15 | 
             
                  @api_base_url = LinkshareAPI::WEB_SERVICE_URIS[:link_generator]
         | 
| 16 16 | 
             
                  @api_timeout  = LinkshareAPI.api_timeout
         | 
| 17 | 
            +
             | 
| 17 18 | 
             
                  if @token.nil?
         | 
| 18 19 | 
             
                    raise AuthenticationError.new(
         | 
| 19 20 | 
             
                      "No token. Set your token by using 'LinkshareAPI.token = <TOKEN>'. " +
         | 
| @@ -4,14 +4,14 @@ module LinkshareAPI | |
| 4 4 | 
             
              class Response
         | 
| 5 5 | 
             
                attr_reader :total_matches, :total_pages, :page_number, :data, :request
         | 
| 6 6 |  | 
| 7 | 
            -
                def initialize(response)
         | 
| 7 | 
            +
                def initialize(response, from)
         | 
| 8 8 | 
             
                  @request = response.request
         | 
| 9 | 
            -
                  result = response[ | 
| 10 | 
            -
             | 
| 9 | 
            +
                  result = response[LinkshareAPI::RESULT[from]]
         | 
| 10 | 
            +
                  @from = from
         | 
| 11 11 | 
             
                  @total_matches = result["TotalMatches"].to_i
         | 
| 12 12 | 
             
                  @total_pages = result["TotalPages"].to_i
         | 
| 13 | 
            -
                  @page_number = result[ | 
| 14 | 
            -
                  @data = parse(result[ | 
| 13 | 
            +
                  @page_number = result[LinkshareAPI::PAGE_NUMBER[from]].to_i
         | 
| 14 | 
            +
                  @data = parse(result[LinkshareAPI::PARSE_RESULT[from]])
         | 
| 15 15 | 
             
                end
         | 
| 16 16 |  | 
| 17 17 | 
             
                def all
         | 
| @@ -19,7 +19,12 @@ module LinkshareAPI | |
| 19 19 | 
             
                    uri = Addressable::URI.parse(request.uri)
         | 
| 20 20 | 
             
                    params = uri.query_values
         | 
| 21 21 | 
             
                    params["pagenumber"] = page_number + 1
         | 
| 22 | 
            -
             | 
| 22 | 
            +
             | 
| 23 | 
            +
                    if @from == :coupon_web_service
         | 
| 24 | 
            +
                      next_page_response = LinkshareAPI::CouponWebService.new.query(params)
         | 
| 25 | 
            +
                    else
         | 
| 26 | 
            +
                      next_page_response = LinkshareAPI::ProductSearch.new.query(params)
         | 
| 27 | 
            +
                    end
         | 
| 23 28 | 
             
                    @page_number = next_page_response.page_number
         | 
| 24 29 | 
             
                    @data += next_page_response.data
         | 
| 25 30 | 
             
                  end
         | 
    
        data/linkshare_api.gemspec
    CHANGED
    
    | @@ -19,13 +19,14 @@ Gem::Specification.new do |s| | |
| 19 19 | 
             
              s.executables           = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         | 
| 20 20 | 
             
              s.require_paths         = ["lib"]
         | 
| 21 21 |  | 
| 22 | 
            -
              s.add_dependency "addressable", "~> 2.3 | 
| 23 | 
            -
              s.add_dependency "httparty", "~> 0. | 
| 24 | 
            -
              s.add_dependency "recursive-open-struct", "~> 0.4 | 
| 22 | 
            +
              s.add_dependency "addressable", "~> 2.3"
         | 
| 23 | 
            +
              s.add_dependency "httparty", "~> 0.13"
         | 
| 24 | 
            +
              s.add_dependency "recursive-open-struct", "~> 0.4"
         | 
| 25 25 |  | 
| 26 | 
            -
              s.add_development_dependency "bundler", "~> 1. | 
| 26 | 
            +
              s.add_development_dependency "bundler", "~> 1.6"
         | 
| 27 27 | 
             
              s.add_development_dependency "rake"
         | 
| 28 28 | 
             
              s.add_development_dependency "webmock"
         | 
| 29 29 | 
             
              s.add_development_dependency "test-unit"
         | 
| 30 30 | 
             
              s.add_development_dependency "guard-test"
         | 
| 31 | 
            +
              s.add_development_dependency "pry"
         | 
| 31 32 | 
             
            end
         | 
| @@ -0,0 +1,392 @@ | |
| 1 | 
            +
            require "test_helper"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class LinkshareCouponAPITest < Test::Unit::TestCase
         | 
| 4 | 
            +
              def test_coupon_web_service_invalid_token
         | 
| 5 | 
            +
                LinkshareAPI.token = nil
         | 
| 6 | 
            +
                assert_raise LinkshareAPI::AuthenticationError do
         | 
| 7 | 
            +
                  LinkshareAPI.coupon_web_service(network: 1, mid: 38605)
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def test_coupon_web_service_internal_error
         | 
| 12 | 
            +
                LinkshareAPI.token = token
         | 
| 13 | 
            +
                xml_response = <<-XML
         | 
| 14 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 15 | 
            +
                    <fault>
         | 
| 16 | 
            +
                      <errorcode>10</errorcode>
         | 
| 17 | 
            +
                      <errorstring>Internal Error Unable To Process Request At This Time</errorstring>
         | 
| 18 | 
            +
                    </fault>
         | 
| 19 | 
            +
                XML
         | 
| 20 | 
            +
                stub_request(
         | 
| 21 | 
            +
                  :get,
         | 
| 22 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&token=#{token}"
         | 
| 23 | 
            +
                  ).
         | 
| 24 | 
            +
                  to_return(
         | 
| 25 | 
            +
                    status: 200,
         | 
| 26 | 
            +
                    body: xml_response,
         | 
| 27 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 28 | 
            +
                )
         | 
| 29 | 
            +
                e = assert_raise LinkshareAPI::InvalidRequestError do
         | 
| 30 | 
            +
                  LinkshareAPI.coupon_web_service(network: 1)
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
                assert_equal 10, e.code
         | 
| 33 | 
            +
                assert_equal "Internal Error Unable To Process Request At This Time", e.message
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def test_coupon_web_service_usage_limited
         | 
| 37 | 
            +
                LinkshareAPI.token = token
         | 
| 38 | 
            +
                xml_response = <<-XML
         | 
| 39 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 40 | 
            +
                    <fault>
         | 
| 41 | 
            +
                      <errorcode>30</errorcode>
         | 
| 42 | 
            +
                      <errorstring>Usage Quota Exceeded</errorstring>
         | 
| 43 | 
            +
                    </fault>
         | 
| 44 | 
            +
                XML
         | 
| 45 | 
            +
                stub_request(
         | 
| 46 | 
            +
                  :get,
         | 
| 47 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&token=#{token}"
         | 
| 48 | 
            +
                  ).
         | 
| 49 | 
            +
                  to_return(
         | 
| 50 | 
            +
                    status: 200,
         | 
| 51 | 
            +
                    body: xml_response,
         | 
| 52 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 53 | 
            +
                )
         | 
| 54 | 
            +
                e = assert_raise LinkshareAPI::InvalidRequestError do
         | 
| 55 | 
            +
                  LinkshareAPI.coupon_web_service(network: 1)
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
                assert_equal 30, e.code
         | 
| 58 | 
            +
                assert_equal "Usage Quota Exceeded", e.message
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              def test_coupon_web_service_invalid_or_missing_parameters
         | 
| 62 | 
            +
                LinkshareAPI.token = token
         | 
| 63 | 
            +
                xml_response = <<-XML
         | 
| 64 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 65 | 
            +
                    <fault>
         | 
| 66 | 
            +
                      <errorcode>40</errorcode>
         | 
| 67 | 
            +
                      <errorstring>Invalid Request</errorstring>
         | 
| 68 | 
            +
                    </fault>
         | 
| 69 | 
            +
                XML
         | 
| 70 | 
            +
                stub_request(
         | 
| 71 | 
            +
                  :get,
         | 
| 72 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=15&token=#{token}"
         | 
| 73 | 
            +
                  ).
         | 
| 74 | 
            +
                  to_return(
         | 
| 75 | 
            +
                    status: 200,
         | 
| 76 | 
            +
                    body: xml_response,
         | 
| 77 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 78 | 
            +
                )
         | 
| 79 | 
            +
                e = assert_raise LinkshareAPI::InvalidRequestError do
         | 
| 80 | 
            +
                  LinkshareAPI.coupon_web_service(network: 15)
         | 
| 81 | 
            +
                end
         | 
| 82 | 
            +
                assert_equal 40, e.code
         | 
| 83 | 
            +
                assert_equal "Invalid Request", e.message
         | 
| 84 | 
            +
              end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
              def test_coupon_web_service_invalid_or_not_approved_token
         | 
| 87 | 
            +
                LinkshareAPI.token = token
         | 
| 88 | 
            +
                xml_response = <<-XML
         | 
| 89 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 90 | 
            +
                    <fault>
         | 
| 91 | 
            +
                      <errorcode>20</errorcode>
         | 
| 92 | 
            +
                      <errorstring>Access Denied Token ID Is Invalid or Not Approved for Coupon Feed</errorstring>
         | 
| 93 | 
            +
                    </fault>
         | 
| 94 | 
            +
                XML
         | 
| 95 | 
            +
                stub_request(
         | 
| 96 | 
            +
                  :get,
         | 
| 97 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=15&token=#{token}"
         | 
| 98 | 
            +
                  ).
         | 
| 99 | 
            +
                  to_return(
         | 
| 100 | 
            +
                    status: 200,
         | 
| 101 | 
            +
                    body: xml_response,
         | 
| 102 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 103 | 
            +
                )
         | 
| 104 | 
            +
                e = assert_raise LinkshareAPI::InvalidRequestError do
         | 
| 105 | 
            +
                  LinkshareAPI.coupon_web_service(network: 15)
         | 
| 106 | 
            +
                end
         | 
| 107 | 
            +
                assert_equal 20, e.code
         | 
| 108 | 
            +
                assert_equal "Access Denied Token ID Is Invalid or Not Approved for Coupon Feed", e.message
         | 
| 109 | 
            +
              end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
              def test_coupon_web_service_with_no_results
         | 
| 112 | 
            +
                LinkshareAPI.token = token
         | 
| 113 | 
            +
                xml_response = <<-XML
         | 
| 114 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 115 | 
            +
                    <couponfeed>
         | 
| 116 | 
            +
                      <TotalMatches>0</TotalMatches>
         | 
| 117 | 
            +
                      <TotalPages>0</TotalPages>
         | 
| 118 | 
            +
                      <PageNumberRequested>1</PageNumberRequested>
         | 
| 119 | 
            +
                    </couponfeed>
         | 
| 120 | 
            +
                XML
         | 
| 121 | 
            +
                stub_request(
         | 
| 122 | 
            +
                  :get,
         | 
| 123 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&promotiontype=30&token=#{token}"
         | 
| 124 | 
            +
                  ).
         | 
| 125 | 
            +
                  to_return(
         | 
| 126 | 
            +
                    status: 200,
         | 
| 127 | 
            +
                    body: xml_response,
         | 
| 128 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 129 | 
            +
                )
         | 
| 130 | 
            +
                response = LinkshareAPI.coupon_web_service(network: 1, promotiontype: 30)
         | 
| 131 | 
            +
                assert_equal 0, response.total_matches
         | 
| 132 | 
            +
                assert_equal 0, response.total_pages
         | 
| 133 | 
            +
                assert_equal 1, response.page_number
         | 
| 134 | 
            +
                assert_equal [], response.data
         | 
| 135 | 
            +
              end
         | 
| 136 | 
            +
             | 
| 137 | 
            +
              def test_with_valid_results
         | 
| 138 | 
            +
                LinkshareAPI.token = token
         | 
| 139 | 
            +
                xml_response = <<-XML.strip
         | 
| 140 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 141 | 
            +
                    <couponfeed>
         | 
| 142 | 
            +
                      <TotalMatches>1</TotalMatches>
         | 
| 143 | 
            +
                      <TotalPages>1</TotalPages>
         | 
| 144 | 
            +
                      <PageNumberRequested>1</PageNumberRequested>
         | 
| 145 | 
            +
                    <link type="TEXT">
         | 
| 146 | 
            +
                      <categories>
         | 
| 147 | 
            +
                        <category id="983">computers</category>
         | 
| 148 | 
            +
                        <category id="12">electronics</category>
         | 
| 149 | 
            +
                        <category id="14">gifts</category>
         | 
| 150 | 
            +
                      </categories>
         | 
| 151 | 
            +
                      <promotiontypes>
         | 
| 152 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 153 | 
            +
                      </promotiontypes>
         | 
| 154 | 
            +
                      <offerdescription>15 percent off</offerdescription>
         | 
| 155 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 156 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 157 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 158 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 159 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 160 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 161 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 162 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 163 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 164 | 
            +
                    </link>
         | 
| 165 | 
            +
                    <link type="TEXT">
         | 
| 166 | 
            +
                      <categories>
         | 
| 167 | 
            +
                        <category id="983">computers</category>
         | 
| 168 | 
            +
                        <category id="12">electronics</category>
         | 
| 169 | 
            +
                        <category id="14">gifts</category>
         | 
| 170 | 
            +
                      </categories>
         | 
| 171 | 
            +
                      <promotiontypes>
         | 
| 172 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 173 | 
            +
                      </promotiontypes>
         | 
| 174 | 
            +
                      <offerdescription>10 percent off</offerdescription>
         | 
| 175 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 176 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 177 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 178 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 179 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 180 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 181 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 182 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 183 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 184 | 
            +
                    </link>
         | 
| 185 | 
            +
                    </couponfeed>
         | 
| 186 | 
            +
                XML
         | 
| 187 | 
            +
                stub_request(
         | 
| 188 | 
            +
                  :get,
         | 
| 189 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&promotiontype=22&token=#{token}"
         | 
| 190 | 
            +
                  ).
         | 
| 191 | 
            +
                  to_return(
         | 
| 192 | 
            +
                    status: 200,
         | 
| 193 | 
            +
                    body: xml_response,
         | 
| 194 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 195 | 
            +
                )
         | 
| 196 | 
            +
             | 
| 197 | 
            +
                response = LinkshareAPI.coupon_web_service(network: 1, promotiontype: 22)
         | 
| 198 | 
            +
                assert_equal 1, response.total_matches
         | 
| 199 | 
            +
                assert_equal 1, response.total_pages
         | 
| 200 | 
            +
                assert_equal 1, response.page_number
         | 
| 201 | 
            +
                assert_equal "KJEISLD", response.data.first.couponcode
         | 
| 202 | 
            +
                assert_equal "10 percent off", response.data.last.offerdescription
         | 
| 203 | 
            +
              end
         | 
| 204 | 
            +
             | 
| 205 | 
            +
              def test_all_with_valid_results
         | 
| 206 | 
            +
                LinkshareAPI.token = token
         | 
| 207 | 
            +
                xml_response1 = <<-XML.strip
         | 
| 208 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 209 | 
            +
                    <couponfeed>
         | 
| 210 | 
            +
                      <TotalMatches>6</TotalMatches>
         | 
| 211 | 
            +
                      <TotalPages>3</TotalPages>
         | 
| 212 | 
            +
                      <PageNumberRequested>1</PageNumberRequested>
         | 
| 213 | 
            +
                    <link type="TEXT">
         | 
| 214 | 
            +
                      <categories>
         | 
| 215 | 
            +
                        <category id="983">computers</category>
         | 
| 216 | 
            +
                        <category id="12">electronics</category>
         | 
| 217 | 
            +
                        <category id="14">gifts</category>
         | 
| 218 | 
            +
                      </categories>
         | 
| 219 | 
            +
                      <promotiontypes>
         | 
| 220 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 221 | 
            +
                      </promotiontypes>
         | 
| 222 | 
            +
                      <offerdescription>15 percent off</offerdescription>
         | 
| 223 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 224 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 225 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 226 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 227 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 228 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 229 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 230 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 231 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 232 | 
            +
                    </link>
         | 
| 233 | 
            +
                    <link type="TEXT">
         | 
| 234 | 
            +
                      <categories>
         | 
| 235 | 
            +
                        <category id="983">computers</category>
         | 
| 236 | 
            +
                        <category id="12">electronics</category>
         | 
| 237 | 
            +
                        <category id="14">gifts</category>
         | 
| 238 | 
            +
                      </categories>
         | 
| 239 | 
            +
                      <promotiontypes>
         | 
| 240 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 241 | 
            +
                      </promotiontypes>
         | 
| 242 | 
            +
                      <offerdescription>10 percent off</offerdescription>
         | 
| 243 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 244 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 245 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 246 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 247 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 248 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 249 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 250 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 251 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 252 | 
            +
                    </link>
         | 
| 253 | 
            +
                    </couponfeed>
         | 
| 254 | 
            +
                XML
         | 
| 255 | 
            +
                xml_response2 = <<-XML.strip
         | 
| 256 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 257 | 
            +
                    <couponfeed>
         | 
| 258 | 
            +
                      <TotalMatches>6</TotalMatches>
         | 
| 259 | 
            +
                      <TotalPages>3</TotalPages>
         | 
| 260 | 
            +
                      <PageNumberRequested>2</PageNumberRequested>
         | 
| 261 | 
            +
                    <link type="TEXT">
         | 
| 262 | 
            +
                      <categories>
         | 
| 263 | 
            +
                        <category id="983">computers</category>
         | 
| 264 | 
            +
                        <category id="12">electronics</category>
         | 
| 265 | 
            +
                        <category id="14">gifts</category>
         | 
| 266 | 
            +
                      </categories>
         | 
| 267 | 
            +
                      <promotiontypes>
         | 
| 268 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 269 | 
            +
                      </promotiontypes>
         | 
| 270 | 
            +
                      <offerdescription>15 percent off</offerdescription>
         | 
| 271 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 272 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 273 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 274 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 275 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 276 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 277 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 278 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 279 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 280 | 
            +
                    </link>
         | 
| 281 | 
            +
                    <link type="TEXT">
         | 
| 282 | 
            +
                      <categories>
         | 
| 283 | 
            +
                        <category id="983">computers</category>
         | 
| 284 | 
            +
                        <category id="12">electronics</category>
         | 
| 285 | 
            +
                        <category id="14">gifts</category>
         | 
| 286 | 
            +
                      </categories>
         | 
| 287 | 
            +
                      <promotiontypes>
         | 
| 288 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 289 | 
            +
                      </promotiontypes>
         | 
| 290 | 
            +
                      <offerdescription>10 percent off</offerdescription>
         | 
| 291 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 292 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 293 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 294 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 295 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 296 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 297 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 298 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 299 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 300 | 
            +
                    </link>
         | 
| 301 | 
            +
                    </couponfeed>
         | 
| 302 | 
            +
                XML
         | 
| 303 | 
            +
                xml_response3 = <<-XML.strip
         | 
| 304 | 
            +
                  <?xml version="1.0" encoding="UTF-8"?>
         | 
| 305 | 
            +
                    <couponfeed>
         | 
| 306 | 
            +
                      <TotalMatches>6</TotalMatches>
         | 
| 307 | 
            +
                      <TotalPages>3</TotalPages>
         | 
| 308 | 
            +
                      <PageNumberRequested>3</PageNumberRequested>
         | 
| 309 | 
            +
                    <link type="TEXT">
         | 
| 310 | 
            +
                      <categories>
         | 
| 311 | 
            +
                        <category id="983">computers</category>
         | 
| 312 | 
            +
                        <category id="12">electronics</category>
         | 
| 313 | 
            +
                        <category id="14">gifts</category>
         | 
| 314 | 
            +
                      </categories>
         | 
| 315 | 
            +
                      <promotiontypes>
         | 
| 316 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 317 | 
            +
                      </promotiontypes>
         | 
| 318 | 
            +
                      <offerdescription>15 percent off</offerdescription>
         | 
| 319 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 320 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 321 | 
            +
                      <couponcode>KJEISLD</couponcode>
         | 
| 322 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 323 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 324 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 325 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 326 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 327 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 328 | 
            +
                    </link>
         | 
| 329 | 
            +
                    <link type="TEXT">
         | 
| 330 | 
            +
                      <categories>
         | 
| 331 | 
            +
                        <category id="983">computers</category>
         | 
| 332 | 
            +
                        <category id="12">electronics</category>
         | 
| 333 | 
            +
                        <category id="14">gifts</category>
         | 
| 334 | 
            +
                      </categories>
         | 
| 335 | 
            +
                      <promotiontypes>
         | 
| 336 | 
            +
                        <promotiontype id="22">percentage off</promotiontype>
         | 
| 337 | 
            +
                      </promotiontypes>
         | 
| 338 | 
            +
                      <offerdescription>10 percent off</offerdescription>
         | 
| 339 | 
            +
                      <offerstartdate>2009-04-01</offerstartdate>
         | 
| 340 | 
            +
                      <offerenddate>2009-05-31</offerenddate>
         | 
| 341 | 
            +
                      <couponcode>KIRK</couponcode>
         | 
| 342 | 
            +
                      <couponrestriction>New Customers Only</couponrestriction>
         | 
| 343 | 
            +
                      <clickurl>http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=164317.10002595&type=4&subid=0</clickurl>
         | 
| 344 | 
            +
                      <impressionpixel>http://ad.linksynergy.com/fs-bin/show?id=XXXXXXXXXXX&bids=164317.10002595&type=4&subid=0</impressionpixel>
         | 
| 345 | 
            +
                      <advertiserid>000</advertiserid>
         | 
| 346 | 
            +
                      <advertisername>Sample Advertiser Name</advertisername>
         | 
| 347 | 
            +
                      <network id="1">Linkshare Network</network>
         | 
| 348 | 
            +
                    </link>
         | 
| 349 | 
            +
                    </couponfeed>
         | 
| 350 | 
            +
                XML
         | 
| 351 | 
            +
                stub_request(
         | 
| 352 | 
            +
                  :get,
         | 
| 353 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&promotiontype=22&token=#{token}"
         | 
| 354 | 
            +
                  ).
         | 
| 355 | 
            +
                  to_return(
         | 
| 356 | 
            +
                    status: 200,
         | 
| 357 | 
            +
                    body: xml_response1,
         | 
| 358 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 359 | 
            +
                )
         | 
| 360 | 
            +
                stub_request(
         | 
| 361 | 
            +
                  :get,
         | 
| 362 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&promotiontype=22&pagenumber=2&token=#{token}"
         | 
| 363 | 
            +
                  ).
         | 
| 364 | 
            +
                  to_return(
         | 
| 365 | 
            +
                    status: 200,
         | 
| 366 | 
            +
                    body: xml_response2,
         | 
| 367 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 368 | 
            +
                )
         | 
| 369 | 
            +
                stub_request(
         | 
| 370 | 
            +
                  :get,
         | 
| 371 | 
            +
                  "http://couponfeed.linksynergy.com/coupon?network=1&promotiontype=22&pagenumber=3&token=#{token}"
         | 
| 372 | 
            +
                  ).
         | 
| 373 | 
            +
                  to_return(
         | 
| 374 | 
            +
                    status: 200,
         | 
| 375 | 
            +
                    body: xml_response3,
         | 
| 376 | 
            +
                    headers: { "Content-type" => "text/xml; charset=UTF-8" }
         | 
| 377 | 
            +
                )
         | 
| 378 | 
            +
             | 
| 379 | 
            +
                data = LinkshareAPI.coupon_web_service(network: 1, promotiontype: 22).all
         | 
| 380 | 
            +
                assert_equal "KJEISLD", data.first.couponcode
         | 
| 381 | 
            +
                assert_equal "KIRK", data.last.couponcode
         | 
| 382 | 
            +
             | 
| 383 | 
            +
              end
         | 
| 384 | 
            +
             | 
| 385 | 
            +
              private
         | 
| 386 | 
            +
             | 
| 387 | 
            +
              def token
         | 
| 388 | 
            +
                "abcdef"
         | 
| 389 | 
            +
              end
         | 
| 390 | 
            +
             | 
| 391 | 
            +
            end
         | 
| 392 | 
            +
             
         | 
    
        metadata
    CHANGED
    
    | @@ -1,142 +1,139 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: linkshare_api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 0.2.0
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - Razvan Marescu
         | 
| 9 8 | 
             
            autorequire: 
         | 
| 10 9 | 
             
            bindir: bin
         | 
| 11 10 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-05-07 00:00:00.000000000 Z
         | 
| 13 12 | 
             
            dependencies:
         | 
| 14 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 14 | 
             
              name: addressable
         | 
| 16 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 16 | 
             
                requirements:
         | 
| 19 | 
            -
                - - ~>
         | 
| 17 | 
            +
                - - "~>"
         | 
| 20 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: 2.3 | 
| 19 | 
            +
                    version: '2.3'
         | 
| 22 20 | 
             
              type: :runtime
         | 
| 23 21 | 
             
              prerelease: false
         | 
| 24 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            -
                none: false
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 | 
            -
                - - ~>
         | 
| 24 | 
            +
                - - "~>"
         | 
| 28 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: 2.3 | 
| 26 | 
            +
                    version: '2.3'
         | 
| 30 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 28 | 
             
              name: httparty
         | 
| 32 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            -
                none: false
         | 
| 34 30 | 
             
                requirements:
         | 
| 35 | 
            -
                - - ~>
         | 
| 31 | 
            +
                - - "~>"
         | 
| 36 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            -
                    version: 0. | 
| 33 | 
            +
                    version: '0.13'
         | 
| 38 34 | 
             
              type: :runtime
         | 
| 39 35 | 
             
              prerelease: false
         | 
| 40 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 37 | 
             
                requirements:
         | 
| 43 | 
            -
                - - ~>
         | 
| 38 | 
            +
                - - "~>"
         | 
| 44 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            -
                    version: 0. | 
| 40 | 
            +
                    version: '0.13'
         | 
| 46 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 42 | 
             
              name: recursive-open-struct
         | 
| 48 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 44 | 
             
                requirements:
         | 
| 51 | 
            -
                - - ~>
         | 
| 45 | 
            +
                - - "~>"
         | 
| 52 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            -
                    version: 0.4 | 
| 47 | 
            +
                    version: '0.4'
         | 
| 54 48 | 
             
              type: :runtime
         | 
| 55 49 | 
             
              prerelease: false
         | 
| 56 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            -
                none: false
         | 
| 58 51 | 
             
                requirements:
         | 
| 59 | 
            -
                - - ~>
         | 
| 52 | 
            +
                - - "~>"
         | 
| 60 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: 0.4 | 
| 54 | 
            +
                    version: '0.4'
         | 
| 62 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 56 | 
             
              name: bundler
         | 
| 64 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 58 | 
             
                requirements:
         | 
| 67 | 
            -
                - - ~>
         | 
| 59 | 
            +
                - - "~>"
         | 
| 68 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version: '1. | 
| 61 | 
            +
                    version: '1.6'
         | 
| 70 62 | 
             
              type: :development
         | 
| 71 63 | 
             
              prerelease: false
         | 
| 72 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            -
                none: false
         | 
| 74 65 | 
             
                requirements:
         | 
| 75 | 
            -
                - - ~>
         | 
| 66 | 
            +
                - - "~>"
         | 
| 76 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            -
                    version: '1. | 
| 68 | 
            +
                    version: '1.6'
         | 
| 78 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 70 | 
             
              name: rake
         | 
| 80 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            -
                none: false
         | 
| 82 72 | 
             
                requirements:
         | 
| 83 | 
            -
                - -  | 
| 73 | 
            +
                - - ">="
         | 
| 84 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 75 | 
             
                    version: '0'
         | 
| 86 76 | 
             
              type: :development
         | 
| 87 77 | 
             
              prerelease: false
         | 
| 88 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            -
                none: false
         | 
| 90 79 | 
             
                requirements:
         | 
| 91 | 
            -
                - -  | 
| 80 | 
            +
                - - ">="
         | 
| 92 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 82 | 
             
                    version: '0'
         | 
| 94 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 95 84 | 
             
              name: webmock
         | 
| 96 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 97 | 
            -
                none: false
         | 
| 98 86 | 
             
                requirements:
         | 
| 99 | 
            -
                - -  | 
| 87 | 
            +
                - - ">="
         | 
| 100 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 101 89 | 
             
                    version: '0'
         | 
| 102 90 | 
             
              type: :development
         | 
| 103 91 | 
             
              prerelease: false
         | 
| 104 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 105 | 
            -
                none: false
         | 
| 106 93 | 
             
                requirements:
         | 
| 107 | 
            -
                - -  | 
| 94 | 
            +
                - - ">="
         | 
| 108 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 96 | 
             
                    version: '0'
         | 
| 110 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 98 | 
             
              name: test-unit
         | 
| 112 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 | 
            -
                none: false
         | 
| 114 100 | 
             
                requirements:
         | 
| 115 | 
            -
                - -  | 
| 101 | 
            +
                - - ">="
         | 
| 116 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 103 | 
             
                    version: '0'
         | 
| 118 104 | 
             
              type: :development
         | 
| 119 105 | 
             
              prerelease: false
         | 
| 120 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                none: false
         | 
| 122 107 | 
             
                requirements:
         | 
| 123 | 
            -
                - -  | 
| 108 | 
            +
                - - ">="
         | 
| 124 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 110 | 
             
                    version: '0'
         | 
| 126 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 127 112 | 
             
              name: guard-test
         | 
| 128 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 129 | 
            -
                none: false
         | 
| 130 114 | 
             
                requirements:
         | 
| 131 | 
            -
                - -  | 
| 115 | 
            +
                - - ">="
         | 
| 132 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 133 117 | 
             
                    version: '0'
         | 
| 134 118 | 
             
              type: :development
         | 
| 135 119 | 
             
              prerelease: false
         | 
| 136 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            -
                none: false
         | 
| 138 121 | 
             
                requirements:
         | 
| 139 | 
            -
                - -  | 
| 122 | 
            +
                - - ">="
         | 
| 123 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            +
                    version: '0'
         | 
| 125 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            +
              name: pry
         | 
| 127 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                requirements:
         | 
| 129 | 
            +
                - - ">="
         | 
| 130 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            +
                    version: '0'
         | 
| 132 | 
            +
              type: :development
         | 
| 133 | 
            +
              prerelease: false
         | 
| 134 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            +
                requirements:
         | 
| 136 | 
            +
                - - ">="
         | 
| 140 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 141 138 | 
             
                    version: '0'
         | 
| 142 139 | 
             
            description: Ruby wrapper for LinkShare Publisher Web Services. See http://helpcenter.linkshare.com/publisher/categories.php?categoryid=71.
         | 
| @@ -146,14 +143,16 @@ executables: [] | |
| 146 143 | 
             
            extensions: []
         | 
| 147 144 | 
             
            extra_rdoc_files: []
         | 
| 148 145 | 
             
            files:
         | 
| 149 | 
            -
            - .gitignore
         | 
| 150 | 
            -
            - . | 
| 146 | 
            +
            - ".gitignore"
         | 
| 147 | 
            +
            - ".ruby-version"
         | 
| 148 | 
            +
            - ".travis.yml"
         | 
| 151 149 | 
             
            - Gemfile
         | 
| 152 150 | 
             
            - Guardfile
         | 
| 153 151 | 
             
            - LICENSE.txt
         | 
| 154 152 | 
             
            - README.md
         | 
| 155 153 | 
             
            - Rakefile
         | 
| 156 154 | 
             
            - lib/linkshare_api.rb
         | 
| 155 | 
            +
            - lib/linkshare_api/coupon_web_service.rb
         | 
| 157 156 | 
             
            - lib/linkshare_api/errors/authentication_error.rb
         | 
| 158 157 | 
             
            - lib/linkshare_api/errors/connection_error.rb
         | 
| 159 158 | 
             
            - lib/linkshare_api/errors/error.rb
         | 
| @@ -164,32 +163,33 @@ files: | |
| 164 163 | 
             
            - lib/linkshare_api/version.rb
         | 
| 165 164 | 
             
            - linkshare_api.gemspec
         | 
| 166 165 | 
             
            - test/linkshare_api_test.rb
         | 
| 166 | 
            +
            - test/linkshare_coupon_api_test.rb
         | 
| 167 167 | 
             
            - test/test_helper.rb
         | 
| 168 168 | 
             
            homepage: https://github.com/rmarescu/linkshare_api
         | 
| 169 169 | 
             
            licenses:
         | 
| 170 170 | 
             
            - MIT
         | 
| 171 | 
            +
            metadata: {}
         | 
| 171 172 | 
             
            post_install_message: 
         | 
| 172 173 | 
             
            rdoc_options: []
         | 
| 173 174 | 
             
            require_paths:
         | 
| 174 175 | 
             
            - lib
         | 
| 175 176 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 176 | 
            -
              none: false
         | 
| 177 177 | 
             
              requirements:
         | 
| 178 | 
            -
              - -  | 
| 178 | 
            +
              - - ">="
         | 
| 179 179 | 
             
                - !ruby/object:Gem::Version
         | 
| 180 180 | 
             
                  version: '1.9'
         | 
| 181 181 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 182 | 
            -
              none: false
         | 
| 183 182 | 
             
              requirements:
         | 
| 184 | 
            -
              - -  | 
| 183 | 
            +
              - - ">="
         | 
| 185 184 | 
             
                - !ruby/object:Gem::Version
         | 
| 186 185 | 
             
                  version: '0'
         | 
| 187 186 | 
             
            requirements: []
         | 
| 188 187 | 
             
            rubyforge_project: 
         | 
| 189 | 
            -
            rubygems_version:  | 
| 188 | 
            +
            rubygems_version: 2.2.2
         | 
| 190 189 | 
             
            signing_key: 
         | 
| 191 | 
            -
            specification_version:  | 
| 190 | 
            +
            specification_version: 4
         | 
| 192 191 | 
             
            summary: Linkshare API
         | 
| 193 192 | 
             
            test_files:
         | 
| 194 193 | 
             
            - test/linkshare_api_test.rb
         | 
| 194 | 
            +
            - test/linkshare_coupon_api_test.rb
         | 
| 195 195 | 
             
            - test/test_helper.rb
         |