lib/j7w1/configuration.rb in j7w1-0.0.13 vs lib/j7w1/configuration.rb in j7w1-0.0.14
- old
+ new
@@ -1,26 +1,32 @@
module J7W1
class Configuration
include J7W1::Util
+ module MobileEndpoint
+ def arn
+ self[:arn]
+ end
+ end
+
module IOSEndpoint
+ def self.extended(obj)
+ obj.__send__ :extend, MobileEndpoint
+ end
+
def sandbox?
@sandbox
end
- def arn
- self[:arn]
- end
-
def confirm_sandbox
@sandbox = (arn =~ /:app\/APNS_SANDBOX\//)
end
end
module AndroidEndpoint
- def arn
- self[:arn]
+ def self.extended(obj)
+ obj.__send__ :extend, MobileEndpoint
end
end
module Account
[:access_key_id, :secret_access_key, :region].each do |attr|
@@ -32,10 +38,12 @@
@values = symbolize_keys_recursive(configuration_values)
if ios_endpoint
ios_endpoint.extend(IOSEndpoint)
ios_endpoint.confirm_sandbox
end
- android_endpoint.extend(AndroidEndpoint) if android_endpoint
+ if android_endpoint
+ android_endpoint.extend(AndroidEndpoint)
+ end
account.extend(Account)
end
def account
@values[:account]