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.



21254
21255
21256
21257
21258
21259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21254

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.



21252
21253
21254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21252

def environment
  @environment
end

#roleObject (readonly)

Returns the value of attribute role.



21252
21253
21254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21252

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21265
21266
21267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21265

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

#to_hashObject



21269
21270
21271
21272
21273
21274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21269

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

#to_jsonObject



21261
21262
21263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21261

def to_json
  JSON.dump(to_hash)
end