Module: SirenClient

Defined in:
lib/siren_client/base.rb,
lib/siren_client/link.rb,
lib/siren_client/field.rb,
lib/siren_client/action.rb,
lib/siren_client/entity.rb,
lib/siren_client/version.rb,
lib/siren_client/exceptions.rb,
lib/siren_client/raw_response.rb,
lib/siren_client/modules/with_raw_response.rb

Defined Under Namespace

Modules: Modules Classes: Action, Entity, Field, InvalidResponseError, InvalidURIError, Link, RawResponse, StandardError

Constant Summary collapse

VERSION =
"1.0.2"

Class Method Summary collapse

Class Method Details

.get(options) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/siren_client/base.rb', line 2

def self.get(options)
  if options.is_a? String
    Entity.new(options)
  elsif options.is_a? Hash
    url = options[:url] || options['url']
    raise ArgumentError, "You must supply a valid url to SirenClient.get" unless url
    Entity.new(url, options)
  else
    raise ArgumentError, 'You must supply either a string or hash to SirenClient.get'
  end
end