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.



18518
18519
18520
18521
18522
18523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18518

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.



18516
18517
18518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18516

def environment
  @environment
end

#roleObject (readonly)

Returns the value of attribute role.



18516
18517
18518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18516

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18529
18530
18531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18529

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

#to_hashObject



18533
18534
18535
18536
18537
18538
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18533

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

#to_jsonObject



18525
18526
18527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18525

def to_json
  JSON.dump(to_hash)
end