Class: Io::Flow::V0::Models::PhraseHint

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PhraseHint

Returns a new instance of PhraseHint.



23928
23929
23930
23931
23932
23933
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23928

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:phrase, :tariff_code], 'PhraseHint')
  @phrase = HttpClient::Preconditions.assert_class('phrase', opts.delete(:phrase), String)
  @tariff_code = (x = opts.delete(:tariff_code); x.is_a?(::Io::Flow::V0::Models::TariffCode) ? x : ::Io::Flow::V0::Models::TariffCode.new(x))
end

Instance Attribute Details

#phraseObject (readonly)

Returns the value of attribute phrase.



23926
23927
23928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23926

def phrase
  @phrase
end

#tariff_codeObject (readonly)

Returns the value of attribute tariff_code.



23926
23927
23928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23926

def tariff_code
  @tariff_code
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23939
23940
23941
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23939

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

#to_hashObject



23943
23944
23945
23946
23947
23948
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23943

def to_hash
  {
    :phrase => phrase,
    :tariff_code => tariff_code.to_hash
  }
end

#to_jsonObject



23935
23936
23937
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23935

def to_json
  JSON.dump(to_hash)
end