Class: Supply::Listing

Inherits:
Object
  • Object
show all
Defined in:
supply/lib/supply/listing.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(google_api, language, source_listing = nil) ⇒ Listing

Initializes the listing to use the given api client, language, and fills it with the current listing if available



11
12
13
14
15
16
17
18
19
20
21
# File 'supply/lib/supply/listing.rb', line 11

def initialize(google_api, language, source_listing = nil)
  @google_api = google_api
  @language = language

  if source_listing # this might be nil, e.g. when creating a new locale
    self.title = source_listing.title
    self.short_description = source_listing.short_description
    self.full_description = source_listing.full_description
    self.video = source_listing.video
  end
end

Instance Attribute Details

#full_descriptionObject

Returns the value of attribute full_description.



7
8
9
# File 'supply/lib/supply/listing.rb', line 7

def full_description
  @full_description
end

#languageObject (readonly)

Returns the value of attribute language.



3
4
5
# File 'supply/lib/supply/listing.rb', line 3

def language
  @language
end

#short_descriptionObject

Returns the value of attribute short_description.



6
7
8
# File 'supply/lib/supply/listing.rb', line 6

def short_description
  @short_description
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'supply/lib/supply/listing.rb', line 5

def title
  @title
end

#videoObject

Returns the value of attribute video.



8
9
10
# File 'supply/lib/supply/listing.rb', line 8

def video
  @video
end

Instance Method Details

#saveObject

Updates the listing in the current edit



24
25
26
27
28
29
30
# File 'supply/lib/supply/listing.rb', line 24

def save
  @google_api.update_listing_for_language(language: language,
                                          title: title,
                                          short_description: short_description,
                                          full_description: full_description,
                                          video: video)
end