Module: StorageRoom

Defined in:
lib/storage_room.rb,
lib/storage_room/model.rb,
lib/storage_room/proxy.rb,
lib/storage_room/array.rb,
lib/storage_room/plugins.rb,
lib/storage_room/version.rb,
lib/storage_room/resource.rb,
lib/storage_room/embedded.rb,
lib/storage_room/accessors.rb,
lib/storage_room/models/entry.rb,
lib/storage_room/identity_map.rb,
lib/storage_room/webhook_call.rb,
lib/storage_room/embeddeds/file.rb,
lib/storage_room/embeddeds/image.rb,
lib/storage_room/embeddeds/field.rb,
lib/storage_room/models/collection.rb,
lib/storage_room/extensions/symbol.rb,
lib/storage_room/embeddeds/location.rb,
lib/storage_room/models/deleted_entry.rb,
lib/storage_room/embeddeds/image_version.rb,
lib/storage_room/extensions/const_defined.rb,
lib/storage_room/embeddeds/webhook_definition.rb,
lib/storage_room/embeddeds/fields/atomic_field.rb,
lib/storage_room/embeddeds/fields/compound_field.rb,
lib/storage_room/embeddeds/fields/atomic/time_field.rb,
lib/storage_room/embeddeds/fields/association_field.rb,
lib/storage_room/embeddeds/fields/atomic/json_field.rb,
lib/storage_room/embeddeds/fields/atomic/date_field.rb,
lib/storage_room/embeddeds/fields/atomic/float_field.rb,
lib/storage_room/embeddeds/fields/atomic/array_field.rb,
lib/storage_room/embeddeds/fields/compound/file_field.rb,
lib/storage_room/embeddeds/fields/atomic/string_field.rb,
lib/storage_room/embeddeds/fields/atomic/boolean_field.rb,
lib/storage_room/embeddeds/fields/atomic/integer_field.rb,
lib/storage_room/embeddeds/fields/compound/image_field.rb,
lib/storage_room/embeddeds/fields/compound/location_field.rb,
lib/storage_room/embeddeds/fields/compound/attachment_field.rb,
lib/storage_room/embeddeds/fields/associations/one_association_field.rb,
lib/storage_room/embeddeds/fields/associations/many_association_field.rb

Defined Under Namespace

Modules: Accessors, Extensions, IdentityMap, Plugins Classes: AbstractMethodError, Array, ArrayField, AssociationField, AtomicField, AttachmentField, BooleanField, ClassNotFoundError, Collection, CompoundField, DateField, DeletedEntry, Embedded, Entry, Field, File, FileField, FloatField, Image, ImageField, ImageVersion, IntegerField, JsonField, Location, LocationField, ManyAssociationField, Model, OneAssociationField, OptimisticLockingError, Proxy, RequestFailedError, Resource, ResourceNotLoadedError, StringField, TimeField, WebhookCall, WebhookDefinition

Constant Summary

VERSION =
'0.3.23'

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (Object) account_id (readonly)

Returns the value of attribute account_id



71
72
73
# File 'lib/storage_room.rb', line 71

def 
  @account_id
end

+ (Object) api_key (readonly)

Returns the value of attribute api_key



71
72
73
# File 'lib/storage_room.rb', line 71

def api_key
  @api_key
end

+ (Object) debug

Returns the value of attribute debug



72
73
74
# File 'lib/storage_room.rb', line 72

def debug
  @debug
end

+ (Object) proxy_port (readonly)

Returns the value of attribute proxy_port



71
72
73
# File 'lib/storage_room.rb', line 71

def proxy_port
  @proxy_port
end

+ (Object) proxy_server (readonly)

Returns the value of attribute proxy_server



71
72
73
# File 'lib/storage_room.rb', line 71

def proxy_server
  @proxy_server
end

+ (Object) ssl

Returns the value of attribute ssl



71
72
73
# File 'lib/storage_room.rb', line 71

def ssl
  @ssl
end

+ (Object) timeout

:nodoc:



103
104
105
# File 'lib/storage_room.rb', line 103

def timeout
  @timeout
end

+ (Object) user_agent

Returns the value of attribute user_agent



71
72
73
# File 'lib/storage_room.rb', line 71

def user_agent
  @user_agent
end

Class Method Details

+ (Object) add_entry_class_mapping(name, class_name)

Add a new mapping



120
121
122
# File 'lib/storage_room.rb', line 120

def add_entry_class_mapping(name, class_name)
  self.entry_class_mappings[name] = class_name.to_s
end

+ (Object) authenticate(account_id, api_key)

Authenticate once before making any requests with your account id and the application's api key



75
76
77
78
79
80
# File 'lib/storage_room.rb', line 75

def authenticate(, api_key)
  Resource.basic_auth(api_key, 'X')
  @api_key = api_key
  @account_id = 
  update_uri
end

+ (Object) class_for_name(name)

Return a Ruby class for a StorageRoom type



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/storage_room.rb', line 146

def class_for_name(name)     
  name_with_mapping = entry_class_for_name(name)
  
  begin
    if StorageRoom.is_constant_defined?(name_with_mapping)
      return "StorageRoom::#{name_with_mapping}".constantize
    end
  rescue NameError # could contain spaces etc.
  end
    
  begin
    return name_with_mapping.constantize
  rescue NameError
    raise ClassNotFoundError.new("Unknown class: #{name}")
  end
end

+ (Object) entry_class_for_name(name)

:nodoc:



124
125
126
# File 'lib/storage_room.rb', line 124

def entry_class_for_name(name) #:nodoc:
  self.entry_class_mappings[name] || name
end

+ (Object) entry_class_mappings

Hash of all mappings from an Entry's @type to a local Ruby class, if a mapping doesn't exist a class name will be created automatically



115
116
117
# File 'lib/storage_room.rb', line 115

def entry_class_mappings
  @entry_class_mappings ||= {}
end

+ (Object) http_proxy(server, port)

Set an HTTP proxy server



139
140
141
142
143
# File 'lib/storage_room.rb', line 139

def http_proxy(server, port)
  @proxy_server = server
  @proxy_port = port
  Resource.http_proxy(server, port)
end

+ (Object) log(msg)

:nodoc:



163
164
165
# File 'lib/storage_room.rb', line 163

def log(msg) #:nodoc:
  puts("[DEBUG] #{msg}") if debug
end

+ (Object) request_options

Return the request options used by HTTParty



108
109
110
111
112
# File 'lib/storage_room.rb', line 108

def request_options
  {
    :timeout => timeout
  }
end

+ (Object) server

:nodoc:



94
95
96
# File 'lib/storage_room.rb', line 94

def server #:nodoc:
  @server || 'api.storageroomapp.com'
end

+ (Object) server=(server)

Change the server to connect to. This should only be relevant for developers of the library.



89
90
91
92
# File 'lib/storage_room.rb', line 89

def server=(server) #:nodoc:
  @server = server
  update_uri
end

+ (Object) version



128
129
130
# File 'lib/storage_room.rb', line 128

def version
  StorageRoom::VERSION
end