Commit b231590
Changed files (9)
lib/scim/shady/address.rb
@@ -0,0 +1,41 @@
+module Scim
+ module Shady
+ class Address
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def street_address
+ to_h['streetAddress']
+ end
+
+ def locality
+ to_h['locality']
+ end
+
+ def region
+ to_h['region']
+ end
+
+ def postal_code
+ to_h['postalCode']
+ end
+
+ def country
+ to_h['country']
+ end
+
+ def formatted
+ "#{street_address}\n#{locality}, #{region} #{postal_code} #{country}"
+ end
+
+ def primary?
+ to_h['primary']
+ end
+
+ def to_h
+ @hash
+ end
+ end
+ end
+end
lib/scim/shady/group.rb
@@ -0,0 +1,25 @@
+module Scim
+ module Shady
+ class Group
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def value
+ to_h['value']
+ end
+
+ def reference
+ to_h['$ref']
+ end
+
+ def display
+ to_h['display']
+ end
+
+ def to_h
+ @hash
+ end
+ end
+ end
+end
lib/scim/shady/instant_messenger.rb
@@ -0,0 +1,21 @@
+module Scim
+ module Shady
+ class InstantMessenger
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def value
+ to_h['value']
+ end
+
+ def type
+ to_h['type']
+ end
+
+ def to_h
+ @hash
+ end
+ end
+ end
+end
lib/scim/shady/name.rb
@@ -0,0 +1,17 @@
+module Scim
+ module Shady
+ class Name
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def formatted
+ to_h['formatted']
+ end
+
+ def to_h
+ @hash['name']
+ end
+ end
+ end
+end
lib/scim/shady/phone_number.rb
@@ -0,0 +1,29 @@
+module Scim
+ module Shady
+ class PhoneNumber
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def value
+ to_h['value']
+ end
+
+ def type
+ to_h['type']
+ end
+
+ def work?
+ type == 'work'
+ end
+
+ def mobile?
+ type == 'mobile'
+ end
+
+ def to_h
+ @hash
+ end
+ end
+ end
+end
lib/scim/shady/photo.rb
@@ -0,0 +1,29 @@
+module Scim
+ module Shady
+ class Photo
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def value
+ to_h['value']
+ end
+
+ def type
+ to_h['type']
+ end
+
+ def photo?
+ type == 'photo'
+ end
+
+ def thumbnail?
+ type == 'thumbnail'
+ end
+
+ def to_h
+ @hash
+ end
+ end
+ end
+end
lib/scim/shady/user.rb
@@ -1,158 +1,5 @@
module Scim
module Shady
- class X509Certificate
- def initialize(hash)
- @hash = hash
- end
-
- def value
- to_h['value']
- end
-
- def to_h
- @hash
- end
- end
- class Group
- def initialize(hash)
- @hash = hash
- end
-
- def value
- to_h['value']
- end
-
- def reference
- to_h['$ref']
- end
-
- def display
- to_h['display']
- end
-
- def to_h
- @hash
- end
- end
- class Photo
- def initialize(hash)
- @hash = hash
- end
-
- def value
- to_h['value']
- end
-
- def type
- to_h['type']
- end
-
- def photo?
- type == 'photo'
- end
-
- def thumbnail?
- type == 'thumbnail'
- end
-
- def to_h
- @hash
- end
- end
- class InstantMessenger
- def initialize(hash)
- @hash = hash
- end
-
- def value
- to_h['value']
- end
-
- def type
- to_h['type']
- end
-
- def to_h
- @hash
- end
- end
- class PhoneNumber
- def initialize(hash)
- @hash = hash
- end
-
- def value
- to_h['value']
- end
-
- def type
- to_h['type']
- end
-
- def work?
- type == 'work'
- end
-
- def mobile?
- type == 'mobile'
- end
-
- def to_h
- @hash
- end
- end
- class Name
- def initialize(hash)
- @hash = hash
- end
-
- def formatted
- to_h['formatted']
- end
-
- def to_h
- @hash['name']
- end
- end
-
- class Address
- def initialize(hash)
- @hash = hash
- end
-
- def street_address
- to_h['streetAddress']
- end
-
- def locality
- to_h['locality']
- end
-
- def region
- to_h['region']
- end
-
- def postal_code
- to_h['postalCode']
- end
-
- def country
- to_h['country']
- end
-
- def formatted
- "#{street_address}\n#{locality}, #{region} #{postal_code} #{country}"
- end
-
- def primary?
- to_h['primary']
- end
-
- def to_h
- @hash
- end
- end
-
class User < Resource
def username
to_h['userName']
@@ -214,7 +61,6 @@ module Scim
to_h['x509Certificates'].map { |x| X509Certificate.new(x) }
end
-
class << self
def build
builder do |builder|
lib/scim/shady/x509_certificate.rb
@@ -0,0 +1,17 @@
+module Scim
+ module Shady
+ class X509Certificate
+ def initialize(hash)
+ @hash = hash
+ end
+
+ def value
+ to_h['value']
+ end
+
+ def to_h
+ @hash
+ end
+ end
+ end
+end
lib/scim/shady.rb
@@ -2,13 +2,20 @@ require "forwardable"
require "json"
require "time"
+require "scim/shady/address"
require "scim/shady/builders"
+require "scim/shady/group"
+require "scim/shady/instant_messenger"
require "scim/shady/metadata"
+require "scim/shady/name"
+require "scim/shady/phone_number"
+require "scim/shady/photo"
require "scim/shady/resource"
require "scim/shady/schemas"
require "scim/shady/service_provider_configuration"
require "scim/shady/user"
require "scim/shady/version"
+require "scim/shady/x509_certificate"
module Scim
module Shady