Class: CardDB::Deck
Overview
Wrapper for hosted Deck objects
Instance Attribute Summary
Attributes inherited from Resource
#client, #data
Instance Method Summary
collapse
Methods inherited from Resource
#[], #initialize, #key?, #to_h, #to_json
Instance Method Details
#account_id ⇒ Object
783
784
785
|
# File 'lib/carddb/collection.rb', line 783
def account_id
data['accountId']
end
|
#api_application_id ⇒ Object
787
788
789
|
# File 'lib/carddb/collection.rb', line 787
def api_application_id
data['apiApplicationId']
end
|
#created_at ⇒ Object
851
852
853
|
# File 'lib/carddb/collection.rb', line 851
def created_at
parse_time(data['createdAt'])
end
|
#description ⇒ Object
811
812
813
|
# File 'lib/carddb/collection.rb', line 811
def description
data['description']
end
|
#entries ⇒ Object
835
836
837
|
# File 'lib/carddb/collection.rb', line 835
def entries
@entries ||= (data['entries'] || []).map { |entry| DeckEntry.new(entry, client: client) }
end
|
#external_ref ⇒ Object
823
824
825
|
# File 'lib/carddb/collection.rb', line 823
def external_ref
data['externalRef']
end
|
815
816
817
|
# File 'lib/carddb/collection.rb', line 815
def format_key
data['formatKey']
end
|
#game ⇒ Object
795
796
797
|
# File 'lib/carddb/collection.rb', line 795
def game
@game ||= data['game'] ? Game.new(data['game'], client: client) : nil
end
|
#game_id ⇒ Object
791
792
793
|
# File 'lib/carddb/collection.rb', line 791
def game_id
data['gameId']
end
|
#has_unpublished_changes? ⇒ Boolean
847
848
849
|
# File 'lib/carddb/collection.rb', line 847
def has_unpublished_changes?
!!data['hasUnpublishedChanges']
end
|
#id ⇒ Object
779
780
781
|
# File 'lib/carddb/collection.rb', line 779
def id
data['id']
end
|
#identifier ⇒ Object
803
804
805
|
# File 'lib/carddb/collection.rb', line 803
def identifier
data['identifier']
end
|
#latest_published_version ⇒ Object
839
840
841
|
# File 'lib/carddb/collection.rb', line 839
def latest_published_version
@latest_published_version ||= data['latestPublishedVersion'] ? DeckVersion.new(data['latestPublishedVersion'], client: client) : nil
end
|
831
832
833
|
# File 'lib/carddb/collection.rb', line 831
def metadata
data['metadata'] || {}
end
|
#published_at ⇒ Object
843
844
845
|
# File 'lib/carddb/collection.rb', line 843
def published_at
parse_time(data['publishedAt'])
end
|
#slug ⇒ Object
799
800
801
|
# File 'lib/carddb/collection.rb', line 799
def slug
data['slug']
end
|
#source_url ⇒ Object
827
828
829
|
# File 'lib/carddb/collection.rb', line 827
def source_url
data['sourceUrl']
end
|
#title ⇒ Object
807
808
809
|
# File 'lib/carddb/collection.rb', line 807
def title
data['title']
end
|
#updated_at ⇒ Object
855
856
857
|
# File 'lib/carddb/collection.rb', line 855
def updated_at
parse_time(data['updatedAt'])
end
|
#visibility ⇒ Object
819
820
821
|
# File 'lib/carddb/collection.rb', line 819
def visibility
data['visibility']
end
|