Sha256: d9ed9dcc6491b19c6ca28b139f48a03aea18c5bafc6e3ad245bb8056bb7ec5b9

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

module OneAndOne


  class Pricing


    def initialize(test: false)

      # Check if hitting mock api or live api
      if test
        @connection = Excon.new($base_url, :mock => true)
      else
        @connection = Excon.new($base_url)
      end

    end


    def list

      # Build URL
      path = OneAndOne.build_url('/pricing')

      # Perform request
      response = @connection.request(:method => :get,
        :path => path,
        :headers => $header)

      # Check response status
      OneAndOne.check_response(response.body, response.status)

      #JSON-ify the response string
      JSON.parse(response.body)

    end


  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
1and1-1.3.0 lib/1and1/pricing.rb
1and1-1.2.0 lib/1and1/pricing.rb
1and1-1.1 lib/1and1/pricing.rb