Class: PhraseApp::RequestParams::LocaleParams

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/phraseapp-ruby.rb

Overview

LocaleParams

Parameters:

code

Locale ISO code

default

Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale.

main

Indicates whether locale is a main locale.

name

Locale name

rtl

Indicates whether locale is a RTL (Right-to-Left) locale.

source_locale_id

Source locale. Can be the name or public id of the locale. Preferred is the public id.

Instance Method Summary collapse

Instance Method Details

#code=(val) ⇒ Object



523
524
525
# File 'lib/phraseapp-ruby.rb', line 523

def code=(val)
  self.code = val
end

#default=(val) ⇒ Object



527
528
529
530
531
532
533
534
535
# File 'lib/phraseapp-ruby.rb', line 527

def default=(val)
  if val.is_a?(TrueClass)
    self.default = true
  elsif val.is_a?(FalseClass) #ignore
    self.default = b
  else
    PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
  end
end

#main=(val) ⇒ Object



537
538
539
540
541
542
543
544
545
# File 'lib/phraseapp-ruby.rb', line 537

def main=(val)
  if val.is_a?(TrueClass)
    self.main = true
  elsif val.is_a?(FalseClass) #ignore
    self.main = b
  else
    PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
  end
end

#name=(val) ⇒ Object



547
548
549
# File 'lib/phraseapp-ruby.rb', line 547

def name=(val)
  self.name = val
end

#rtl=(val) ⇒ Object



551
552
553
554
555
556
557
558
559
# File 'lib/phraseapp-ruby.rb', line 551

def rtl=(val)
  if val.is_a?(TrueClass)
    self.rtl = true
  elsif val.is_a?(FalseClass) #ignore
    self.rtl = b
  else
    PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
  end
end

#source_locale_id=(val) ⇒ Object



561
562
563
# File 'lib/phraseapp-ruby.rb', line 561

def source_locale_id=(val)
  self.source_locale_id = val
end

#to_hObject



573
574
575
# File 'lib/phraseapp-ruby.rb', line 573

def to_h
  @table.dup
end

#validateObject



565
566
567
568
569
570
571
# File 'lib/phraseapp-ruby.rb', line 565

def validate
  if self.code == nil || self.code == "" 
    raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"code\" of \"LocaleParams\" not set")
  endif self.name == nil || self.name == "" 
    raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"name\" of \"LocaleParams\" not set")
  end
end