Class: Etsy::BasicClient

Inherits:
Object
  • Object
show all
Defined in:
lib/etsy/basic_client.rb

Overview

BasicClient

Used for calling public API methods.

Instance Method Summary collapse

Constructor Details

#initializeBasicClient

Create a new client that will connect to the specified host



11
12
13
# File 'lib/etsy/basic_client.rb', line 11

def initialize
  @host = Etsy.host
end

Instance Method Details

#clientObject

:nodoc:



15
16
17
18
19
20
21
22
23
# File 'lib/etsy/basic_client.rb', line 15

def client # :nodoc:
  if @client
    return @client
  else
    @client = Net::HTTP.new(@host, Etsy.protocol == "http" ? 80 : 443)
    @client.use_ssl = true if Etsy.protocol == "https"
    return @client
  end
end

#get(endpoint) ⇒ Object

Fetch a raw response from the specified endpoint



27
28
29
# File 'lib/etsy/basic_client.rb', line 27

def get(endpoint)
  client.get(endpoint)
end