Class: Io::Flow::V0::Models::OrganizationAuthorization

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Defines the data used for broad authorization of user access to org level data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationAuthorization

Returns a new instance of OrganizationAuthorization.



22277
22278
22279
22280
22281
22282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22277

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:role, :environment], 'OrganizationAuthorization')
  @role = (x = opts.delete(:role); x.is_a?(::Io::Flow::V0::Models::Role) ? x : ::Io::Flow::V0::Models::Role.apply(x))
  @environment = (x = opts.delete(:environment); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(x))
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



22275
22276
22277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22275

def environment
  @environment
end

#roleObject (readonly)

Returns the value of attribute role.



22275
22276
22277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22275

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22288
22289
22290
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22288

def copy(incoming={})
  OrganizationAuthorization.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



22292
22293
22294
22295
22296
22297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22292

def to_hash
  {
    :role => role.value,
    :environment => environment.value
  }
end

#to_jsonObject



22284
22285
22286
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22284

def to_json
  JSON.dump(to_hash)
end