class OneAndOne::Pricing

Public Class Methods

new(test: false) click to toggle source
# File lib/1and1/pricing.rb, line 7
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

Public Instance Methods

list() click to toggle source
# File lib/1and1/pricing.rb, line 19
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