Class: Phraseapp::Rest::Query::Base
- Inherits:
-
Object
- Object
- Phraseapp::Rest::Query::Base
- Defined in:
- lib/phraseapp-rest/query/base.rb
Instance Attribute Summary collapse
-
#excluded ⇒ Object
Returns the value of attribute excluded.
-
#id ⇒ Object
Returns the value of attribute id.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#unverified ⇒ Object
Returns the value of attribute unverified.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(id: nil, tags: nil, unverified: nil, excluded: nil, updated_at: nil) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Constructor Details
#initialize(id: nil, tags: nil, unverified: nil, excluded: nil, updated_at: nil) ⇒ Base
Returns a new instance of Base.
13 14 15 16 17 18 19 |
# File 'lib/phraseapp-rest/query/base.rb', line 13 def initialize(id: nil, tags: nil, unverified: nil, excluded: nil, updated_at: nil) @id = id @tags = self.unverified = unverified unless unverified.nil? self.excluded = excluded unless excluded.nil? self.updated_at = updated_at unless updated_at.nil? end |
Instance Attribute Details
#excluded ⇒ Object
Returns the value of attribute excluded.
11 12 13 |
# File 'lib/phraseapp-rest/query/base.rb', line 11 def excluded @excluded end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/phraseapp-rest/query/base.rb', line 10 def id @id end |
#tags ⇒ Object
Returns the value of attribute tags.
10 11 12 |
# File 'lib/phraseapp-rest/query/base.rb', line 10 def @tags end |
#unverified ⇒ Object
Returns the value of attribute unverified.
11 12 13 |
# File 'lib/phraseapp-rest/query/base.rb', line 11 def unverified @unverified end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
11 12 13 |
# File 'lib/phraseapp-rest/query/base.rb', line 11 def updated_at @updated_at end |
Instance Method Details
#to_s ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/phraseapp-rest/query/base.rb', line 38 def to_s hash = {} %w(id tags unverified excluded updated_at).each do |attr| hash[attr.to_sym] = URI.encode_www_form_component(send(attr)) unless send(attr).nil? end 'q=' + hash.to_a.map { |x| "#{x[0]}:#{x[1]}" }.join('%20').to_s unless hash.empty? end |