class Shipcloud::Base

Public Class Methods

base_url() click to toggle source
# File lib/shipcloud/base.rb, line 36
def self.base_url
  "#{class_name.downcase}s"
end
camel_to_snakecase(string) click to toggle source
# File lib/shipcloud/base.rb, line 24
def self.camel_to_snakecase(string)
  string.gsub(/::/, "/").
    gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
    gsub(/([a-z\d])([A-Z])/, '\1_\2').
    tr("-", "_").
    downcase
end
class_name() click to toggle source
# File lib/shipcloud/base.rb, line 32
def self.class_name
  name.split("::").last
end
create_response_root() click to toggle source
# File lib/shipcloud/base.rb, line 40
def self.create_response_root; end
index_response_root() click to toggle source
# File lib/shipcloud/base.rb, line 42
def self.index_response_root; end
new(attributes = {}) click to toggle source

Initializes an object using the given attributes

@param [Hash] attributes The attributes to use for initialization

# File lib/shipcloud/base.rb, line 11
def initialize(attributes = {})
  set_attributes(attributes)
end

Public Instance Methods

set_attributes(attributes) click to toggle source

Sets the attributes

@param [Hash] attributes The attributes to initialize

# File lib/shipcloud/base.rb, line 18
def set_attributes(attributes)
  attributes.each_pair do |key, value|
    instance_variable_set("@#{key}", value)
  end
end