Class: RubyFly::RC::Target
- Inherits:
-
Object
- Object
- RubyFly::RC::Target
- Defined in:
- lib/ruby_fly/rc.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#team ⇒ Object
Returns the value of attribute team.
-
#token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #bearer_token ⇒ Object
- #bearer_token=(value) ⇒ Object
- #encode_with(coder) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(parameters) ⇒ Target
constructor
A new instance of Target.
Constructor Details
#initialize(parameters) ⇒ Target
Returns a new instance of Target.
52 53 54 55 56 57 |
# File 'lib/ruby_fly/rc.rb', line 52 def initialize(parameters) @name = parameters[:name] @api = parameters[:api] @team = parameters[:team] @token = parameters[:token] end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
38 39 40 |
# File 'lib/ruby_fly/rc.rb', line 38 def api @api end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
39 40 41 |
# File 'lib/ruby_fly/rc.rb', line 39 def name @name end |
#team ⇒ Object
Returns the value of attribute team.
38 39 40 |
# File 'lib/ruby_fly/rc.rb', line 38 def team @team end |
#token ⇒ Object
Returns the value of attribute token.
38 39 40 |
# File 'lib/ruby_fly/rc.rb', line 38 def token @token end |
Class Method Details
.clone(target, overrides = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ruby_fly/rc.rb', line 41 def self.clone(target, overrides = {}) return target if target.nil? Target.new( name: overrides[:name] || target.name, api: overrides[:api] || target.api, team: overrides[:team] || target.team, token: overrides[:token] || target.token ) end |
Instance Method Details
#==(other) ⇒ Object
79 80 81 |
# File 'lib/ruby_fly/rc.rb', line 79 def ==(other) other.class == self.class && other.state == state end |
#bearer_token ⇒ Object
66 67 68 |
# File 'lib/ruby_fly/rc.rb', line 66 def bearer_token @token[:value] if @token[:type] == 'bearer' end |
#bearer_token=(value) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/ruby_fly/rc.rb', line 59 def bearer_token=(value) @token = { type: 'bearer', value: } end |
#encode_with(coder) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/ruby_fly/rc.rb', line 70 def encode_with(coder) coder.represent_map( nil, RubyFly::RC::Conversions.stringify_keys( { api: @api, team: @team.to_s, token: @token } ) ) end |
#eql?(other) ⇒ Boolean
83 84 85 |
# File 'lib/ruby_fly/rc.rb', line 83 def eql?(other) self == other end |
#hash ⇒ Object
87 88 89 |
# File 'lib/ruby_fly/rc.rb', line 87 def hash state.hash end |